jcc-solidity-utils
Version:
jcc solidity utils
1,134 lines (1,133 loc) • 277 kB
JSON
{
"contractName": "AddressList",
"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/AddressList.sol\":\"AddressList\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/AddressList.sol\":{\"keccak256\":\"0xbc8bf46cc8846bafbd17f6926882a3bc061c4c493f07eea3b83fca83bfb643eb\",\"urls\":[\"bzzr://9de428f8afb50d490792706bbeff0ff3792cd0b116671bd828063629a32fa94f\"]},\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x239546071316c89d3bbc9e61b2ccae270a4493bbd2f7c240052f533807d50ab7\",\"urls\":[\"bzzr://267bf48e0a30f7b671aa3c98a6b27ffe7bc64efd6533f49e54188b520baa94c5\"]}},\"version\":1}",
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820f51cd32271340f7e297ef4d751ca903557d3756ba2e1592be6295cd943ff04e50029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820f51cd32271340f7e297ef4d751ca903557d3756ba2e1592be6295cd943ff04e50029",
"sourceMap": "160:2004:11:-;;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": "160:2004:11:-;;;;;;;;",
"source": "pragma solidity >=0.4.24;\n\nimport \"../math/SafeMath.sol\";\n\n/**\n * @dev 地址列表共通,处理地址列表,不重复,可统计,按照下标获取\n */\nlibrary AddressList {\n using SafeMath for uint256;\n\n struct addressMap {\n mapping(address => uint256) mapList;\n address[] list;\n }\n\n function exist(addressMap storage self, address _addr)\n internal\n view\n returns (bool)\n {\n if (self.list.length == 0) return false;\n return (self.list[self.mapList[_addr]] == _addr);\n }\n\n /**\n @dev 增加新地址,重复的地址返回失败\n */\n function insert(addressMap storage self, address _addr)\n internal\n returns (bool)\n {\n if (exist(self, _addr)) {\n return false;\n }\n\n self.mapList[_addr] = self.list.push(_addr).sub(1);\n\n return true;\n }\n\n /**\n @dev 删除地址,相应的下标索引数组自动缩减\n */\n function remove(addressMap storage self, address _addr)\n internal\n returns (bool)\n {\n if (!exist(self, _addr)) {\n return false;\n }\n\n uint256 row2Del = self.mapList[_addr];\n address 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(addressMap storage self) internal view returns (uint256) {\n return self.list.length;\n }\n\n function get(addressMap storage self, uint256 index)\n internal\n view\n returns (address)\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 addressMap storage self,\n uint256 from,\n uint256 _count\n ) internal view returns (address[] memory) {\n uint256 _idx = 0;\n require(_count > 0, \"return number must bigger than 0\");\n address[] memory res = new address[](_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/AddressList.sol",
"ast": {
"absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/AddressList.sol",
"exportedSymbols": {
"AddressList": [
1563
]
},
"id": 1564,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1309,
"literals": [
"solidity",
">=",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:25:11"
},
{
"absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol",
"file": "../math/SafeMath.sol",
"id": 1310,
"nodeType": "ImportDirective",
"scope": 1564,
"sourceUnit": 5658,
"src": "27:30:11",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@dev 地址列表共通,处理地址列表,不重复,可统计,按照下标获取",
"fullyImplemented": true,
"id": 1563,
"linearizedBaseContracts": [
1563
],
"name": "AddressList",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 1313,
"libraryName": {
"contractScope": null,
"id": 1311,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 5657,
"src": "190:8:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$5657",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "184:27:11",
"typeName": {
"id": 1312,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "203:7:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"canonicalName": "AddressList.addressMap",
"id": 1321,
"members": [
{
"constant": false,
"id": 1317,
"name": "mapList",
"nodeType": "VariableDeclaration",
"scope": 1321,
"src": "239:35:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 1316,
"keyType": {
"id": 1314,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "247:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "239:27:11",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 1315,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "258:7:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1320,
"name": "list",
"nodeType": "VariableDeclaration",
"scope": 1321,
"src": "280:14:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage_ptr",
"typeString": "address[]"
},
"typeName": {
"baseType": {
"id": 1318,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "280:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 1319,
"length": null,
"nodeType": "ArrayTypeName",
"src": "280:9:11",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage_ptr",
"typeString": "address[]"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "addressMap",
"nodeType": "StructDefinition",
"scope": 1563,
"src": "215:84:11",
"visibility": "public"
},
{
"body": {
"id": 1349,
"nodeType": "Block",
"src": "401:104:11",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1334,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1330,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1323,
"src": "411:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
"id": 1331,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 1320,
"src": "411:9:11",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 1332,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "411:16:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 1333,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "431:1:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "411:21:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 1337,
"nodeType": "IfStatement",
"src": "407:39:11",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 1335,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "441:5:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 1329,
"id": 1336,
"nodeType": "Return",
"src": "434:12:11"
}
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 1346,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1338,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1323,
"src": "460:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
"id": 1339,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 1320,
"src": "460:9:11",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 1344,
"indexExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1340,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1323,
"src": "470:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
"id": 1341,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "mapList",
"nodeType": "MemberAccess",
"referencedDeclaration": 1317,
"src": "470:12:11",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 1343,
"indexExpression": {
"argumentTypes": null,
"id": 1342,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1325,
"src": "483:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "470:19:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "460:30:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 1345,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1325,
"src": "494:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "460:39:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"id": 1347,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "459:41:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 1329,
"id": 1348,
"nodeType": "Return",
"src": "452:48:11"
}
]
},
"documentation": null,
"id": 1350,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "exist",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1326,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1323,
"name": "self",
"nodeType": "VariableDeclaration",
"scope": 1350,
"src": "318:23:11",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap"
},
"typeName": {
"contractScope": null,
"id": 1322,
"name": "addressMap",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1321,
"src": "318:10:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1325,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 1350,
"src": "343:13:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1324,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "343:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "317:40:11"
},
"payable": false,
"returnParameters": {
"id": 1329,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1328,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1350,
"src": "393:4:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1327,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "393:4:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "392:6:11"
},
"scope": 1563,
"src": "303:202:11",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1384,
"nodeType": "Block",
"src": "664:136:11",
"statements": [
{
"condition": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1360,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1352,
"src": "680:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
{
"argumentTypes": null,
"id": 1361,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1354,
"src": "686:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 1359,
"name": "exist",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1350,
"src": "674:5:11",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_addressMap_$1321_storage_ptr_$_t_address_$returns$_t_bool_$",
"typeString": "function (struct AddressList.addressMap storage pointer,address) view returns (bool)"
}
},
"id": 1362,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "674:18:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 1366,
"nodeType": "IfStatement",
"src": "670:51:11",
"trueBody": {
"id": 1365,
"nodeType": "Block",
"src": "694:27:11",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 1363,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "709:5:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 1358,
"id": 1364,
"nodeType": "Return",
"src": "702:12:11"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"id": 1380,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1367,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1352,
"src": "727:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
"id": 1370,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "mapList",
"nodeType": "MemberAccess",
"referencedDeclaration": 1317,
"src": "727:12:11",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 1371,
"indexExpression": {
"argumentTypes": null,
"id": 1369,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1354,
"src": "740:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "727:19:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "31",
"id": 1378,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "775:1:11",
"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": 1375,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1354,
"src": "764:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1372,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1352,
"src": "749:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
"id": 1373,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "list",
"nodeType": "MemberAccess",
"referencedDeclaration": 1320,
"src": "749:9:11",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_address_$dyn_storage",
"typeString": "address[] storage ref"
}
},
"id": 1374,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "push",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "749:14:11",
"typeDescriptions": {
"typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) returns (uint256)"
}
},
"id": 1376,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "749:21:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1377,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 5611,
"src": "749:25:11",
"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": 1379,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "749:28:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "727:50:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1381,
"nodeType": "ExpressionStatement",
"src": "727:50:11"
},
{
"expression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 1382,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "791:4:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 1358,
"id": 1383,
"nodeType": "Return",
"src": "784:11:11"
}
]
},
"documentation": "@dev 增加新地址,重复的地址返回失败",
"id": 1385,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "insert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1355,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1352,
"name": "self",
"nodeType": "VariableDeclaration",
"scope": 1385,
"src": "590:23:11",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap"
},
"typeName": {
"contractScope": null,
"id": 1351,
"name": "addressMap",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1321,
"src": "590:10:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1354,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 1385,
"src": "615:13:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1353,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "615:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "589:40:11"
},
"payable": false,
"returnParameters": {
"id": 1358,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1357,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1385,
"src": "656:4:11",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1356,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "656:4:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "655:6:11"
},
"scope": 1563,
"src": "574:226:11",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1453,
"nodeType": "Block",
"src": "968:307:11",
"statements": [
{
"condition": {
"argumentTypes": null,
"id": 1398,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "!",
"prefix": true,
"src": "978:19:11",
"subExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1395,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1387,
"src": "985:4:11",
"typeDescriptions": {
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
}
},
{
"argumentTypes": null,
"id": 1396,
"name": "_addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1389,
"src": "991:5:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_addressMap_$1321_storage_ptr",
"typeString": "struct AddressList.addressMap storage pointer"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 1394,
"name": "exist",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1350,
"src": "979:5:11",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_struct$_addressMap_$1321_storage_ptr_$_t_address_$returns$_t_bool_$",
"typeString": "function (struct AddressList.addressMap storage pointer,address) view returns (bool)"
}
},
"id": 1397,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "979:18:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 1402,
"nodeType": "IfStatement",
"src": "974:52:11",
"trueBody": {
"id": 1401,
"nodeType": "Block",
"src": "999:27:11",
"statements": [
{
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 1399,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1014:5:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 1393,