CommodityW_D
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
Name | Type | Description |
---|---|---|
_address | address | The commodity address |
Sender | address | The sender's address |
Transporter | address | The transporter's address |
Receiver | address | The receiver's address |
pickWD
Called when the transporter picks the package
function pickWD(address _address, address _transporter) public;
Parameters
Name | Type | Description |
---|---|---|
_address | address | The commodity address |
_transporter | address | The transporter's address |
receiveWD
Called when the receiver receives the package
function receiveWD(address _address, address Receiver) public;
Parameters
Name | Type | Description |
---|---|---|
_address | address | The commodity address |
Receiver | address | The receiver's address |
getBatchIDStatus
Returns the current status of the package
function getBatchIDStatus() public view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | status 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
}