Wholesaler

Git Source

Author: Your Name

This contract manages the transfer of commodities from a wholesaler to a distributor.

This contract interacts with the Commodity and CommodityW_D contracts.

State Variables

CommoditiesAtWholesaler

Maps a wholesaler's address to an array of commodity addresses that the wholesaler has received.

mapping(address => address[]) public CommoditiesAtWholesaler;

CommodityWtoD

Maps a wholesaler's address to an array of CommodityW_D contract addresses that the wholesaler has initiated.

mapping(address => address[]) public CommodityWtoD;

CommodityWtoDTxContract

Maps a commodity's address to the CommodityW_D contract address that manages its transfer from a wholesaler to a distributor.

mapping(address => address) public CommodityWtoDTxContract;

Functions

commodityRecievedAtWholesaler

Marks a commodity as received by the wholesaler.

Calls the receivedCommodity function of the Commodity contract.

function commodityRecievedAtWholesaler(address _address) public;

Parameters

NameTypeDescription
_addressaddressThe address of the Commodity contract.

transferCommodityWtoD

Initiates the transfer of a commodity from the wholesaler to a distributor.

Creates a new CommodityW_D contract for the transfer.

function transferCommodityWtoD(address _address, address transporter, address receiver) public;

Parameters

NameTypeDescription
_addressaddressThe address of the Commodity contract.
transporteraddressThe address of the transporter.
receiveraddressThe address of the distributor.

getCommoditiesAtWholesaler

function getCommoditiesAtWholesaler(address _wholesaler) external view returns (address[] memory);

getCommodityWtoD

function getCommodityWtoD(address _wholesaler) external view returns (address[] memory);