UNPKG

@dolomite-exchange/dolomite-margin

Version:

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

1,109 lines 46.5 kB
{ "contractName": "TestPriceOracle", "abi": [ { "constant": true, "inputs": [], "name": "ONE_DOLLAR", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "g_prices", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "price", "type": "uint256" } ], "name": "setPrice", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "token", "type": "address" } ], "name": "getPrice", "outputs": [ { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Monetary.Price", "name": "", "type": "tuple" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"ONE_DOLLAR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"g_prices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"getPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Monetary.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setPrice\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"dYdX * Oracle used for testing\",\"methods\":{},\"title\":\"TestPriceOracle\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestPriceOracle.sol\":\"TestPriceOracle\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol\":{\"keccak256\":\"0x3f7c3d1397390ea44c6d5e5730d49476431c3df3b28334fe38218de5edc31138\",\"urls\":[\"bzz-raw://63ebf926fca9ce33aaabaf93805686acc25daded1648d6dab59c8c4d05116918\",\"dweb:/ipfs/QmeGkDp7ycYstpfqCYBiqoCYwy876gabx8r42o5koj3H5A\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol\":{\"keccak256\":\"0x5257274f2d4d3605f3e97ec45fb902111fe9a22506f0b4cf308ea933bc81bfe2\",\"urls\":[\"bzz-raw://85b8023b78805063a2ec8d376f1f5983994eabd96efd8ceadb0224dbb71c5678\",\"dweb:/ipfs/QmaDhzCzRqsuHuJfhToEC4pATQHwhh7yWWsjwfuRzFT1kG\"]},\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestPriceOracle.sol\":{\"keccak256\":\"0x1c9fa41d1d031d22ef24afa7f0b684d7ac719080c26f4b3cfc865237f19f5e4e\",\"urls\":[\"bzz-raw://5b09f2874c1df503f317825e4fc4c2c0f685c1e379573c043bea3d5af02da074\",\"dweb:/ipfs/QmZyjnQsUYgNDpmYVpEfs3m9WGzwivozSY4hH4FC1DfBxt\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610297806100206000396000f3fe608060405234801561001057600080fd5b506004361061004b5760003560e01c8062e4768b1461005057806338916d231461006557806341976e091461008e578063572ca9e7146100ae575b600080fd5b61006361005e366004610197565b6100b6565b005b610078610073366004610171565b6100df565b6040516100859190610205565b60405180910390f35b6100a161009c366004610171565b6100f1565b60405161008591906101f7565b61007861012f565b73ffffffffffffffffffffffffffffffffffffffff909116600090815260208190526040902055565b60006020819052908152604090205481565b6100f9610142565b50604080516020808201835273ffffffffffffffffffffffffffffffffffffffff93909316600090815292839052912054815290565b6ec097ce7bc90715b34b9f100000000081565b6040518060200160405280600081525090565b803561016081610234565b92915050565b80356101608161024b565b60006020828403121561018357600080fd5b600061018f8484610155565b949350505050565b600080604083850312156101aa57600080fd5b60006101b68585610155565b92505060206101c785828601610166565b9150509250929050565b805160208301906101e284826101e8565b50505050565b6101f181610231565b82525050565b6020810161016082846101d1565b6020810161016082846101e8565b600073ffffffffffffffffffffffffffffffffffffffff8216610160565b90565b61023d81610213565b811461024857600080fd5b50565b61023d8161023156fea365627a7a723158200a4351b47143a315abd888f4f000ecff0618a38496fe9c8ac93e7eb048b7e1256c6578706572696d656e74616cf564736f6c63430005100040", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004b5760003560e01c8062e4768b1461005057806338916d231461006557806341976e091461008e578063572ca9e7146100ae575b600080fd5b61006361005e366004610197565b6100b6565b005b610078610073366004610171565b6100df565b6040516100859190610205565b60405180910390f35b6100a161009c366004610171565b6100f1565b60405161008591906101f7565b61007861012f565b73ffffffffffffffffffffffffffffffffffffffff909116600090815260208190526040902055565b60006020819052908152604090205481565b6100f9610142565b50604080516020808201835273ffffffffffffffffffffffffffffffffffffffff93909316600090815292839052912054815290565b6ec097ce7bc90715b34b9f100000000081565b6040518060200160405280600081525090565b803561016081610234565b92915050565b80356101608161024b565b60006020828403121561018357600080fd5b600061018f8484610155565b949350505050565b600080604083850312156101aa57600080fd5b60006101b68585610155565b92505060206101c785828601610166565b9150509250929050565b805160208301906101e284826101e8565b50505050565b6101f181610231565b82525050565b6020810161016082846101d1565b6020810161016082846101e8565b600073ffffffffffffffffffffffffffffffffffffffff8216610160565b90565b61023d81610213565b811461024857600080fd5b50565b61023d8161023156fea365627a7a723158200a4351b47143a315abd888f4f000ecff0618a38496fe9c8ac93e7eb048b7e1256c6578706572696d656e74616cf564736f6c63430005100040", "sourceMap": "873:443:136:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;873:443:136;;;;;;;", "deployedSourceMap": "873:443:136:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;873:443:136;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;972:131;;;;;;;;;:::i;:::-;;921:44;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;1109:205;;;;;;;;;:::i;:::-;;;;;;;;928:45:86;;;:::i;972:131:136:-;1073:15;;;;:8;:15;;;;;;;;;;:23;972:131::o;921:44::-;;;;;;;;;;;;;;:::o;1109:205::-;1201:21;;:::i;:::-;-1:-1:-1;1245:62:136;;;;;;;;;1281:15;;;;;-1:-1:-1;1281:15:136;;;;;;;;;;1245:62;;;1109:205::o;928:45:86:-;965:8;928:45;:::o;873:443:136:-;;;;;;;;;;;;;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;;57:78;;;;;142:130;209:20;;234:33;209:20;234:33;;279:241;;383:2;371:9;362:7;358:23;354:32;351:2;;;399:1;396;389:12;351:2;434:1;451:53;496:7;476:9;451:53;;;441:63;345:175;-1:-1;;;;345:175;527:366;;;648:2;636:9;627:7;623:23;619:32;616:2;;;664:1;661;654:12;616:2;699:1;716:53;761:7;741:9;716:53;;;706:63;;678:97;806:2;824:53;869:7;860:6;849:9;845:22;824:53;;;814:63;;785:98;610:283;;;;;;953:321;1161:23;;1094:4;1085:14;;;1190:63;1089:3;1161:23;1190:63;;;1114:145;1067:207;;;;1281:103;1354:24;1372:5;1354:24;;;1349:3;1342:37;1336:48;;;1511:309;1677:2;1662:18;;1691:119;1666:9;1783:6;1691:119;;1827:213;1945:2;1930:18;;1959:71;1934:9;2003:6;1959:71;;2047:91;;2218:42;2207:54;;2109:24;2190:76;2273:72;2335:5;2318:27;2352:117;2421:24;2439:5;2421:24;;;2414:5;2411:35;2401:2;;2460:1;2457;2450:12;2401:2;2395:74;;2476:117;2545:24;2563:5;2545:24;", "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 { IPriceOracle } from \"../protocol/interfaces/IPriceOracle.sol\";\nimport { Monetary } from \"../protocol/lib/Monetary.sol\";\n\n\n/**\n * @title TestPriceOracle\n * @author dYdX\n *\n * Oracle used for testing\n */\ncontract TestPriceOracle is IPriceOracle {\n\n mapping (address => uint256) public g_prices;\n\n function setPrice(\n address token,\n uint256 price\n )\n external\n {\n g_prices[token] = price;\n }\n\n function getPrice(\n address token\n )\n public\n view\n returns (Monetary.Price memory)\n {\n return Monetary.Price({\n value: g_prices[token]\n });\n }\n}\n", "sourcePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestPriceOracle.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestPriceOracle.sol", "exportedSymbols": { "TestPriceOracle": [ 36192 ] }, "id": 36193, "nodeType": "SourceUnit", "nodes": [ { "id": 36151, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:136" }, { "id": 36152, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:136" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol", "file": "../protocol/interfaces/IPriceOracle.sol", "id": 36154, "nodeType": "ImportDirective", "scope": 36193, "sourceUnit": 24836, "src": "662:71:136", "symbolAliases": [ { "foreign": 36153, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol", "file": "../protocol/lib/Monetary.sol", "id": 36156, "nodeType": "ImportDirective", "scope": 36193, "sourceUnit": 27761, "src": "734:56:136", "symbolAliases": [ { "foreign": 36155, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 36157, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24835, "src": "901:12:136", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$24835", "typeString": "contract IPriceOracle" } }, "id": 36158, "nodeType": "InheritanceSpecifier", "src": "901:12:136" } ], "contractDependencies": [ 24835 ], "contractKind": "contract", "documentation": "@title TestPriceOracle\n@author dYdX\n * Oracle used for testing", "fullyImplemented": true, "id": 36192, "linearizedBaseContracts": [ 36192, 24835 ], "name": "TestPriceOracle", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 36162, "name": "g_prices", "nodeType": "VariableDeclaration", "scope": 36192, "src": "921:44:136", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 36161, "keyType": { "id": 36159, "name": "address", "nodeType": "ElementaryTypeName", "src": "930:7:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "921:28:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 36160, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "941:7:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "body": { "id": 36175, "nodeType": "Block", "src": "1063:40:136", "statements": [ { "expression": { "argumentTypes": null, "id": 36173, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 36169, "name": "g_prices", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36162, "src": "1073:8:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 36171, "indexExpression": { "argumentTypes": null, "id": 36170, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36164, "src": "1082:5:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1073:15:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 36172, "name": "price", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36166, "src": "1091:5:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1073:23:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 36174, "nodeType": "ExpressionStatement", "src": "1073:23:136" } ] }, "documentation": null, "id": 36176, "implemented": true, "kind": "function", "modifiers": [], "name": "setPrice", "nodeType": "FunctionDefinition", "parameters": { "id": 36167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36164, "name": "token", "nodeType": "VariableDeclaration", "scope": 36176, "src": "999:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36163, "name": "address", "nodeType": "ElementaryTypeName", "src": "999:7:136", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 36166, "name": "price", "nodeType": "VariableDeclaration", "scope": 36176, "src": "1022:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 36165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1022:7:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "989:52:136" }, "returnParameters": { "id": 36168, "nodeType": "ParameterList", "parameters": [], "src": "1063:0:136" }, "scope": 36192, "src": "972:131:136", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 36190, "nodeType": "Block", "src": "1228:86:136", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 36185, "name": "g_prices", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36162, "src": "1281:8:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 36187, "indexExpression": { "argumentTypes": null, "id": 36186, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36178, "src": "1290:5:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1281:15:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 36183, "name": "Monetary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 27760, "src": "1245:8:136", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Monetary_$27760_$", "typeString": "type(library Monetary)" } }, "id": 36184, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "Price", "nodeType": "MemberAccess", "referencedDeclaration": 27756, "src": "1245:14:136", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Price_$27756_storage_ptr_$", "typeString": "type(struct Monetary.Price storage pointer)" } }, "id": 36188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value" ], "nodeType": "FunctionCall", "src": "1245:62:136", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_memory", "typeString": "struct Monetary.Price memory" } }, "functionReturnParameters": 36182, "id": 36189, "nodeType": "Return", "src": "1238:69:136" } ] }, "documentation": null, "id": 36191, "implemented": true, "kind": "function", "modifiers": [], "name": "getPrice", "nodeType": "FunctionDefinition", "parameters": { "id": 36179, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36178, "name": "token", "nodeType": "VariableDeclaration", "scope": 36191, "src": "1136:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36177, "name": "address", "nodeType": "ElementaryTypeName", "src": "1136:7:136", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1126:29:136" }, "returnParameters": { "id": 36182, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36181, "name": "", "nodeType": "VariableDeclaration", "scope": 36191, "src": "1201:21:136", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_memory_ptr", "typeString": "struct Monetary.Price" }, "typeName": { "contractScope": null, "id": 36180, "name": "Monetary.Price", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27756, "src": "1201:14:136", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_storage_ptr", "typeString": "struct Monetary.Price" } }, "value": null, "visibility": "internal" } ], "src": "1200:23:136" }, "scope": 36192, "src": "1109:205:136", "stateMutability": "view", "superFunction": 24834, "visibility": "public" } ], "scope": 36193, "src": "873:443:136" } ], "src": "603:714:136" }, "legacyAST": { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/testing/TestPriceOracle.sol", "exportedSymbols": { "TestPriceOracle": [ 36192 ] }, "id": 36193, "nodeType": "SourceUnit", "nodes": [ { "id": 36151, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:136" }, { "id": 36152, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:136" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol", "file": "../protocol/interfaces/IPriceOracle.sol", "id": 36154, "nodeType": "ImportDirective", "scope": 36193, "sourceUnit": 24836, "src": "662:71:136", "symbolAliases": [ { "foreign": 36153, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol", "file": "../protocol/lib/Monetary.sol", "id": 36156, "nodeType": "ImportDirective", "scope": 36193, "sourceUnit": 27761, "src": "734:56:136", "symbolAliases": [ { "foreign": 36155, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 36157, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24835, "src": "901:12:136", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$24835", "typeString": "contract IPriceOracle" } }, "id": 36158, "nodeType": "InheritanceSpecifier", "src": "901:12:136" } ], "contractDependencies": [ 24835 ], "contractKind": "contract", "documentation": "@title TestPriceOracle\n@author dYdX\n * Oracle used for testing", "fullyImplemented": true, "id": 36192, "linearizedBaseContracts": [ 36192, 24835 ], "name": "TestPriceOracle", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 36162, "name": "g_prices", "nodeType": "VariableDeclaration", "scope": 36192, "src": "921:44:136", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 36161, "keyType": { "id": 36159, "name": "address", "nodeType": "ElementaryTypeName", "src": "930:7:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "921:28:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 36160, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "941:7:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "body": { "id": 36175, "nodeType": "Block", "src": "1063:40:136", "statements": [ { "expression": { "argumentTypes": null, "id": 36173, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 36169, "name": "g_prices", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36162, "src": "1073:8:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 36171, "indexExpression": { "argumentTypes": null, "id": 36170, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36164, "src": "1082:5:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1073:15:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 36172, "name": "price", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36166, "src": "1091:5:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1073:23:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 36174, "nodeType": "ExpressionStatement", "src": "1073:23:136" } ] }, "documentation": null, "id": 36176, "implemented": true, "kind": "function", "modifiers": [], "name": "setPrice", "nodeType": "FunctionDefinition", "parameters": { "id": 36167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36164, "name": "token", "nodeType": "VariableDeclaration", "scope": 36176, "src": "999:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36163, "name": "address", "nodeType": "ElementaryTypeName", "src": "999:7:136", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 36166, "name": "price", "nodeType": "VariableDeclaration", "scope": 36176, "src": "1022:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 36165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1022:7:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "989:52:136" }, "returnParameters": { "id": 36168, "nodeType": "ParameterList", "parameters": [], "src": "1063:0:136" }, "scope": 36192, "src": "972:131:136", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": { "id": 36190, "nodeType": "Block", "src": "1228:86:136", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 36185, "name": "g_prices", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36162, "src": "1281:8:136", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 36187, "indexExpression": { "argumentTypes": null, "id": 36186, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36178, "src": "1290:5:136", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1281:15:136", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 36183, "name": "Monetary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 27760, "src": "1245:8:136", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Monetary_$27760_$", "typeString": "type(library Monetary)" } }, "id": 36184, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "Price", "nodeType": "MemberAccess", "referencedDeclaration": 27756, "src": "1245:14:136", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Price_$27756_storage_ptr_$", "typeString": "type(struct Monetary.Price storage pointer)" } }, "id": 36188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value" ], "nodeType": "FunctionCall", "src": "1245:62:136", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_memory", "typeString": "struct Monetary.Price memory" } }, "functionReturnParameters": 36182, "id": 36189, "nodeType": "Return", "src": "1238:69:136" } ] }, "documentation": null, "id": 36191, "implemented": true, "kind": "function", "modifiers": [], "name": "getPrice", "nodeType": "FunctionDefinition", "parameters": { "id": 36179, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36178, "name": "token", "nodeType": "VariableDeclaration", "scope": 36191, "src": "1136:13:136", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36177, "name": "address", "nodeType": "ElementaryTypeName", "src": "1136:7:136", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1126:29:136" }, "returnParameters": { "id": 36182, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36181, "name": "", "nodeType": "VariableDeclaration", "scope": 36191, "src": "1201:21:136", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_memory_ptr", "typeString": "struct Monetary.Price" }, "typeName": { "contractScope": null, "id": 36180, "name": "Monetary.Price", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27756, "src": "1201:14:136", "typeDescriptions": { "typeIdentifier": "t_struct$_Price_$27756_storage_ptr", "typeString": "struct Monetary.Price" } }, "value": null, "visibility": "internal" } ], "src": "1200:23:136" }, "scope": 36192, "src": "1109:205:136", "stateMutability": "view", "superFunction": 24834, "visibility": "public" } ], "scope": 36193, "src": "873:443:136" } ], "src": "603:714:136" }, "compiler": { "name": "solc", "version": "0.5.16+commit.9c3226ce.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.23", "updatedAt": "2026-03-02T16:38:29.118Z", "devdoc": { "author": "dYdX * Oracle used for testing", "methods": {}, "title": "TestPriceOracle" }, "userdoc": { "methods": {} } }