UNPKG

@ethsub/sol

Version:
854 lines (853 loc) 682 kB
{ "contractName": "EnumerableMap", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for managing an enumerable variant of Solidity's https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] type. Maps have the following properties: - Entries are added, removed, and checked for existence in constant time (O(1)). - Entries are enumerated in O(n). No guarantees are made on the ordering. ``` contract Example { // Add the library methods using EnumerableMap for EnumerableMap.UintToAddressMap; // Declare a set state variable EnumerableMap.UintToAddressMap private myMap; } ``` As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are supported.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/EnumerableMap.sol\":\"EnumerableMap\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/EnumerableMap.sol\":{\"keccak256\":\"0x4b087f06b6670a131a5a14e53b1d2a5ef19c034cc5ec42eeebcf9554325744ad\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f6a6af5d848334e40db419773f6360601e311ffc21c2e274f730b8c542da99fd\",\"dweb:/ipfs/QmfA24cxQ2g41ZWUuDF295dxDJ4xF1bSDYtC3EaLd7CzW8\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220542485f37e725817b9f9ef07330c301e0c0bb6d026d1e8b935cf1f191cb8317364736f6c634300060c0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220542485f37e725817b9f9ef07330c301e0c0bb6d026d1e8b935cf1f191cb8317364736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "772:8963:30:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "772:8963:30:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Library for managing an enumerable variant of Solidity's\n * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]\n * type.\n *\n * Maps have the following properties:\n *\n * - Entries are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Entries are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableMap for EnumerableMap.UintToAddressMap;\n *\n * // Declare a set state variable\n * EnumerableMap.UintToAddressMap private myMap;\n * }\n * ```\n *\n * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are\n * supported.\n */\nlibrary EnumerableMap {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Map type with\n // bytes32 keys and values.\n // The Map implementation uses private functions, and user-facing\n // implementations (such as Uint256ToAddressMap) are just wrappers around\n // the underlying Map.\n // This means that we can only create new EnumerableMaps for types that fit\n // in bytes32.\n\n struct MapEntry {\n bytes32 _key;\n bytes32 _value;\n }\n\n struct Map {\n // Storage of map keys and values\n MapEntry[] _entries;\n\n // Position of the entry defined by a key in the `entries` array, plus 1\n // because index 0 means a key is not in the map.\n mapping (bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Adds a key-value pair to a map, or updates the value for an existing\n * key. O(1).\n *\n * Returns true if the key was added to the map, that is if it was not\n * already present.\n */\n function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {\n // We read and store the key's index to prevent multiple reads from the same storage slot\n uint256 keyIndex = map._indexes[key];\n\n if (keyIndex == 0) { // Equivalent to !contains(map, key)\n map._entries.push(MapEntry({ _key: key, _value: value }));\n // The entry is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n map._indexes[key] = map._entries.length;\n return true;\n } else {\n map._entries[keyIndex - 1]._value = value;\n return false;\n }\n }\n\n /**\n * @dev Removes a key-value pair from a map. O(1).\n *\n * Returns true if the key was removed from the map, that is if it was present.\n */\n function _remove(Map storage map, bytes32 key) private returns (bool) {\n // We read and store the key's index to prevent multiple reads from the same storage slot\n uint256 keyIndex = map._indexes[key];\n\n if (keyIndex != 0) { // Equivalent to contains(map, key)\n // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one\n // in the array, and then remove the last entry (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = keyIndex - 1;\n uint256 lastIndex = map._entries.length - 1;\n\n // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs\n // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\n\n MapEntry storage lastEntry = map._entries[lastIndex];\n\n // Move the last entry to the index where the entry to delete is\n map._entries[toDeleteIndex] = lastEntry;\n // Update the index for the moved entry\n map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based\n\n // Delete the slot where the moved entry was stored\n map._entries.pop();\n\n // Delete the index for the deleted slot\n delete map._indexes[key];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the key is in the map. O(1).\n */\n function _contains(Map storage map, bytes32 key) private view returns (bool) {\n return map._indexes[key] != 0;\n }\n\n /**\n * @dev Returns the number of key-value pairs in the map. O(1).\n */\n function _length(Map storage map) private view returns (uint256) {\n return map._entries.length;\n }\n\n /**\n * @dev Returns the key-value pair stored at position `index` in the map. O(1).\n *\n * Note that there are no guarantees on the ordering of entries inside the\n * array, and it may change when more entries are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {\n require(map._entries.length > index, \"EnumerableMap: index out of bounds\");\n\n MapEntry storage entry = map._entries[index];\n return (entry._key, entry._value);\n }\n\n /**\n * @dev Tries to returns the value associated with `key`. O(1).\n * Does not revert if `key` is not in the map.\n */\n function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {\n uint256 keyIndex = map._indexes[key];\n if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)\n return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based\n }\n\n /**\n * @dev Returns the value associated with `key`. O(1).\n *\n * Requirements:\n *\n * - `key` must be in the map.\n */\n function _get(Map storage map, bytes32 key) private view returns (bytes32) {\n uint256 keyIndex = map._indexes[key];\n require(keyIndex != 0, \"EnumerableMap: nonexistent key\"); // Equivalent to contains(map, key)\n return map._entries[keyIndex - 1]._value; // All indexes are 1-based\n }\n\n /**\n * @dev Same as {_get}, with a custom error message when `key` is not in the map.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {_tryGet}.\n */\n function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {\n uint256 keyIndex = map._indexes[key];\n require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)\n return map._entries[keyIndex - 1]._value; // All indexes are 1-based\n }\n\n // UintToAddressMap\n\n struct UintToAddressMap {\n Map _inner;\n }\n\n /**\n * @dev Adds a key-value pair to a map, or updates the value for an existing\n * key. O(1).\n *\n * Returns true if the key was added to the map, that is if it was not\n * already present.\n */\n function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {\n return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the key was removed from the map, that is if it was present.\n */\n function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {\n return _remove(map._inner, bytes32(key));\n }\n\n /**\n * @dev Returns true if the key is in the map. O(1).\n */\n function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {\n return _contains(map._inner, bytes32(key));\n }\n\n /**\n * @dev Returns the number of elements in the map. O(1).\n */\n function length(UintToAddressMap storage map) internal view returns (uint256) {\n return _length(map._inner);\n }\n\n /**\n * @dev Returns the element stored at position `index` in the set. O(1).\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {\n (bytes32 key, bytes32 value) = _at(map._inner, index);\n return (uint256(key), address(uint160(uint256(value))));\n }\n\n /**\n * @dev Tries to returns the value associated with `key`. O(1).\n * Does not revert if `key` is not in the map.\n *\n * _Available since v3.4._\n */\n function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {\n (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));\n return (success, address(uint160(uint256(value))));\n }\n\n /**\n * @dev Returns the value associated with `key`. O(1).\n *\n * Requirements:\n *\n * - `key` must be in the map.\n */\n function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {\n return address(uint160(uint256(_get(map._inner, bytes32(key)))));\n }\n\n /**\n * @dev Same as {get}, with a custom error message when `key` is not in the map.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryGet}.\n */\n function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {\n return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));\n }\n}\n", "sourcePath": "@openzeppelin/contracts/utils/EnumerableMap.sol", "ast": { "absolutePath": "@openzeppelin/contracts/utils/EnumerableMap.sol", "exportedSymbols": { "EnumerableMap": [ 5451 ] }, "id": 5452, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 4893, "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "33:31:30" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 4894, "nodeType": "StructuredDocumentation", "src": "66:705:30", "text": " @dev Library for managing an enumerable variant of Solidity's\n https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]\n type.\n Maps have the following properties:\n - Entries are added, removed, and checked for existence in constant time\n (O(1)).\n - Entries are enumerated in O(n). No guarantees are made on the ordering.\n ```\n contract Example {\n // Add the library methods\n using EnumerableMap for EnumerableMap.UintToAddressMap;\n // Declare a set state variable\n EnumerableMap.UintToAddressMap private myMap;\n }\n ```\n As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are\n supported." }, "fullyImplemented": true, "id": 5451, "linearizedBaseContracts": [ 5451 ], "name": "EnumerableMap", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "EnumerableMap.MapEntry", "id": 4899, "members": [ { "constant": false, "id": 4896, "mutability": "mutable", "name": "_key", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4899, "src": "1284:12:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 4895, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1284:7:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4898, "mutability": "mutable", "name": "_value", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4899, "src": "1306:14:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 4897, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1306:7:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "name": "MapEntry", "nodeType": "StructDefinition", "scope": 5451, "src": "1258:69:30", "visibility": "public" }, { "canonicalName": "EnumerableMap.Map", "id": 4907, "members": [ { "constant": false, "id": 4902, "mutability": "mutable", "name": "_entries", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4907, "src": "1396:19:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_MapEntry_$4899_storage_$dyn_storage_ptr", "typeString": "struct EnumerableMap.MapEntry[]" }, "typeName": { "baseType": { "contractScope": null, "id": 4900, "name": "MapEntry", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4899, "src": "1396:8:30", "typeDescriptions": { "typeIdentifier": "t_struct$_MapEntry_$4899_storage_ptr", "typeString": "struct EnumerableMap.MapEntry" } }, "id": 4901, "length": null, "nodeType": "ArrayTypeName", "src": "1396:10:30", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_MapEntry_$4899_storage_$dyn_storage_ptr", "typeString": "struct EnumerableMap.MapEntry[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4906, "mutability": "mutable", "name": "_indexes", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4907, "src": "1565:37:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "typeName": { "id": 4905, "keyType": { "id": 4903, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1574:7:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "1565:28:30", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" }, "valueType": { "id": 4904, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1585:7:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "internal" } ], "name": "Map", "nodeType": "StructDefinition", "scope": 5451, "src": "1333:276:30", "visibility": "public" }, { "body": { "id": 4968, "nodeType": "Block", "src": "1918:596:30", "statements": [ { "assignments": [ 4920 ], "declarations": [ { "constant": false, "id": 4920, "mutability": "mutable", "name": "keyIndex", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4968, "src": "2026:16:30", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4919, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2026:7:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 4925, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4921, "name": "map", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4910, "src": "2045:3:30", "typeDescriptions": { "typeIdentifier": "t_struct$_Map_$4907_storage_ptr", "typeString": "struct EnumerableMap.Map storage pointer" } }, "id": 4922, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "_indexes", "nodeType": "MemberAccess", "referencedDeclaration": 4906, "src": "2045:12:30", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" } }, "id": 4924, "indexExpression": { "argumentTypes": null, "id": 4923, "name": "key", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4912, "src": "2058:3:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2045:17:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2026:36:30" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4928, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 4926, "name": "keyIndex", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4920, "src": "2077:8:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 4927, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2089:1:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "2077:13:30", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "id": 4966, "nodeType": "Block", "src": "2416:92:30", "statements": [ { "expression": { "argumentTypes": null, "id": 4962, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4953, "name": "map", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4910, "src": "2430:3:30", "typeDescriptions": { "typeIdentifier": "t_struct$_Map_$4907_storage_ptr", "typeString": "struct EnumerableMap.Map storage pointer" } }, "id": 4958, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "_entries", "nodeType": "MemberAccess", "referencedDeclaration": 4902, "src": "2430:12:30", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_MapEntry_$4899_storage_$dyn_storage", "typeString": "struct EnumerableMap.MapEntry storage ref[] storage ref" } }, "id": 4959, "indexExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4957, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 4955, "name": "keyIndex", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4920, "src": "2443:8:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 4956, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2454:1:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "2443:12:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2430:26:30", "typeDescriptions": { "typeIdentifier": "t_struct$_MapEntry_$4899_storage", "typeString": "struct EnumerableMap.MapEntry storage ref" } }, "id": 4960, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "memberName": "_value", "nodeType": "MemberAccess", "referencedDeclaration": 4898, "src": "2430:33:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4961, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4914, "src": "2466:5:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "src": "2430:41:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "id": 4963, "nodeType": "ExpressionStatement", "src": "2430:41:30" }, { "expression": { "argumentTypes": null, "hexValue": "66616c7365", "id": 4964, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "2492:5:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "functionReturnParameters": 4918, "id": 4965, "nodeType": "Return", "src": "2485:12:30" } ] }, "id": 4967, "nodeType": "IfStatement", "src": "2073:435:30", "trueBody": { "id": 4952, "nodeType": "Block", "src": "2092:318:30", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 4935, "name": "key", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4912, "src": "2178:3:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, { "argumentTypes": null, "id": 4936, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4914, "src": "2191:5:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 4934, "name": "MapEntry", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4899, "src": "2161:8:30", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_MapEntry_$4899_storage_ptr_$", "typeString": "type(struct EnumerableMap.MapEntry storage pointer)" } }, "id": 4937, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "_key", "_value" ], "nodeType": "FunctionCall", "src": "2161:38:30", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_struct$_MapEntry_$4899_memory_ptr", "typeString": "struct EnumerableMap.MapEntry memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_MapEntry_$4899_memory_ptr", "typeString": "struct EnumerableMap.MapEntry memory" } ], "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4929, "name": "map", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4910, "src": "2143:3:30", "typeDescriptions": { "typeIdentifier": "t_struct$_Map_$4907_storage_ptr", "typeString": "struct EnumerableMap.Map storage pointer" } }, "id": 4932, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "_entries", "nodeType": "MemberAccess", "referencedDeclaration": 4902, "src": "2143:12:30", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_MapEntry_$4899_storage_$dyn_storage", "typeString": "struct EnumerableMap.MapEntry storage ref[] storage ref" } }, "id": 4933, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2143:17:30", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_MapEntry_$4899_storage_$returns$__$", "typeString": "function (struct EnumerableMap.MapEntry storage ref)" } }, "id": 4938, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2143:57:30", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4939, "nodeType": "ExpressionStatement", "src": "2143:57:30" }, { "expression": { "argumentTypes": null, "id": 4948, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4940, "name": "map", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4910, "src": "2335:3:30", "typeDescriptions": { "typeIdentifier": "t_struct$_Map_$4907_storage_ptr", "typeString": "struct EnumerableMap.Map storage pointer" } }, "id": 4943, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "_indexes", "nodeType": "MemberAccess", "referencedDeclaration": 4906, "src": "2335:12:30", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", "typeString": "mapping(bytes32 => uint256)" } }, "id": 4944, "indexExpression": { "argumentTypes": null, "id": 4942, "name": "key", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4912, "src": "2348:3:30", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2335:17:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4945, "name": "map", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4910, "src": "2355:3:30", "typeDescriptions": { "typeIdentifier": "t_struct$_Map_$4907_storage_ptr", "typeString": "struct EnumerableMap.Map storage pointer" } }, "id": 4946, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "_entries", "nodeType": "MemberAccess", "referencedDeclaration": 4902, "src": "2355:12:30", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_MapEntry_$4899_storage_$dyn_storage", "typeString": "struct EnumerableMap.MapEntry storage ref[] storage ref" } }, "id": 4947, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2355:19:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2335:39:30", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 4949, "nodeType": "ExpressionStatement", "src": "2335:39:30" }, { "expression": { "argumentTypes": null, "hexValue": "74727565", "id": 4950, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "2395:4:30", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "functionReturnParameters": 4918, "id": 4951, "nodeType": "Return", "src": "2388:11:30" } ] } } ] }, "documentation": { "id": 4908, "nodeType": "StructuredDocumentation", "src": "1615:216:30", "text": " @dev Adds a key-value pair to a map, or updates the value for an existing\n key. O(1).\n Returns true if the key was added to the map, that is if it was not\n already present." }, "id": 4969,