UNPKG

jcc-solidity-utils

Version:
1,106 lines 513 kB
{ "contractName": "BalanceList", "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/BalanceList.sol\":\"BalanceList\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/BalanceList.sol\":{\"keccak256\":\"0x2906ed3a67d18deb64a973c72383c5973e99261b580f35334358687019259d1d\",\"urls\":[\"bzzr://b0b2d9f12203b12bc44278243e2855d059a7a369f1606e25aff9ac639fa13468\"]},\"/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x239546071316c89d3bbc9e61b2ccae270a4493bbd2f7c240052f533807d50ab7\",\"urls\":[\"bzzr://267bf48e0a30f7b671aa3c98a6b27ffe7bc64efd6533f49e54188b520baa94c5\"]}},\"version\":1}", "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582078e39fc140c21e65d3b39f351a70bca948bac5ec93f1686f2f954d4b9e1e25600029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582078e39fc140c21e65d3b39f351a70bca948bac5ec93f1686f2f954d4b9e1e25600029", "sourceMap": "173:3238:13:-;;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": "173:3238:13:-;;;;;;;;", "source": "pragma solidity >=0.4.24;\n\nimport \"../math/SafeMath.sol\";\n\n/**\n * @dev 资产列表共通,除资产负债之外提供一个账目清单数组,便于统计和查找.\n */\nlibrary BalanceList {\n using SafeMath for uint256;\n\n struct element {\n address addr;\n uint256 idx;\n uint256 balance;\n }\n struct balanceMap {\n mapping(address => uint256) mapList;\n element[] list;\n }\n\n function exist(balanceMap 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 == _addr);\n }\n\n function insert(\n balanceMap storage self,\n address _addr,\n uint256 _amount\n ) internal returns (bool) {\n element memory e =\n element({addr: _addr, idx: self.list.length, balance: _amount});\n self.list.push(e);\n self.mapList[_addr] = e.idx;\n return true;\n }\n\n function remove(balanceMap storage self, address _addr)\n internal\n returns (bool)\n {\n if (!exist(self, _addr)) {\n return false;\n }\n if (self.list[self.mapList[_addr]].balance > 0) {\n return false;\n }\n\n uint256 row2Del = self.mapList[_addr];\n element storage keyToMove = self.list[self.list.length.sub(1)];\n self.list[row2Del] = keyToMove;\n self.mapList[keyToMove.addr] = row2Del;\n self.list.length = self.list.length.sub(1);\n\n return true;\n }\n\n function add(\n balanceMap storage self,\n address _addr,\n uint256 _amount\n ) internal returns (uint256) {\n // 对于已经存在的数据更新状态即可\n if (exist(self, _addr)) {\n self.list[self.mapList[_addr]].balance = self.list[self.mapList[_addr]]\n .balance\n .add(_amount);\n } else {\n // 新建数据\n require(insert(self, _addr, _amount), \"insert data fail\");\n }\n\n return self.list[self.mapList[_addr]].balance;\n }\n\n function sub(\n balanceMap storage self,\n address _addr,\n uint256 _amount\n ) internal returns (uint256) {\n require(exist(self, _addr), \"can not sub no exist element\");\n\n self.list[self.mapList[_addr]].balance = self.list[self.mapList[_addr]]\n .balance\n .sub(_amount);\n\n if (self.list[self.mapList[_addr]].balance == 0) {\n require(remove(self, _addr), \"remove data fail\");\n return 0;\n }\n\n return self.list[self.mapList[_addr]].balance;\n }\n\n function count(balanceMap storage self) internal view returns (uint256) {\n return self.list.length;\n }\n\n function balance(balanceMap storage self, address _addr)\n internal\n view\n returns (uint256)\n {\n return exist(self, _addr) ? self.list[self.mapList[_addr]].balance : 0;\n }\n\n function get(balanceMap storage self, uint256 index)\n internal\n view\n returns (element memory)\n {\n require(index < self.list.length, \"index must small than current count\");\n\n return self.list[index];\n }\n\n // 获取指定下标范围的数据,本函数可以用于分页查询\n function getList(\n balanceMap storage self,\n uint256 from,\n uint256 _count\n ) internal view returns (element[] memory) {\n require(_count > 0, \"count number must bigger than 0\");\n\n uint256 _idx = 0;\n element[] memory res = new 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/BalanceList.sol", "ast": { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/list/BalanceList.sol", "exportedSymbols": { "BalanceList": [ 2326 ] }, "id": 2327, "nodeType": "SourceUnit", "nodes": [ { "id": 1886, "literals": [ "solidity", ">=", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:25:13" }, { "absolutePath": "/Users/chtian/Documents/01_work/01_develope/jcc/jcc-solidity-utils/contracts/math/SafeMath.sol", "file": "../math/SafeMath.sol", "id": 1887, "nodeType": "ImportDirective", "scope": 2327, "sourceUnit": 5658, "src": "27:30:13", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev 资产列表共通,除资产负债之外提供一个账目清单数组,便于统计和查找.", "fullyImplemented": true, "id": 2326, "linearizedBaseContracts": [ 2326 ], "name": "BalanceList", "nodeType": "ContractDefinition", "nodes": [ { "id": 1890, "libraryName": { "contractScope": null, "id": 1888, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5657, "src": "203:8:13", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$5657", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "197:27:13", "typeName": { "id": 1889, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "216:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "canonicalName": "BalanceList.element", "id": 1897, "members": [ { "constant": false, "id": 1892, "name": "addr", "nodeType": "VariableDeclaration", "scope": 1897, "src": "249:12:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1891, "name": "address", "nodeType": "ElementaryTypeName", "src": "249:7:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1894, "name": "idx", "nodeType": "VariableDeclaration", "scope": 1897, "src": "267:11:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 1893, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "267:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1896, "name": "balance", "nodeType": "VariableDeclaration", "scope": 1897, "src": "284:15:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 1895, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "284:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "element", "nodeType": "StructDefinition", "scope": 2326, "src": "228:76:13", "visibility": "public" }, { "canonicalName": "BalanceList.balanceMap", "id": 1905, "members": [ { "constant": false, "id": 1901, "name": "mapList", "nodeType": "VariableDeclaration", "scope": 1905, "src": "331:35:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 1900, "keyType": { "id": 1898, "name": "address", "nodeType": "ElementaryTypeName", "src": "339:7:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "331:27:13", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 1899, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "350:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1904, "name": "list", "nodeType": "VariableDeclaration", "scope": 1905, "src": "372:14:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage_ptr", "typeString": "struct BalanceList.element[]" }, "typeName": { "baseType": { "contractScope": null, "id": 1902, "name": "element", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1897, "src": "372:7:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_storage_ptr", "typeString": "struct BalanceList.element" } }, "id": 1903, "length": null, "nodeType": "ArrayTypeName", "src": "372:9:13", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage_ptr", "typeString": "struct BalanceList.element[]" } }, "value": null, "visibility": "internal" } ], "name": "balanceMap", "nodeType": "StructDefinition", "scope": 2326, "src": "307:84:13", "visibility": "public" }, { "body": { "id": 1934, "nodeType": "Block", "src": "493:109:13", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 1918, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1914, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1907, "src": "503:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1915, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 1904, "src": "503:9:13", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage", "typeString": "struct BalanceList.element storage ref[] storage ref" } }, "id": 1916, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "503:16:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 1917, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "523:1:13", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "503:21:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 1921, "nodeType": "IfStatement", "src": "499:39:13", "trueBody": { "expression": { "argumentTypes": null, "hexValue": "66616c7365", "id": 1919, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "533:5:13", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "functionReturnParameters": 1913, "id": 1920, "nodeType": "Return", "src": "526:12:13" } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 1931, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1922, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1907, "src": "552:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1923, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 1904, "src": "552:9:13", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage", "typeString": "struct BalanceList.element storage ref[] storage ref" } }, "id": 1928, "indexExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1924, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1907, "src": "562:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1925, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "mapList", "nodeType": "MemberAccess", "referencedDeclaration": 1901, "src": "562:12:13", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 1927, "indexExpression": { "argumentTypes": null, "id": 1926, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1909, "src": "575:5:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "562:19:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "552:30:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_storage", "typeString": "struct BalanceList.element storage ref" } }, "id": 1929, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "addr", "nodeType": "MemberAccess", "referencedDeclaration": 1892, "src": "552:35:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 1930, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1909, "src": "591:5:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "552:44:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "id": 1932, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "551:46:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 1913, "id": 1933, "nodeType": "Return", "src": "544:53:13" } ] }, "documentation": null, "id": 1935, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "exist", "nodeType": "FunctionDefinition", "parameters": { "id": 1910, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1907, "name": "self", "nodeType": "VariableDeclaration", "scope": 1935, "src": "410:23:13", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap" }, "typeName": { "contractScope": null, "id": 1906, "name": "balanceMap", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1905, "src": "410:10:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1909, "name": "_addr", "nodeType": "VariableDeclaration", "scope": 1935, "src": "435:13:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1908, "name": "address", "nodeType": "ElementaryTypeName", "src": "435:7:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "409:40:13" }, "payable": false, "returnParameters": { "id": 1913, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1912, "name": "", "nodeType": "VariableDeclaration", "scope": 1935, "src": "485:4:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 1911, "name": "bool", "nodeType": "ElementaryTypeName", "src": "485:4:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "484:6:13" }, "scope": 2326, "src": "395:207:13", "stateMutability": "view", "superFunction": null, "visibility": "internal" }, { "body": { "id": 1975, "nodeType": "Block", "src": "719:172:13", "statements": [ { "assignments": [ 1947 ], "declarations": [ { "constant": false, "id": 1947, "name": "e", "nodeType": "VariableDeclaration", "scope": 1976, "src": "725:16:13", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_memory_ptr", "typeString": "struct BalanceList.element" }, "typeName": { "contractScope": null, "id": 1946, "name": "element", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1897, "src": "725:7:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_storage_ptr", "typeString": "struct BalanceList.element" } }, "value": null, "visibility": "internal" } ], "id": 1955, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1949, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1939, "src": "765:5:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1950, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1937, "src": "777:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1951, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 1904, "src": "777:9:13", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage", "typeString": "struct BalanceList.element storage ref[] storage ref" } }, "id": 1952, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "777:16:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 1953, "name": "_amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1941, "src": "804:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": null, "id": 1948, "name": "element", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1897, "src": "750:7:13", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_element_$1897_storage_ptr_$", "typeString": "type(struct BalanceList.element storage pointer)" } }, "id": 1954, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "addr", "idx", "balance" ], "nodeType": "FunctionCall", "src": "750:63:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_memory", "typeString": "struct BalanceList.element memory" } }, "nodeType": "VariableDeclarationStatement", "src": "725:88:13" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1961, "name": "e", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1947, "src": "834:1:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_memory_ptr", "typeString": "struct BalanceList.element memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_element_$1897_memory_ptr", "typeString": "struct BalanceList.element memory" } ], "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1956, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1937, "src": "819:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1959, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "list", "nodeType": "MemberAccess", "referencedDeclaration": 1904, "src": "819:9:13", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_element_$1897_storage_$dyn_storage", "typeString": "struct BalanceList.element storage ref[] storage ref" } }, "id": 1960, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "819:14:13", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_element_$1897_storage_$returns$_t_uint256_$", "typeString": "function (struct BalanceList.element storage ref) returns (uint256)" } }, "id": 1962, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "819:17:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 1963, "nodeType": "ExpressionStatement", "src": "819:17:13" }, { "expression": { "argumentTypes": null, "id": 1971, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1964, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1937, "src": "842:4:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap storage pointer" } }, "id": 1967, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "mapList", "nodeType": "MemberAccess", "referencedDeclaration": 1901, "src": "842:12:13", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 1968, "indexExpression": { "argumentTypes": null, "id": 1966, "name": "_addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1939, "src": "855:5:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "842:19:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1969, "name": "e", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1947, "src": "864:1:13", "typeDescriptions": { "typeIdentifier": "t_struct$_element_$1897_memory_ptr", "typeString": "struct BalanceList.element memory" } }, "id": 1970, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "idx", "nodeType": "MemberAccess", "referencedDeclaration": 1894, "src": "864:5:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "842:27:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 1972, "nodeType": "ExpressionStatement", "src": "842:27:13" }, { "expression": { "argumentTypes": null, "hexValue": "74727565", "id": 1973, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "882:4:13", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "functionReturnParameters": 1945, "id": 1974, "nodeType": "Return", "src": "875:11:13" } ] }, "documentation": null, "id": 1976, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "insert", "nodeType": "FunctionDefinition", "parameters": { "id": 1942, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1937, "name": "self", "nodeType": "VariableDeclaration", "scope": 1976, "src": "627:23:13", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap" }, "typeName": { "contractScope": null, "id": 1936, "name": "balanceMap", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1905, "src": "627:10:13", "typeDescriptions": { "typeIdentifier": "t_struct$_balanceMap_$1905_storage_ptr", "typeString": "struct BalanceList.balanceMap" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1939, "name": "_addr", "nodeType": "VariableDeclaration", "scope": 1976, "src": "656:13:13", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1938, "name": "address", "nodeType": "ElementaryTypeName", "src": "656:7:13", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1941, "name": "_amount", "nodeType": "VariableDeclaration", "scope": 1976, "src": "675:15:13", "stateVariable": false, "sto