Created
October 3, 2022 22:35
-
-
Save ac12644/8902f16ddcb11e490f43e7796aac249c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
... | |
// 4th step in supply chain process | |
function shippedItemByFarmer(uint256 _productCode) | |
public | |
payable | |
onlyFarmer // check _msgSender() belongs to FarmerRole | |
purchasedByDistributor(_productCode) | |
verifyCaller(items[_productCode].farmerID) // check _msgSender() is originFarmID | |
{ | |
items[_productCode].itemState = State.ShippedByFarmer; // update state | |
emit ShippedByFarmer(_productCode); | |
} | |
// 5th step in supply chain process | |
function receivedItemByDistributor(uint256 _productCode) | |
public | |
onlyDistributor // check _msgSender() belongs to DistributorRole | |
shippedByFarmer(_productCode) | |
verifyCaller(items[_productCode].ownerID) // check _msgSender() is owner | |
{ | |
items[_productCode].itemState = State.ReceivedByDistributor; // update state | |
emit ReceivedByDistributor(_productCode); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment