UNPKG

jcc-solidity-utils

Version:
963 lines (962 loc) 1.14 MB
{ "contractName": "CommandList", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/CommandList.sol\":\"CommandList\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/CommandList.sol\":{\"keccak256\":\"0xa7a58e682db5b59a10603a8bb02bf151802b462be21279d79fd594b34f49ad26\",\"urls\":[\"bzzr://c13f88bce10557ebe54f6e9f5767240be8a1c1c9b6d19bfb57178b9e2f19a7d6\"]},\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x239546071316c89d3bbc9e61b2ccae270a4493bbd2f7c240052f533807d50ab7\",\"urls\":[\"bzzr://267bf48e0a30f7b671aa3c98a6b27ffe7bc64efd6533f49e54188b520baa94c5\"]}},\"version\":1}", "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820edec1f5f4cc86cd31d5054f242a4d0efd448ac2fa5cb9b58fa92db21862c83870029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820edec1f5f4cc86cd31d5054f242a4d0efd448ac2fa5cb9b58fa92db21862c83870029", "sourceMap": "126:9106:15:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24", "deployedSourceMap": "126:9106:15:-;;;;;;;;", "source": "pragma solidity >=0.4.24;\n\nimport \"../math/SafeMath.sol\";\n// import \"./TransferList.sol\";\n\n/**\n * @dev 通证列表处理\n */\nlibrary CommandList {\n using SafeMath for uint256;\n\n enum Verbs {TRANSFER, EXCHANGE, EXECUTE}\n\n // 通证定义\n struct element {\n // 提交人\n address submitter;\n // 处理人\n address agent;\n // 从哪条链,遵循BIP44\n uint256 fromChain;\n // 跨到哪条链,遵循BIP44\n uint256 toChain;\n // 操作 0 transfer 1 exchange 2 execute\n uint256 verbs;\n // 状态 1表示提交等待锁定处理,2表示被锁定 3表示部分已经处理剩余解除锁定等待处理 4撤销处理 5处理完毕订单关闭\n uint256 status;\n // 细节数据索引位置, payload类型有三种: Transfer, Exchange, Execute\n bytes32 payloadHash;\n }\n\n struct commandMap {\n // data array 单向增加\n element[] list;\n // new fresh command\n uint256[] waiting;\n // locking command for process\n uint256[] locking;\n // canceled command:用户主动取消或者公证人取消\n uint256[] canceled;\n // completed command\n uint256[] completed;\n // 提交人命令清单,数组单向增加\n mapping(address => uint256[]) submitterCmds;\n // 处理人命令清单,数组单向增加\n mapping(address => uint256[]) agentCmds;\n }\n\n modifier validVerbs(uint256 _verbs) {\n require(\n _verbs == uint256(Verbs.TRANSFER) ||\n _verbs == uint256(Verbs.EXCHANGE) ||\n _verbs == uint256(Verbs.EXECUTE),\n \"invalid verbs\"\n );\n _;\n }\n\n function exist(commandMap storage self, uint256 _idx)\n internal\n view\n returns (bool)\n {\n if (_idx >= self.list.length) return false;\n return true;\n }\n\n // 增加跨链转账指令,单向增长\n function insert(\n commandMap storage self,\n address _submitter,\n uint256 _fromChain,\n uint256 _toChain,\n uint256 _verbs,\n bytes32 _payloadHash\n ) internal validVerbs(_verbs) returns (uint256) {\n element memory e = element({\n submitter: _submitter,\n agent: address(0),\n fromChain: _fromChain,\n toChain: _toChain,\n verbs: _verbs,\n status: 1,\n payloadHash: _payloadHash\n });\n\n uint256 _idx = self.list.length;\n self.list.push(e);\n self.waiting.push(_idx);\n self.submitterCmds[_submitter].push(_idx);\n\n return _idx;\n }\n\n function getIdx(uint256[] _arr, uint256 _idx)\n internal\n pure\n returns (bool, uint256)\n {\n if (_arr.length == 0) {\n return (false, 0);\n }\n for (uint256 i = _arr.length - 1; i > 0; i--) {\n if (_arr[i] == _idx) {\n return (true, i);\n }\n }\n\n return _arr[0] == _idx ? (true, 0) : (false, 0);\n }\n\n function lock(commandMap storage self, address _agent, uint256 _idx)\n internal\n returns (bool)\n {\n require(exist(self, _idx), \"lock command does not exist\");\n\n // get idx from waiting\n uint256 _waitingIdx;\n bool _exist;\n (_exist, _waitingIdx) = getIdx(self.waiting, _idx);\n require(_exist, \"idx does not exist in waiting list\");\n\n // remove idx from waiting\n self.waiting[_waitingIdx] = self.waiting[self.waiting.length.sub(1)];\n self.waiting.length = self.waiting.length.sub(1);\n\n // add idx to lock\n self.locking.push(_idx);\n // update to agent mapping\n self.list[_idx].agent = _agent;\n self.list[_idx].status = 2;\n self.agentCmds[_agent].push(_idx);\n\n return true;\n }\n\n function cancelFromWaiting(commandMap storage self, uint256 _idx)\n internal\n returns (bool)\n {\n // get idx from waiting\n uint256 _waitingIdx;\n bool _exist;\n (_exist, _waitingIdx) = getIdx(self.waiting, _idx);\n require(_exist, \"idx does not exist in waiting list\");\n\n // remove idx from waiting 0\n self.waiting[_waitingIdx] = self.waiting[self.waiting.length.sub(1)];\n self.waiting.length = self.waiting.length.sub(1);\n\n // add idx to canceled\n self.canceled.push(_idx);\n self.list[_idx].status = 4;\n\n return true;\n }\n\n function cancel(commandMap storage self, address _agent, uint256 _idx)\n internal\n returns (bool)\n {\n require(exist(self, _idx), \"lock command does not exist\");\n require(\n self.list[_idx].status != 4 && self.list[_idx].status != 5,\n \"lock command status can not be canceled or done\"\n );\n\n // in waiting list\n if (self.list[_idx].status == 1) {\n // 调用者要检查msg.sender\n require(\n _agent == self.list[_idx].submitter,\n \"user only cancel him own command\"\n );\n return cancelFromWaiting(self, _idx);\n }\n\n // 代理取消\n // get idx from locking\n uint256 _lockingIdx;\n bool _exist;\n (_exist, _lockingIdx) = getIdx(self.locking, _idx);\n require(_exist, \"idx does not exist in locking list\");\n require(_agent == self.list[_idx].agent, \"agent cancel command himself\");\n\n // remove idx from locking\n self.locking[_lockingIdx] = self.locking[self.locking.length.sub(1)];\n self.locking.length = self.locking.length.sub(1);\n\n // add idx to canceled\n self.canceled.push(_idx);\n self.list[_idx].status = 4;\n\n return true;\n }\n\n function complete(commandMap storage self, address _agent, uint256 _idx)\n internal\n returns (bool)\n {\n require(exist(self, _idx), \"lock command does not exist\");\n // 只有被锁定的才能结束\n require(\n self.list[_idx].status == 2,\n \"lock command status can be completed\"\n );\n require(_agent == self.list[_idx].agent, \"agent cancel command himself\");\n\n // get idx from locking\n uint256 _lockingIdx;\n bool _exist;\n (_exist, _lockingIdx) = getIdx(self.locking, _idx);\n require(_exist, \"idx does not exist in locking list\");\n\n // remove idx from locking\n self.locking[_lockingIdx] = self.locking[self.locking.length.sub(1)];\n self.locking.length = self.locking.length.sub(1);\n\n // add idx to completed\n self.completed.push(_idx);\n self.list[_idx].status = 5;\n\n return true;\n }\n\n function count(commandMap storage self) internal view returns (uint256) {\n return self.list.length;\n }\n\n function countWaiting(commandMap storage self)\n internal\n view\n returns (uint256)\n {\n return self.waiting.length;\n }\n\n function countLocking(commandMap storage self)\n internal\n view\n returns (uint256)\n {\n return self.locking.length;\n }\n\n function countCanceled(commandMap storage self)\n internal\n view\n returns (uint256)\n {\n return self.canceled.length;\n }\n\n function countCompleted(commandMap storage self)\n internal\n view\n returns (uint256)\n {\n return self.completed.length;\n }\n\n function countBySubmitter(commandMap storage self, address _submitter)\n internal\n view\n returns (uint256)\n {\n return self.submitterCmds[_submitter].length;\n }\n\n function countByAgent(commandMap storage self, address _agent)\n internal\n view\n returns (uint256)\n {\n return self.agentCmds[_agent].length;\n }\n\n function getByIdx(commandMap storage self, uint256 _idx)\n internal\n view\n returns (CommandList.element)\n {\n require(_idx < self.list.length, \"index must small than current count\");\n return self.list[_idx];\n }\n\n function getIdxBySubmitter(commandMap storage self, address _submitter)\n internal\n view\n returns (uint256[])\n {\n return self.submitterCmds[_submitter];\n }\n\n function getIdxByAgent(commandMap storage self, address _agent)\n internal\n view\n returns (uint256[])\n {\n return self.agentCmds[_agent];\n }\n\n function getWaitingIdx(commandMap storage self)\n internal\n view\n returns (uint256[])\n {\n return self.waiting;\n }\n\n function getLockingIdx(commandMap storage self)\n internal\n view\n returns (uint256[])\n {\n return self.locking;\n }\n\n function getElement(\n commandMap storage self,\n uint256[] _arr,\n uint256 _from,\n uint256 _count\n ) internal view returns (CommandList.element[] memory) {\n uint256 _idx = 0;\n require(_count > 0, \"return number must bigger than 0\");\n CommandList.element[] memory res = new CommandList.element[](_count);\n\n for (uint256 i = _from; i < _arr.length; i++) {\n if (_idx == _count) {\n break;\n }\n\n res[_idx] = self.list[_arr[i]];\n _idx = _idx.add(1);\n }\n\n return res;\n }\n\n function getBySubmitter(\n commandMap storage self,\n address _submitter,\n uint256 _from,\n uint256 _count\n ) internal view returns (CommandList.element[] memory) {\n return getElement(self, self.submitterCmds[_submitter], _from, _count);\n }\n\n function getByAgent(\n commandMap storage self,\n address _agent,\n uint256 _from,\n uint256 _count\n ) internal view returns (CommandList.element[] memory) {\n return getElement(self, self.agentCmds[_agent], _from, _count);\n }\n\n function getByCanceled(commandMap storage self, uint256 _from, uint256 _count)\n internal\n view\n returns (CommandList.element[] memory)\n {\n return getElement(self, self.canceled, _from, _count);\n }\n\n function getByCompleted(\n commandMap storage self,\n uint256 _from,\n uint256 _count\n ) internal view returns (CommandList.element[] memory) {\n return getElement(self, self.completed, _from, _count);\n }\n}\n", "sourcePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/CommandList.sol", "ast": { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/CommandList.sol", "exportedSymbols": { "CommandList": [ 3760 ] }, "id": 3761, "nodeType": "SourceUnit", "nodes": [ { "id": 2748, "literals": [ "solidity", ">=", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:25:15" }, { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol", "file": "../math/SafeMath.sol", "id": 2749, "nodeType": "ImportDirective", "scope": 3761, "sourceUnit": 5658, "src": "27:30:15", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev 通证列表处理", "fullyImplemented": true, "id": 3760, "linearizedBaseContracts": [ 3760 ], "name": "CommandList", "nodeType": "ContractDefinition", "nodes": [ { "id": 2752, "libraryName": { "contractScope": null, "id": 2750, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5657, "src": "156:8:15", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5657", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "150:27:15", "typeName": { "id": 2751, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "169:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "canonicalName": "CommandList.Verbs", "id": 2756, "members": [ { "id": 2753, "name": "TRANSFER", "nodeType": "EnumValue", "src": "193:8:15" }, { "id": 2754, "name": "EXCHANGE", "nodeType": "EnumValue", "src": "203:8:15" }, { "id": 2755, "name": "EXECUTE", "nodeType": "EnumValue", "src": "213:7:15" } ], "name": "Verbs", "nodeType": "EnumDefinition", "src": "181:40:15" }, { "canonicalName": "CommandList.element", "id": 2771, "members": [ { "constant": false, "id": 2758, "name": "submitter", "nodeType": "VariableDeclaration", "scope": 2771, "src": "281:17:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2757, "name": "address", "nodeType": "ElementaryTypeName", "src": "281:7:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2760, "name": "agent", "nodeType": "VariableDeclaration", "scope": 2771, "src": "321:13:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2759, "name": "address", "nodeType": "ElementaryTypeName", "src": "321:7:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2762, "name": "fromChain", "nodeType": "VariableDeclaration", "scope": 2771, "src": "372:17:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2761, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "372:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2764, "name": "toChain", "nodeType": "VariableDeclaration", "scope": 2771, "src": "430:15:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2763, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "430:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2766, "name": "verbs", "nodeType": "VariableDeclaration", "scope": 2771, "src": "497:13:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2765, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "497:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2768, "name": "status", "nodeType": "VariableDeclaration", "scope": 2771, "src": "677:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2767, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "677:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2770, "name": "payloadHash", "nodeType": "VariableDeclaration", "scope": 2771, "src": "782:19:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 2769, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "782:7:15", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "name": "element", "nodeType": "StructDefinition", "scope": 3760, "src": "243:563:15", "visibility": "public" }, { "canonicalName": "CommandList.commandMap", "id": 2797, "members": [ { "constant": false, "id": 2774, "name": "list", "nodeType": "VariableDeclaration", "scope": 2797, "src": "865:14:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$2771_storage_$dyn_storage_ptr", "typeString": "struct CommandList.element[]" }, "typeName": { "baseType": { "contractScope": null, "id": 2772, "name": "element", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 2771, "src": "865:7:15", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$2771_storage_ptr", "typeString": "struct CommandList.element" } }, "id": 2773, "length": null, "nodeType": "ArrayTypeName", "src": "865:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$2771_storage_$dyn_storage_ptr", "typeString": "struct CommandList.element[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2777, "name": "waiting", "nodeType": "VariableDeclaration", "scope": 2797, "src": "910:17:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 2775, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "910:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2776, "length": null, "nodeType": "ArrayTypeName", "src": "910:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2780, "name": "locking", "nodeType": "VariableDeclaration", "scope": 2797, "src": "968:17:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 2778, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "968:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2779, "length": null, "nodeType": "ArrayTypeName", "src": "968:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2783, "name": "canceled", "nodeType": "VariableDeclaration", "scope": 2797, "src": "1055:18:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 2781, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1055:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2782, "length": null, "nodeType": "ArrayTypeName", "src": "1055:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2786, "name": "completed", "nodeType": "VariableDeclaration", "scope": 2797, "src": "1104:19:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 2784, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1104:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2785, "length": null, "nodeType": "ArrayTypeName", "src": "1104:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2791, "name": "submitterCmds", "nodeType": "VariableDeclaration", "scope": 2797, "src": "1177:43:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(address => uint256[])" }, "typeName": { "id": 2790, "keyType": { "id": 2787, "name": "address", "nodeType": "ElementaryTypeName", "src": "1185:7:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1177:29:15", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(address => uint256[])" }, "valueType": { "baseType": { "id": 2788, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1196:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2789, "length": null, "nodeType": "ArrayTypeName", "src": "1196:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2796, "name": "agentCmds", "nodeType": "VariableDeclaration", "scope": 2797, "src": "1274:39:15", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(address => uint256[])" }, "typeName": { "id": 2795, "keyType": { "id": 2792, "name": "address", "nodeType": "ElementaryTypeName", "src": "1282:7:15", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1274:29:15", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(address => uint256[])" }, "valueType": { "baseType": { "id": 2793, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1293:7:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2794, "length": null, "nodeType": "ArrayTypeName", "src": "1293:9:15", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "value": null, "visibility": "internal" } ], "name": "commandMap", "nodeType": "StructDefinition", "scope": 3760, "src": "810:508:15", "visibility": "public" }, { "body": { "id": 2826, "nodeType": "Block", "src": "1358:184:15", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 2821, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 2814, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2807, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2802, "name": "_verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2799, "src": "1379:6:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2804, "name": "Verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2756, "src": "1397:5:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_Verbs_$2756_$", "typeString": "type(enum CommandList.Verbs)" } }, "id": 2805, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "TRANSFER", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1397:14:15", "typeDescriptions": { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } ], "id": 2803, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1389:7:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": "uint256" }, "id": 2806, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1389:23:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1379:33:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2813, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2808, "name": "_verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2799, "src": "1424:6:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2810, "name": "Verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2756, "src": "1442:5:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_Verbs_$2756_$", "typeString": "type(enum CommandList.Verbs)" } }, "id": 2811, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "EXCHANGE", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1442:14:15", "typeDescriptions": { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } ], "id": 2809, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1434:7:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": "uint256" }, "id": 2812, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1434:23:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1424:33:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "1379:78:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2820, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2815, "name": "_verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2799, "src": "1469:6:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2817, "name": "Verbs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2756, "src": "1487:5:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_Verbs_$2756_$", "typeString": "type(enum CommandList.Verbs)" } }, "id": 2818, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "EXECUTE", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1487:13:15", "typeDescriptions": { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_enum$_Verbs_$2756", "typeString": "enum CommandList.Verbs" } ], "id": 2816, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1479:7:15", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": "uint256" }, "id": 2819, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1479:22:15", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1469:32:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "1379:122:15", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "696e76616c6964207665726273", "id": 2822, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1509:15:15", "subdenomination": null,