RawMaterial

Git Source

Author: Tinotenda Joe

This contract is part of a supply chain protocol that allows managing the logistics of raw materials

State Variables

Owner

address Owner;

productid

address productid;

description

bytes32 description;

quantity

uint256 quantity;

transporter

address transporter;

manufacturer

address manufacturer;

supplier

address supplier;

status

packageStatus status;

packageReceiverDescription

bytes32 packageReceiverDescription;

txnContractAddress

address txnContractAddress;

Functions

constructor

Construct a new RawMaterial contract

constructor(
    address _creatorAddr,
    address _productid,
    bytes32 _description,
    uint256 _quantity,
    address _transporterAddr,
    address _manufacturerAddr
);

Parameters

NameTypeDescription
_creatorAddraddressthe address of the creator
_productidaddressthe ID of the product
_descriptionbytes32the description of the product
_quantityuint256the quantity of the product
_transporterAddraddressthe address of the transporter
_manufacturerAddraddressthe address of the manufacturer

getSuppliedRawMaterials

Returns all the supplied raw materials

function getSuppliedRawMaterials()
    public
    view
    returns (address, bytes32, uint256, address, address, address, address);

Returns

NameTypeDescription
<none>addressproductid, description, quantity, supplier, transporter, manufacturer, txnContractAddress
<none>bytes32
<none>uint256
<none>address
<none>address
<none>address
<none>address

getRawMaterialStatus

Returns the status of the raw material

function getRawMaterialStatus() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256status of the raw material

pickPackage

Pick a package from the supplier

function pickPackage(address _transporterAddr) public;

Parameters

NameTypeDescription
_transporterAddraddressthe address of the transporter

receivedPackage

Receive a package at the manufacturer

function receivedPackage(address _manufacturerAddr) public;

Parameters

NameTypeDescription
_manufacturerAddraddressthe address of the manufacturer

Events

ShippmentUpdate

Reports a status update for the shipment

event ShippmentUpdate(
    address indexed ProductID,
    address indexed Transporter,
    address indexed Manufacturer,
    uint256 TransporterType,
    uint256 Status
);

Enums

packageStatus

Possible statuses of a package

enum packageStatus {
    atCreator,
    picked,
    delivered
}