UNPKG

@dolomite-exchange/dolomite-margin

Version:

Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol

1,208 lines (1,207 loc) 50.9 kB
{ "contractName": "Account", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"dYdX * Library of structs and functions that represent an account\",\"methods\":{},\"title\":\"Account\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol\":\"Account\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol\":{\"keccak256\":\"0x2059276ea5e478bd5ac7f2712e7b1b6c85d291c647a54b264909044844828e67\",\"urls\":[\"bzz-raw://f153777051d12131b13a57e5c3af10a2670927cfc7d22c9519ab20c9b4b9bc89\",\"dweb:/ipfs/QmQMP3qS5xDAVGYKDfNkbkSqBKozQGQsGqX4e8VyjRtxPS\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/DolomiteMarginMath.sol\":{\"keccak256\":\"0x53f205f6a779d579be29faa9412c806a892b3e605fff092dfd9d14d936fa019f\",\"urls\":[\"bzz-raw://0ff936f89602a63b8e6a4eb4ce8f87673c0f45b7ce29694920905a3f0b5a6a69\",\"dweb:/ipfs/QmbYME9BeEvPC1ndV8EaUDX5fDMghLc3rocNUxFtgHmg8m\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol\":{\"keccak256\":\"0x41a3460e34b7b8635d936e35e6568ceb5354b638f53b884530e0d4875fa0f151\",\"urls\":[\"bzz-raw://d1a5ba866ee95d455afe5075dadd91fc71c2806371f2c1b358a1f67c632bb0df\",\"dweb:/ipfs/QmW4qCjmsG8J3UJv97GwDLDM7wt1K4yLDKAwzWMY7TFYi5\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Require.sol\":{\"keccak256\":\"0x05a2a90b41b6a5f42f0a72da63d015fb0b406a9ba2172823352e522e8bf3a606\",\"urls\":[\"bzz-raw://19883f0c6d33266f756ec5c3d17539524aa24b993c46c33f8400801d09373a6c\",\"dweb:/ipfs/QmYX2fwK3vQQDSZLMrc5wMfeb8RWrcC9CGX8XECLty8QDk\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol\":{\"keccak256\":\"0xe1bab8c8799d83e86c7a49aaf815d8e3bc8d09562d46d44d921500db5e98de0e\",\"urls\":[\"bzz-raw://8ea3d0cc4fdab6dd9bba545a792170f939b342d8d1a7051c1c6365009af72658\",\"dweb:/ipfs/QmaLJgbavu88eEit6JPqfWnw6NmGBDZfveMXxumgWywBFG\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}", "bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a723158200773f674df22cc0ece6c2325ff3b480882d76ad070ef74c113931ae5eaa92e036c6578706572696d656e74616cf564736f6c63430005100040", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a723158200773f674df22cc0ece6c2325ff3b480882d76ad070ef74c113931ae5eaa92e036c6578706572696d656e74616cf564736f6c63430005100040", "sourceMap": "861:1324:87:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", "deployedSourceMap": "861:1324:87:-;;;;;;;;", "source": "/*\n\n Copyright 2019 dYdX Trading Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\npragma experimental ABIEncoderV2;\n\nimport { Types } from \"./Types.sol\";\nimport { EnumerableSet } from \"./EnumerableSet.sol\";\n\n\n/**\n * @title Account\n * @author dYdX\n *\n * Library of structs and functions that represent an account\n */\nlibrary Account {\n // ============ Enums ============\n\n /*\n * Most-recently-cached account status.\n *\n * Normal: Can only be liquidated if the account values are violating the global margin-ratio.\n * Liquid: Can be liquidated no matter the account values.\n * Can be vaporized if there are no more positive account values.\n * Vapor: Has only negative (or zeroed) account values. Can be vaporized.\n *\n */\n enum Status {\n Normal,\n Liquid,\n Vapor\n }\n\n // ============ Structs ============\n\n // Represents the unique key that specifies an account\n struct Info {\n address owner; // The address that owns the account\n uint256 number; // A nonce that allows a single address to control many accounts\n }\n\n // The complete storage for any account\n struct Storage {\n Status status;\n uint32 numberOfMarketsWithDebt;\n EnumerableSet.Set marketsWithNonZeroBalanceSet;\n mapping (uint256 => Types.Par) balances; // Mapping from marketId to principal\n }\n\n // ============ Library Functions ============\n\n function equals(\n Info memory a,\n Info memory b\n )\n internal\n pure\n returns (bool)\n {\n return a.owner == b.owner && a.number == b.number;\n }\n}\n", "sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol", "exportedSymbols": { "Account": [ 24885 ] }, "id": 24886, "nodeType": "SourceUnit", "nodes": [ { "id": 24837, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:87" }, { "id": 24838, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:87" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol", "file": "./Types.sol", "id": 24840, "nodeType": "ImportDirective", "scope": 24886, "sourceUnit": 31362, "src": "662:36:87", "symbolAliases": [ { "foreign": 24839, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol", "file": "./EnumerableSet.sol", "id": 24842, "nodeType": "ImportDirective", "scope": 24886, "sourceUnit": 26429, "src": "699:52:87", "symbolAliases": [ { "foreign": 24841, "local": null } ], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title Account\n@author dYdX\n * Library of structs and functions that represent an account", "fullyImplemented": true, "id": 24885, "linearizedBaseContracts": [ 24885 ], "name": "Account", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "Account.Status", "id": 24846, "members": [ { "id": 24843, "name": "Normal", "nodeType": "EnumValue", "src": "1337:6:87" }, { "id": 24844, "name": "Liquid", "nodeType": "EnumValue", "src": "1353:6:87" }, { "id": 24845, "name": "Vapor", "nodeType": "EnumValue", "src": "1369:5:87" } ], "name": "Status", "nodeType": "EnumDefinition", "src": "1315:65:87" }, { "canonicalName": "Account.Info", "id": 24851, "members": [ { "constant": false, "id": 24848, "name": "owner", "nodeType": "VariableDeclaration", "scope": 24851, "src": "1509:13:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 24847, "name": "address", "nodeType": "ElementaryTypeName", "src": "1509:7:87", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24850, "name": "number", "nodeType": "VariableDeclaration", "scope": 24851, "src": "1570:14:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24849, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1570:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Info", "nodeType": "StructDefinition", "scope": 24885, "src": "1487:169:87", "visibility": "public" }, { "canonicalName": "Account.Storage", "id": 24862, "members": [ { "constant": false, "id": 24853, "name": "status", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1731:13:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_Status_$24846", "typeString": "enum Account.Status" }, "typeName": { "contractScope": null, "id": 24852, "name": "Status", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24846, "src": "1731:6:87", "typeDescriptions": { "typeIdentifier": "t_enum$_Status_$24846", "typeString": "enum Account.Status" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24855, "name": "numberOfMarketsWithDebt", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1754:30:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 24854, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1754:6:87", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24857, "name": "marketsWithNonZeroBalanceSet", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1794:46:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_Set_$26249_storage_ptr", "typeString": "struct EnumerableSet.Set" }, "typeName": { "contractScope": null, "id": 24856, "name": "EnumerableSet.Set", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 26249, "src": "1794:17:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Set_$26249_storage_ptr", "typeString": "struct EnumerableSet.Set" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24861, "name": "balances", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1850:39:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Par_$30890_storage_$", "typeString": "mapping(uint256 => struct Types.Par)" }, "typeName": { "id": 24860, "keyType": { "id": 24858, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1859:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "1850:30:87", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Par_$30890_storage_$", "typeString": "mapping(uint256 => struct Types.Par)" }, "valueType": { "contractScope": null, "id": 24859, "name": "Types.Par", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 30890, "src": "1870:9:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Par_$30890_storage_ptr", "typeString": "struct Types.Par" } } }, "value": null, "visibility": "internal" } ], "name": "Storage", "nodeType": "StructDefinition", "scope": 24885, "src": "1706:228:87", "visibility": "public" }, { "body": { "id": 24883, "nodeType": "Block", "src": "2117:66:87", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 24881, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 24875, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24871, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24864, "src": "2134:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24872, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "2134:7:87", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24873, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24866, "src": "2145:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24874, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "2145:7:87", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2134:18:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 24880, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24876, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24864, "src": "2156:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24877, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "2156:8:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24878, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24866, "src": "2168:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24879, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "2168:8:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2156:20:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "2134:42:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 24870, "id": 24882, "nodeType": "Return", "src": "2127:49:87" } ] }, "documentation": null, "id": 24884, "implemented": true, "kind": "function", "modifiers": [], "name": "equals", "nodeType": "FunctionDefinition", "parameters": { "id": 24867, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24864, "name": "a", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2017:13:87", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info" }, "typeName": { "contractScope": null, "id": 24863, "name": "Info", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24851, "src": "2017:4:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_storage_ptr", "typeString": "struct Account.Info" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24866, "name": "b", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2040:13:87", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info" }, "typeName": { "contractScope": null, "id": 24865, "name": "Info", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24851, "src": "2040:4:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_storage_ptr", "typeString": "struct Account.Info" } }, "value": null, "visibility": "internal" } ], "src": "2007:52:87" }, "returnParameters": { "id": 24870, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24869, "name": "", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2107:4:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 24868, "name": "bool", "nodeType": "ElementaryTypeName", "src": "2107:4:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "2106:6:87" }, "scope": 24885, "src": "1992:191:87", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 24886, "src": "861:1324:87" } ], "src": "603:1583:87" }, "legacyAST": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Account.sol", "exportedSymbols": { "Account": [ 24885 ] }, "id": 24886, "nodeType": "SourceUnit", "nodes": [ { "id": 24837, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:87" }, { "id": 24838, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:87" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol", "file": "./Types.sol", "id": 24840, "nodeType": "ImportDirective", "scope": 24886, "sourceUnit": 31362, "src": "662:36:87", "symbolAliases": [ { "foreign": 24839, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/EnumerableSet.sol", "file": "./EnumerableSet.sol", "id": 24842, "nodeType": "ImportDirective", "scope": 24886, "sourceUnit": 26429, "src": "699:52:87", "symbolAliases": [ { "foreign": 24841, "local": null } ], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title Account\n@author dYdX\n * Library of structs and functions that represent an account", "fullyImplemented": true, "id": 24885, "linearizedBaseContracts": [ 24885 ], "name": "Account", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "Account.Status", "id": 24846, "members": [ { "id": 24843, "name": "Normal", "nodeType": "EnumValue", "src": "1337:6:87" }, { "id": 24844, "name": "Liquid", "nodeType": "EnumValue", "src": "1353:6:87" }, { "id": 24845, "name": "Vapor", "nodeType": "EnumValue", "src": "1369:5:87" } ], "name": "Status", "nodeType": "EnumDefinition", "src": "1315:65:87" }, { "canonicalName": "Account.Info", "id": 24851, "members": [ { "constant": false, "id": 24848, "name": "owner", "nodeType": "VariableDeclaration", "scope": 24851, "src": "1509:13:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 24847, "name": "address", "nodeType": "ElementaryTypeName", "src": "1509:7:87", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24850, "name": "number", "nodeType": "VariableDeclaration", "scope": 24851, "src": "1570:14:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24849, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1570:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Info", "nodeType": "StructDefinition", "scope": 24885, "src": "1487:169:87", "visibility": "public" }, { "canonicalName": "Account.Storage", "id": 24862, "members": [ { "constant": false, "id": 24853, "name": "status", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1731:13:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_Status_$24846", "typeString": "enum Account.Status" }, "typeName": { "contractScope": null, "id": 24852, "name": "Status", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24846, "src": "1731:6:87", "typeDescriptions": { "typeIdentifier": "t_enum$_Status_$24846", "typeString": "enum Account.Status" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24855, "name": "numberOfMarketsWithDebt", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1754:30:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 24854, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1754:6:87", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24857, "name": "marketsWithNonZeroBalanceSet", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1794:46:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_Set_$26249_storage_ptr", "typeString": "struct EnumerableSet.Set" }, "typeName": { "contractScope": null, "id": 24856, "name": "EnumerableSet.Set", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 26249, "src": "1794:17:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Set_$26249_storage_ptr", "typeString": "struct EnumerableSet.Set" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24861, "name": "balances", "nodeType": "VariableDeclaration", "scope": 24862, "src": "1850:39:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Par_$30890_storage_$", "typeString": "mapping(uint256 => struct Types.Par)" }, "typeName": { "id": 24860, "keyType": { "id": 24858, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1859:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "1850:30:87", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Par_$30890_storage_$", "typeString": "mapping(uint256 => struct Types.Par)" }, "valueType": { "contractScope": null, "id": 24859, "name": "Types.Par", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 30890, "src": "1870:9:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Par_$30890_storage_ptr", "typeString": "struct Types.Par" } } }, "value": null, "visibility": "internal" } ], "name": "Storage", "nodeType": "StructDefinition", "scope": 24885, "src": "1706:228:87", "visibility": "public" }, { "body": { "id": 24883, "nodeType": "Block", "src": "2117:66:87", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 24881, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 24875, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24871, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24864, "src": "2134:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24872, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "2134:7:87", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24873, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24866, "src": "2145:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24874, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "owner", "nodeType": "MemberAccess", "referencedDeclaration": 24848, "src": "2145:7:87", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2134:18:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 24880, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24876, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24864, "src": "2156:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24877, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "2156:8:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 24878, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24866, "src": "2168:1:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info memory" } }, "id": 24879, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": 24850, "src": "2168:8:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2156:20:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "2134:42:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 24870, "id": 24882, "nodeType": "Return", "src": "2127:49:87" } ] }, "documentation": null, "id": 24884, "implemented": true, "kind": "function", "modifiers": [], "name": "equals", "nodeType": "FunctionDefinition", "parameters": { "id": 24867, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24864, "name": "a", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2017:13:87", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info" }, "typeName": { "contractScope": null, "id": 24863, "name": "Info", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24851, "src": "2017:4:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_storage_ptr", "typeString": "struct Account.Info" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 24866, "name": "b", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2040:13:87", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_memory_ptr", "typeString": "struct Account.Info" }, "typeName": { "contractScope": null, "id": 24865, "name": "Info", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24851, "src": "2040:4:87", "typeDescriptions": { "typeIdentifier": "t_struct$_Info_$24851_storage_ptr", "typeString": "struct Account.Info" } }, "value": null, "visibility": "internal" } ], "src": "2007:52:87" }, "returnParameters": { "id": 24870, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 24869, "name": "", "nodeType": "VariableDeclaration", "scope": 24884, "src": "2107:4:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 24868, "name": "bool", "nodeType": "ElementaryTypeName", "src": "2107:4:87", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool"