| Listing 2. Source code for creating blueprints. |
| 1 function createBlueprint( 2 BlueprintItSet storage self, 3 address key, 4 string memory token, 5 string memory description, 6 string memory partyName 7 ) public returns (bytes32, Blueprint memory) { 8 uint256 creationTimestamp = block.timestamp; 9 bytes32 blueprintId = keccak256( 10 abi.encode(token, description, creationTimestamp) 11 ); 12 Blueprint memory createdBlueprint = Blueprint( 13 blueprintId, 14 token, 15 description, 16 supplierName, 17 creationTimestamp 18 ); 19 self.supplierBlueprints[key].push(createdBlueprint); 20 self.allBlueprints.push(createdBlueprint); 21 return (blueprintId, createdBlueprint); 22 } |