This file contains hidden or 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
| { | |
| "contracts/SupplyChain.sol": { | |
| "__sources__": { | |
| "contracts/SupplyChain.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ncontract SupplyChain {\r\n\r\n enum Stage{\r\n Created,\r\n AtShop,\r\n Delivered\r\n }\r\n\r\n struct Product{\r\n uint id;\r\n string name;\r\n Stage stage;\r\n string[] history;\r\n }\r\n\r\n mapping(uint => Product) public products;\r\n\r\n\r\n function createProduct(\r\n uint _id,\r\n string memory _name\r\n ) public {\r\n\r\n products[_id].id = _id;\r\n products[_id].name = _name;\r\n products[_id].stage = Stage.Created;\r\n\r\n products[_id].history.push(\r\n \"Created at Factory\"\r\n );\r\n }\r\n\r\n\r\n function moveToShop(uint _id) public {\r\n\r\n require(\r\n products[_id].stage == Stage.Created,\r\n \"Wrong Stage\"\r\n );\r\n\r\n products[_id]. |