Created
October 3, 2022 22:42
-
-
Save ac12644/f6b22529a06617205e7145f4c78c3c43 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; | |
... | |
// 6th step in supply chain process | |
function processedItemByDistributor(uint256 _productCode, uint256 slices) | |
public | |
onlyDistributor // check _msgSender() belongs to DistributorRole | |
receivedByDistributor(_productCode) | |
verifyCaller(items[_productCode].ownerID) // check _msgSender() is owner | |
{ | |
items[_productCode].itemState = State.ProcessedByDistributor; // update state | |
items[_productCode].productSliced = slices; // add slice amount | |
emit ProcessedByDistributor(_productCode); | |
} | |
// 7th step in supply chain process | |
function packageItemByDistributor(uint256 _productCode) | |
public | |
onlyDistributor // check _msgSender() belongs to DistributorRole | |
processByDistributor(_productCode) | |
verifyCaller(items[_productCode].ownerID) // check _msgSender() is owner | |
{ | |
items[_productCode].itemState = State.PackageByDistributor; | |
emit PackagedByDistributor(_productCode); | |
} | |
// 8th step in supply chain process | |
function sellItemByDistributor(uint256 _productCode, uint256 _price) | |
public | |
onlyDistributor // check _msgSender() belongs to DistributorRole | |
packagedByDistributor(_productCode) | |
verifyCaller(items[_productCode].ownerID) // check _msgSender() is owner | |
{ | |
items[_productCode].itemState = State.ForSaleByDistributor; | |
items[_productCode].productPrice = _price; | |
emit ForSaleByDistributor(productCode); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment