CommodityW_D

Git Source

Author: Tinotenda Joe

This contract represents a shipping model for commodities

State Variables

Owner

Store the contract owner's address

address Owner;

commodityId

Addresses for commodityId, sender, transporter, receiver

address commodityId;

sender

address sender;

transporter

address transporter;

receiver

address receiver;

status

Stores the current package status

packageStatus status;

Functions

constructor

Setup the contract with initial details

constructor(address _address, address Sender, address Transporter, address Receiver);

Parameters

NameTypeDescription
_addressaddressThe commodity address
SenderaddressThe sender's address
TransporteraddressThe transporter's address
ReceiveraddressThe receiver's address

pickWD

Called when the transporter picks the package

function pickWD(address _address, address _transporter) public;

Parameters

NameTypeDescription
_addressaddressThe commodity address
_transporteraddressThe transporter's address

receiveWD

Called when the receiver receives the package

function receiveWD(address _address, address Receiver) public;

Parameters

NameTypeDescription
_addressaddressThe commodity address
ReceiveraddressThe receiver's address

getBatchIDStatus

Returns the current status of the package

function getBatchIDStatus() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256status The current status of the package

Errors

UnAUthorised_Receivers_Account

Thrown when an unauthorized receiver's account is used

error UnAUthorised_Receivers_Account();

UnAUthorised_Shippers_Account

Thrown when an unauthorized shipper's account is used

error UnAUthorised_Shippers_Account();

Enums

packageStatus

Enumeration of various package statuses

enum packageStatus {
    atcreator,
    picked,
    delivered
}