UNPKG

jcc-solidity-utils

Version:
941 lines (940 loc) 1.08 MB
{ "contractName": "TokenList", "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/TokenList.sol\":\"TokenList\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/TokenList.sol\":{\"keccak256\":\"0x4a2749c11f41cce84af3cd102517593a068b8a8df3f9e74267432e5de290b362\",\"urls\":[\"bzzr://3a8b602bb2ec0f0542c73e335cda648fb5b1f9f773e92dd53f06bbbfd8d52b92\"]},\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x239546071316c89d3bbc9e61b2ccae270a4493bbd2f7c240052f533807d50ab7\",\"urls\":[\"bzzr://267bf48e0a30f7b671aa3c98a6b27ffe7bc64efd6533f49e54188b520baa94c5\"]}},\"version\":1}", "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820733c412618ce31979a32b796d5f6f8bd22881866bc771d0d3d9b40c8729691890029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820733c412618ce31979a32b796d5f6f8bd22881866bc771d0d3d9b40c8729691890029", "sourceMap": "94:8291:17:-;;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": "94:8291:17:-;;;;;;;;", "source": "pragma solidity >=0.4.24;\n\nimport \"../math/SafeMath.sol\";\n\n/**\n * @dev 通证列表处理\n */\nlibrary TokenList {\n using SafeMath for uint256;\n\n // 通证定义\n struct element {\n // 索引\n uint256 idx;\n // 不重复的编号\n uint256 id;\n // 定义来自JCCChainList\n uint256 chainId;\n // origin token chainid + issuer hash\n // 如果是原生通证为0,如果是映射通证,则填写原生通证的 chainid+issuer hash\n bytes32 origin;\n /**\n 所有链的原生通证默认标记不填写,除非另有规定(例如:EOS本身是一个合约)\n issuer格式: 合约地址/合约地址\n ETH类的通证通过合约地址区分,原生通证表示为 \"/\"\n SWTC类的通证定义由\"issuer/名称\"来表示地址,issuer为空表示原生通证\n MOAC应用链通过 \"主链via地址/应用链合约\"来表示issuer\n 在同一条链上,不许重复\n */\n string issuer;\n // 简称,同一条链不重复\n string symbol;\n }\n\n struct tokenMap {\n // token id => index\n mapping(uint256 => uint256) mapId;\n // chainId+symbol hash => index\n mapping(bytes32 => uint256) mapSymbol;\n // chainId+issuer hash => index\n mapping(bytes32 => uint256) mapIssuer;\n // origin token mapping chainId+issuer hash => token id array\n mapping(bytes32 => uint256[]) mapToken;\n // data array\n element[] list;\n }\n\n function existId(tokenMap storage self, uint256 _id)\n internal\n view\n returns (bool)\n {\n if (self.list.length == 0) return false;\n return (self.list[self.mapId[_id]].id == _id &&\n getStringLen(self.list[self.mapId[_id]].symbol) > 0);\n }\n\n function existSymbol(tokenMap storage self, bytes32 _symbolHash)\n internal\n view\n returns (bool)\n {\n if (self.list.length == 0) return false;\n element storage e = self.list[self.mapSymbol[_symbolHash]];\n return (getHash(e.chainId, e.symbol) == _symbolHash);\n }\n\n function existIssuer(tokenMap storage self, bytes32 _issuerHash)\n internal\n view\n returns (bool)\n {\n if (self.list.length == 0) return false;\n element storage e = self.list[self.mapIssuer[_issuerHash]];\n return (getHash(e.chainId, e.issuer) == _issuerHash);\n }\n\n // 检查映射数组有无重复\n function existToken(\n tokenMap storage self,\n bytes32 _origin,\n uint256 _id\n ) internal view returns (bool, uint256) {\n if (self.list.length == 0) return (false, 0);\n\n uint256[] storage _arr = self.mapToken[_origin];\n\n for (uint256 i = 0; i < _arr.length; i++) {\n if (_arr[i] == _id) {\n return (true, i);\n }\n }\n\n return (false, 0);\n }\n\n // 增加映射通证数组成员\n function insertToken(\n tokenMap storage self,\n bytes32 _issuerHash,\n uint256 _idx\n ) internal returns (bool) {\n bool _exist;\n uint256 _originIdx;\n element storage e = self.list[_idx];\n bytes32 _origin = e.origin == 0x0 ? _issuerHash : e.origin;\n\n (_exist, _originIdx) = existToken(self, _origin, e.id);\n if (_exist) {\n return false;\n }\n\n self.mapToken[_origin].push(e.id);\n\n return true;\n }\n\n // 删除映射通证数组成员\n function removeToken(tokenMap storage self, uint256 _idx)\n internal\n returns (bool)\n {\n element storage e = self.list[_idx];\n bool isOrigin = e.origin == 0x0;\n bytes32 _issuerHash = isOrigin ? getHash(e.chainId, e.issuer) : e.origin;\n\n bool _exist;\n uint256 row2Del;\n\n (_exist, row2Del) = existToken(self, _issuerHash, e.id);\n if (!_exist) {\n return false;\n }\n\n uint256[] storage _arr = self.mapToken[_issuerHash];\n // 如果是原生通证必须映射通证先删除\n if (isOrigin && _arr.length > 1) {\n return false;\n }\n\n uint256 keyToMove = _arr[_arr.length.sub(1)];\n\n _arr[row2Del] = keyToMove;\n _arr.length = _arr.length.sub(1);\n\n return true;\n }\n\n function getStringLen(string _str) internal pure returns (uint256) {\n bytes memory b = bytes(_str);\n require(b.length <= 1024, \"too large string make overflow risk\");\n return b.length;\n }\n\n function getHash(uint256 _chainId, string _name)\n internal\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(_chainId, _name));\n }\n\n /**\n @dev 增加新定时定义,重复的ID返回失败\n */\n function insert(\n tokenMap storage self,\n uint256 _id,\n uint256 _chainId,\n bytes32 _origin,\n string _issuer,\n string _symbol\n ) internal returns (bool) {\n if (existId(self, _id)) {\n return false;\n }\n\n bytes32 _symbolHash = getHash(_chainId, _symbol);\n bytes32 _issuerHash = getHash(_chainId, _issuer);\n\n if (existSymbol(self, _symbolHash) || existIssuer(self, _issuerHash)) {\n return false;\n }\n\n //映射的原始通证没有登记\n if (_origin != 0x0 && !existIssuer(self, _origin)) {\n return false;\n }\n\n element memory e =\n element({\n idx: self.list.length,\n id: _id,\n chainId: _chainId,\n origin: _origin,\n issuer: _issuer,\n symbol: _symbol\n });\n\n self.list.push(e);\n self.mapId[_id] = e.idx;\n self.mapSymbol[_symbolHash] = e.idx;\n self.mapIssuer[_issuerHash] = e.idx;\n\n // 处理映射通证列表 原生通证排第一个\n if (!insertToken(self, _issuerHash, e.idx)) {\n return false;\n }\n\n return true;\n }\n\n function remove(tokenMap storage self, uint256 _id) internal returns (bool) {\n if (!existId(self, _id)) {\n return false;\n }\n\n uint256 row2Del = self.mapId[_id];\n\n element storage keyToMove = self.list[self.list.length.sub(1)];\n\n if (!removeToken(self, row2Del)) {\n return false;\n }\n\n self.list[row2Del] = keyToMove;\n self.mapId[keyToMove.id] = row2Del;\n bytes32 _symbolHash = getHash(keyToMove.chainId, keyToMove.symbol);\n bytes32 _issuerHash = getHash(keyToMove.chainId, keyToMove.issuer);\n self.mapSymbol[_symbolHash] = row2Del;\n self.mapIssuer[_issuerHash] = row2Del;\n self.list.length = self.list.length.sub(1);\n\n return true;\n }\n\n function count(tokenMap storage self) internal view returns (uint256) {\n return self.list.length;\n }\n\n function get(tokenMap storage self, uint256 index)\n internal\n view\n returns (TokenList.element)\n {\n require(index < self.list.length, \"index must small than current count\");\n return self.list[index];\n }\n\n function getById(tokenMap storage self, uint256 _id)\n internal\n view\n returns (TokenList.element)\n {\n require(existId(self, _id), \"token data must be exist\");\n return self.list[self.mapId[_id]];\n }\n\n function getBySymbol(\n tokenMap storage self,\n uint256 _chainId,\n string _symbol\n ) internal view returns (TokenList.element) {\n bytes32 _symbolHash = getHash(_chainId, _symbol);\n require(existSymbol(self, _symbolHash), \"symbol data must be exist\");\n return self.list[self.mapSymbol[_symbolHash]];\n }\n\n function getByIssuer(\n tokenMap storage self,\n uint256 _chainId,\n string _issuer\n ) internal view returns (TokenList.element) {\n bytes32 _issuerHash = getHash(_chainId, _issuer);\n require(existIssuer(self, _issuerHash), \"issuer data must be exist\");\n return self.list[self.mapIssuer[_issuerHash]];\n }\n\n /**\n 获取通证跨链映射表\n */\n function getCrossList(tokenMap storage self, bytes32 _origin)\n internal\n view\n returns (TokenList.element[])\n {\n require(existIssuer(self, _origin), \"origin data must be exist\");\n\n uint256[] storage _arr = self.mapToken[_origin];\n require(_arr.length > 0, \"origin list have data\");\n\n TokenList.element[] memory res = new TokenList.element[](_arr.length);\n\n for (uint256 i = 0; i < _arr.length; i++) {\n res[i] = self.list[self.mapId[_arr[i]]];\n }\n\n return res;\n }\n\n /**\n @dev 从指定位置返回多条(不多于count)地址记录,如果不足则空缺\n */\n function getList(\n tokenMap storage self,\n uint256 from,\n uint256 _count\n ) internal view returns (TokenList.element[] memory) {\n uint256 _idx = 0;\n require(_count > 0, \"return number must bigger than 0\");\n TokenList.element[] memory res = new TokenList.element[](_count);\n\n for (uint256 i = from; i < self.list.length; i++) {\n if (_idx == _count) {\n break;\n }\n\n res[_idx] = self.list[i];\n _idx = _idx.add(1);\n }\n\n return res;\n }\n}\n", "sourcePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/TokenList.sol", "ast": { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/TokenList.sol", "exportedSymbols": { "TokenList": [ 4973 ] }, "id": 4974, "nodeType": "SourceUnit", "nodes": [ { "id": 4018, "literals": [ "solidity", ">=", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:25:17" }, { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol", "file": "../math/SafeMath.sol", "id": 4019, "nodeType": "ImportDirective", "scope": 4974, "sourceUnit": 5658, "src": "27:30:17", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev 通证列表处理", "fullyImplemented": true, "id": 4973, "linearizedBaseContracts": [ 4973 ], "name": "TokenList", "nodeType": "ContractDefinition", "nodes": [ { "id": 4022, "libraryName": { "contractScope": null, "id": 4020, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5657, "src": "122:8:17", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5657", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "116:27:17", "typeName": { "id": 4021, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "135:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "canonicalName": "TokenList.element", "id": 4035, "members": [ { "constant": false, "id": 4024, "name": "idx", "nodeType": "VariableDeclaration", "scope": 4035, "src": "200:11:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4023, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "200:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4026, "name": "id", "nodeType": "VariableDeclaration", "scope": 4035, "src": "243:10:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4025, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "243:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4028, "name": "chainId", "nodeType": "VariableDeclaration", "scope": 4035, "src": "291:15:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4027, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "291:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4030, "name": "origin", "nodeType": "VariableDeclaration", "scope": 4035, "src": "456:14:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 4029, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "456:7:17", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4032, "name": "issuer", "nodeType": "VariableDeclaration", "scope": 4035, "src": "928:13:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" }, "typeName": { "id": 4031, "name": "string", "nodeType": "ElementaryTypeName", "src": "928:6:17", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4034, "name": "symbol", "nodeType": "VariableDeclaration", "scope": 4035, "src": "983:13:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" }, "typeName": { "id": 4033, "name": "string", "nodeType": "ElementaryTypeName", "src": "983:6:17", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "name": "element", "nodeType": "StructDefinition", "scope": 4973, "src": "165:836:17", "visibility": "public" }, { "canonicalName": "TokenList.tokenMap", "id": 4056, "members": [ { "constant": false, "id": 4039, "name": "mapId", "nodeType": "VariableDeclaration", "scope": 4056, "src": "1052:33:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "typeName": { "id": 4038, "keyType": { "id": 4036, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1060:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "1052:27:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "valueType": { "id": 4037, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1071:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4043, "name": "mapSymbol", "nodeType": "VariableDeclaration", "scope": 4056, "src": "1127:37:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "typeName": { "id": 4042, "keyType": { "id": 4040, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1135:7:17", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "1127:27:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "valueType": { "id": 4041, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1146:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4047, "name": "mapIssuer", "nodeType": "VariableDeclaration", "scope": 4056, "src": "1206:37:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "typeName": { "id": 4046, "keyType": { "id": 4044, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1214:7:17", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "1206:27:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "valueType": { "id": 4045, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1225:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4052, "name": "mapToken", "nodeType": "VariableDeclaration", "scope": 4056, "src": "1315:38:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(bytes32 => uint256[])" }, "typeName": { "id": 4051, "keyType": { "id": 4048, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1323:7:17", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "1315:29:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_uint256_$dyn_storage_$", "typeString": "mapping(bytes32 => uint256[])" }, "valueType": { "baseType": { "id": 4049, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1334:7:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 4050, "length": null, "nodeType": "ArrayTypeName", "src": "1334:9:17", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4055, "name": "list", "nodeType": "VariableDeclaration", "scope": 4056, "src": "1377:14:17", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$4035_storage_$dyn_storage_ptr", "typeString": "struct TokenList.element[]" }, "typeName": { "baseType": { "contractScope": null, "id": 4053, "name": "element", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4035, "src": "1377:7:17", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$4035_storage_ptr", "typeString": "struct TokenList.element" } }, "id": 4054, "length": null, "nodeType": "ArrayTypeName", "src": "1377:9:17", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$4035_storage_$dyn_storage_ptr", "typeString": "struct TokenList.element[]" } }, "value": null, "visibility": "internal" } ], "name": "tokenMap", "nodeType": "StructDefinition", "scope": 4973, "src": "1005:391:17", "visibility": "public" }, { "body": { "id": 4098, "nodeType": "Block", "src": "1496:162:17", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4069, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4065, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4058, "src": "1506:4:17", "typeDescriptions": { "typeIdentifier": "t_struct$_tokenMap_$4056_storage_ptr", "typeString": "struct TokenList.tokenMap storage pointer" } }, "id": 4066, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 4055, "src": "1506:9:17", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$4035_storage_$dyn_storage", "typeString": "struct TokenList.element storage ref[] storage ref" } }, "id": 4067, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1506:16:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 4068, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1526:1:17", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1506:21:17", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 4072, "nodeType": "IfStatement", "src": "1502:39:17", "trueBody": { "expression": { "argumentTypes": null, "hexValue": "66616c7365", "id": 4070, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1536:5:17", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "functionReturnParameters": 4064, "id": 4071, "nodeType": "Return", "src": "1529:12:17" } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 4095, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4082, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4073, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4058, "src": "1555:4:17", "typeDescriptions": { "typeIdentifier": "t_struct$_tokenMap_$4056_storage_ptr", "typeString": "struct TokenList.tokenMap storage pointer" } }, "id": 4074, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 4055, "src": "1555:9:17", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$4035_storage_$dyn_storage", "typeString": "struct TokenList.element storage ref[] storage ref" } }, "id": 4079, "indexExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4075, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4058, "src": "1565:4:17", "typeDescriptions": { "typeIdentifier": "t_struct$_tokenMap_$4056_storage_ptr", "typeString": "struct TokenList.tokenMap storage pointer" } }, "id": 4076, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "mapId", "nodeType": "MemberAccess", "referencedDeclaration": 4039, "src": "1565:10:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" } }, "id": 4078, "indexExpression": { "argumentTypes": null, "id": 4077, "name": "_id", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4060, "src": "1576:3:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1565:15:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1555:26:17", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$4035_storage", "typeString": "struct TokenList.element storage ref" } }, "id": 4080, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "id", "nodeType": "MemberAccess", "referencedDeclaration": 4026, "src": "1555:29:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 4081, "name": "_id", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4060, "src": "1588:3:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1555:36:17", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4094, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4084, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4058, "src": "1614:4:17", "typeDescriptions": { "typeIdentifier": "t_struct$_tokenMap_$4056_storage_ptr", "typeString": "struct TokenList.tokenMap storage pointer" } }, "id": 4085, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 4055, "src": "1614:9:17", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$4035_storage_$dyn_storage", "typeString": "struct TokenList.element storage ref[] storage ref" } }, "id": 4090, "indexExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4086, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4058, "src": "1624:4:17", "typeDescriptions": { "typeIdentifier": "t_struct$_tokenMap_$4056_storage_ptr", "typeString": "struct TokenList.tokenMap storage pointer" } }, "id": 4087, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "mapId", "nodeType": "MemberAccess", "referencedDeclaration": 4039, "src": "1624:10:17", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" } }, "id": 4089, "indexExpression": { "argumentTypes": null, "id": 4088, "name": "_id", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4060, "src": "1635:3:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1624:15:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1614:26:17", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$4035_storage", "typeString": "struct TokenList.element storage ref" } }, "id": 4091, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "symbol", "nodeType": "MemberAccess", "referencedDeclaration": 4034, "src": "1614:33:17", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } ], "id": 4083, "name": "getStringLen", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4432, "src": "1601:12:17", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$returns$_t_uint256_$", "typeString": "function (string memory) pure returns (uint256)" } }, "id": 4092, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1601:47:17", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 4093, "isConstant": false, "isLValue": false,