jcc-solidity-utils
Version:
jcc solidity utils
1,142 lines (1,141 loc) • 277 kB
JSON
{
"contractName": "UintList",
"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/UintList.sol\":\"UintList\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/UintList.sol\":{\"keccak256\":\"0x0d3f928a6507c7b40de15cc19a3200b259082dd0a950fb60132649295270dc9e\",\"urls\":[\"bzzr://7f51ba64c60a21c86c06af8c426036ab858b4acb8bba85813981c1f685ee6fdb\"]},\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x239546071316c89d3bbc9e61b2ccae270a4493bbd2f7c240052f533807d50ab7\",\"urls\":[\"bzzr://267bf48e0a30f7b671aa3c98a6b27ffe7bc64efd6533f49e54188b520baa94c5\"]}},\"version\":1}",
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820c707c58e2c152cce9462ee8d2287f08abf8b465bc86560003809916666f408fd0029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820c707c58e2c152cce9462ee8d2287f08abf8b465bc86560003809916666f408fd0029",
"sourceMap": "139:2025:19:-;;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": "139:2025:19:-;;;;;;;;",
"source": "pragma solidity >=0.4.24;\n\nimport \"../math/SafeMath.sol\";\n\n/**\n * @dev 无符号整型数列表共通,只能顺序增加且不重复\n */\nlibrary UintList {\n using SafeMath for uint256;\n\n struct uintMap {\n mapping(uint256 => uint256) mapList;\n uint256[] list;\n }\n\n function exist(uintMap storage self, uint256 _num)\n internal\n view\n returns (bool)\n {\n if (self.list.length == 0) return false;\n return (self.list[self.mapList[_num]] == _num);\n }\n\n /**\n @dev 增加新的数据,重复的数据返回失败\n */\n function insert(uintMap storage self, uint256 _num) internal returns (bool) {\n if (exist(self, _num)) {\n return false;\n }\n\n self.mapList[_num] = self.list.push(_num).sub(1);\n\n return true;\n }\n\n /**\n @dev 删除无符号整型数,相应的下标索引数组自动缩减\n */\n function remove(uintMap storage self, uint256 _num) internal returns (bool) {\n if (!exist(self, _num)) {\n return false;\n }\n\n uint256 row2Del = self.mapList[_num];\n uint256 keyToMove = self.list[self.list.length.sub(1)];\n self.list[row2Del] = keyToMove;\n self.mapList[keyToMove] = row2Del;\n self.list.length = self.list.length.sub(1);\n\n return true;\n }\n\n function count(uintMap storage self) internal view returns (uint256) {\n return self.list.length;\n }\n\n function get(uintMap storage self, uint256 index)\n internal\n view\n returns (uint256)\n {\n require(index < self.list.length, \"index must small than current count\");\n return self.list[index];\n }\n\n /**\n @dev 从指定位置返回多条(不多于count)记录,如果不足则空缺,为避免该情况,应该先获取数据量后再决定参数\n */\n function getList(\n uintMap storage self,\n uint256 from,\n uint256 _count\n ) internal view returns (uint256[] memory) {\n uint256 _idx = 0;\n require(_count > 0, \"return number must bigger than 0\");\n uint256[] memory res = new uint256[](_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/UintList.sol",
"ast": {
"absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/UintList.sol",
"exportedSymbols": {
"UintList": [
5538
]
},
"id": 5539,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 5284,
"literals": [
"solidity",
">=",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:25:19"
},
{
"absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol",
"file": "../math/SafeMath.sol",
"id": 5285,
"nodeType": "ImportDirective",
"scope": 5539,
"sourceUnit": 5658,
"src": "27:30:19",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@dev 无符号整型数列表共通,只能顺序增加且不重复",
"fullyImplemented": true,
"id": 5538,
"linearizedBaseContracts": [
5538
],
"name": "UintList",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 5288,
"libraryName": {
"contractScope": null,
"id": 5286,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5657,
"src": "166:8:19",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$5657",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "160:27:19",
"typeName": {
"id": 5287,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "179:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"canonicalName": "UintList.uintMap",
"id": 5296,
"members": [
{
"constant": false,
"id": 5292,
"name": "mapList",
"nodeType": "VariableDeclaration",
"scope": 5296,
"src": "212:35:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$",
"typeString": "mapping(uint256 => uint256)"
},
"typeName": {
"id": 5291,
"keyType": {
"id": 5289,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "220:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Mapping",
"src": "212:27:19",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$",
"typeString": "mapping(uint256 => uint256)"
},
"valueType": {
"id": 5290,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "231:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5295,
"name": "list",
"nodeType": "VariableDeclaration",
"scope": 5296,
"src": "253:14:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
},
"typeName": {
"baseType": {
"id": 5293,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "253:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 5294,
"length": null,
"nodeType": "ArrayTypeName",
"src": "253:9:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr",
"typeString": "uint256[]"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "uintMap",
"nodeType": "StructDefinition",
"scope": 5538,
"src": "191:81:19",
"visibility": "public"
},
{
"body": {
"id": 5324,
"nodeType": "Block",
"src": "370:102:19",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5309,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5305,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5298,
"src": "380:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
"id": 5306,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 5295,
"src": "380:9:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage",
"typeString": "uint256[] storage ref"
}
},
"id": 5307,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "380:16:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 5308,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "400:1:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "380:21:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 5312,
"nodeType": "IfStatement",
"src": "376:39:19",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 5310,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "410:5:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 5304,
"id": 5311,
"nodeType": "Return",
"src": "403:12:19"
}
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 5321,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5313,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5298,
"src": "429:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
"id": 5314,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 5295,
"src": "429:9:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage",
"typeString": "uint256[] storage ref"
}
},
"id": 5319,
"indexExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5315,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5298,
"src": "439:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
"id": 5316,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "mapList",
"nodeType": "MemberAccess",
"referencedDeclaration": 5292,
"src": "439:12:19",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$",
"typeString": "mapping(uint256 => uint256)"
}
},
"id": 5318,
"indexExpression": {
"argumentTypes": null,
"id": 5317,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5300,
"src": "452:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "439:18:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "429:29:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 5320,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5300,
"src": "462:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "429:37:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 5322,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "428:39:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 5304,
"id": 5323,
"nodeType": "Return",
"src": "421:46:19"
}
]
},
"documentation": null,
"id": 5325,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "exist",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5301,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5298,
"name": "self",
"nodeType": "VariableDeclaration",
"scope": 5325,
"src": "291:20:19",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap"
},
"typeName": {
"contractScope": null,
"id": 5297,
"name": "uintMap",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5296,
"src": "291:7:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5300,
"name": "_num",
"nodeType": "VariableDeclaration",
"scope": 5325,
"src": "313:12:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5299,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "313:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "290:36:19"
},
"payable": false,
"returnParameters": {
"id": 5304,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5303,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5325,
"src": "362:4:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5302,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "362:4:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "361:6:19"
},
"scope": 5538,
"src": "276:196:19",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 5359,
"nodeType": "Block",
"src": "620:133:19",
"statements": [
{
"condition": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 5335,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5327,
"src": "636:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
{
"argumentTypes": null,
"id": 5336,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5329,
"src": "642:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 5334,
"name": "exist",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5325,
"src": "630:5:19",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_uintMap_$5296_storage_ptr_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (struct UintList.uintMap storage pointer,uint256) view returns (bool)"
}
},
"id": 5337,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "630:17:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 5341,
"nodeType": "IfStatement",
"src": "626:50:19",
"trueBody": {
"id": 5340,
"nodeType": "Block",
"src": "649:27:19",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 5338,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "664:5:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 5333,
"id": 5339,
"nodeType": "Return",
"src": "657:12:19"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"id": 5355,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5342,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5327,
"src": "682:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
"id": 5345,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "mapList",
"nodeType": "MemberAccess",
"referencedDeclaration": 5292,
"src": "682:12:19",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$",
"typeString": "mapping(uint256 => uint256)"
}
},
"id": 5346,
"indexExpression": {
"argumentTypes": null,
"id": 5344,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5329,
"src": "695:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "682:18:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "31",
"id": 5353,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "728:1:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 5350,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5329,
"src": "718:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 5347,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5327,
"src": "703:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
"id": 5348,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 5295,
"src": "703:9:19",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_uint256_$dyn_storage",
"typeString": "uint256[] storage ref"
}
},
"id": 5349,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "703:14:19",
"typeDescriptions": {
"typeIdentifier": "t_function_arraypush_nonpayable$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256) returns (uint256)"
}
},
"id": 5351,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "703:20:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 5352,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 5611,
"src": "703:24:19",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 5354,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "703:27:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "682:48:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 5356,
"nodeType": "ExpressionStatement",
"src": "682:48:19"
},
{
"expression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 5357,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "744:4:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 5333,
"id": 5358,
"nodeType": "Return",
"src": "737:11:19"
}
]
},
"documentation": "@dev 增加新的数据,重复的数据返回失败",
"id": 5360,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "insert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 5330,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5327,
"name": "self",
"nodeType": "VariableDeclaration",
"scope": 5360,
"src": "560:20:19",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap"
},
"typeName": {
"contractScope": null,
"id": 5326,
"name": "uintMap",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5296,
"src": "560:7:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5329,
"name": "_num",
"nodeType": "VariableDeclaration",
"scope": 5360,
"src": "582:12:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5328,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "582:7:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "559:36:19"
},
"payable": false,
"returnParameters": {
"id": 5333,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5332,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 5360,
"src": "614:4:19",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 5331,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "614:4:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "613:6:19"
},
"scope": 5538,
"src": "544:209:19",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 5428,
"nodeType": "Block",
"src": "919:305:19",
"statements": [
{
"condition": {
"argumentTypes": null,
"id": 5373,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "!",
"prefix": true,
"src": "929:18:19",
"subExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 5370,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5362,
"src": "936:4:19",
"typeDescriptions": {
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
}
},
{
"argumentTypes": null,
"id": 5371,
"name": "_num",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5364,
"src": "942:4:19",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_uintMap_$5296_storage_ptr",
"typeString": "struct UintList.uintMap storage pointer"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 5369,
"name": "exist",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5325,
"src": "930:5:19",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_uintMap_$5296_storage_ptr_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (struct UintList.uintMap storage pointer,uint256) view returns (bool)"
}
},
"id": 5372,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "930:17:19",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 5377,
"nodeType": "IfStatement",
"src": "925:51:19",
"trueBody": {
"id": 5376,
"nodeType": "Block",
"src": "949:27:19",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 5374,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "964:5:19",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 5368,
"id": 5375,
"nodeType": "Return",
"src": "957:12:19"
}
]
}
},
{