UNPKG

@dolomite-exchange/dolomite-margin

Version:

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

1,105 lines 51.2 kB
{ "contractName": "TestInterestSetter", "abi": [ { "constant": true, "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "g_interestRates", "outputs": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Interest.Rate", "name": "rate", "type": "tuple" } ], "name": "setInterestRate", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "getInterestRate", "outputs": [ { "components": [ { "internalType": "uint256", "name": "value", "type": "uint256" } ], "internalType": "struct Interest.Rate", "name": "", "type": "tuple" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"g_interestRates\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"getInterestRate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Interest.Rate\",\"name\":\"\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct Interest.Rate\",\"name\":\"rate\",\"type\":\"tuple\"}],\"name\":\"setInterestRate\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"dYdX * Interest setter used for testing that always returns a constant interest rate\",\"methods\":{},\"title\":\"TestInterestSetter\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/testing/TestInterestSetter.sol\":\"TestInterestSetter\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol\":{\"keccak256\":\"0x546825f65490a30e29d0f6446acec49c1e895ce6b33d48ca5c05092725a63a57\",\"urls\":[\"bzz-raw://6ad3013aed985bdf6e6234ae0f7f37e6bba76c3470c33bfa24678cf19b3b412c\",\"dweb:/ipfs/QmfYaSBzxGpgiHoR7ontMJY66S5L26XwkLYoEuzsEjpbQH\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Decimal.sol\":{\"keccak256\":\"0xd9a348c2b1eec076609ba12bbec6b9c2e4ea135790a7ef4f5411feb050af2144\",\"urls\":[\"bzz-raw://d5bcff29e47d5cd02d7a9966e9f44c46ccbb4f0e4adfc4b0b86646880677db39\",\"dweb:/ipfs/QmRKfJD4FFM1AvTynSFNx1NcDg94o9SAcjz7dvMaJCfecp\"]},\"/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/Interest.sol\":{\"keccak256\":\"0x141a0ecb4a746f0e5767df4b99dbe33c6362df507ae9d5c02da1c1c17bc26df3\",\"urls\":[\"bzz-raw://9ff03e64a8ce5231acde07788624bf8c7a8ff55d90b157fa32f62fa887a0eff0\",\"dweb:/ipfs/QmUVxxWeE954RDXbmHJAYnHsXcit6rSXGqZUigu8t9oH2z\"]},\"/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/Time.sol\":{\"keccak256\":\"0x87ee8d3c1d6e315a116426d8c8fc6f083e220fd14dda27fad4e8d7cab3dc7305\",\"urls\":[\"bzz-raw://7c20f2c52da682c3b5917fb6a19e81f43699b1d13c62b569ed723f34da72e766\",\"dweb:/ipfs/QmbXWYXi67nHBVNDKYUpo2E9ZaEVcHLvmXQkpYLMm1d5Vm\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Types.sol\":{\"keccak256\":\"0xe1bab8c8799d83e86c7a49aaf815d8e3bc8d09562d46d44d921500db5e98de0e\",\"urls\":[\"bzz-raw://8ea3d0cc4fdab6dd9bba545a792170f939b342d8d1a7051c1c6365009af72658\",\"dweb:/ipfs/QmaLJgbavu88eEit6JPqfWnw6NmGBDZfveMXxumgWywBFG\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/testing/TestInterestSetter.sol\":{\"keccak256\":\"0xca9371b80baa5d98d584c8a4238fc3dd3dca410dfe385633467f1288bd99bcf6\",\"urls\":[\"bzz-raw://dde12dbe9846a897f0dfeb7f549ded0e3807615e703a0a9c9da195dafec81c64\",\"dweb:/ipfs/QmYijwLFkKbH8M9A6vkeH4gxxR38Sp5fwxaxESiJHdYREF\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5061031e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806301fb557c146100465780638f8da8891461006f578063e8177dcf14610084575b600080fd5b610059610054366004610184565b6100a4565b6040516100669190610265565b60405180910390f35b61008261007d3660046101aa565b6100b6565b005b6100976100923660046101e4565b6100e2565b6040516100669190610257565b60006020819052908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff909116600090815260208190526040902090519055565b6100ea610122565b50505073ffffffffffffffffffffffffffffffffffffffff166000908152602081815260409182902082519182019092529054815290565b6040518060200160405280600081525090565b8035610140816102bb565b92915050565b60006020828403121561015857600080fd5b6101626020610273565b905060006101708484610179565b82525092915050565b8035610140816102d2565b60006020828403121561019657600080fd5b60006101a28484610135565b949350505050565b600080604083850312156101bd57600080fd5b60006101c98585610135565b92505060206101da85828601610146565b9150509250929050565b6000806000606084860312156101f957600080fd5b60006102058686610135565b935050602061021686828701610179565b925050604061022786828701610179565b9150509250925092565b805160208301906102428482610248565b50505050565b610251816102b8565b82525050565b602081016101408284610231565b602081016101408284610248565b60405181810167ffffffffffffffff8111828210171561029257600080fd5b604052919050565b600073ffffffffffffffffffffffffffffffffffffffff8216610140565b90565b6102c48161029a565b81146102cf57600080fd5b50565b6102c4816102b856fea365627a7a72315820496a8ba785233191e50815130087ca50dab4b2f6363b7d4b407a67bf878975eb6c6578706572696d656e74616cf564736f6c63430005100040", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806301fb557c146100465780638f8da8891461006f578063e8177dcf14610084575b600080fd5b610059610054366004610184565b6100a4565b6040516100669190610265565b60405180910390f35b61008261007d3660046101aa565b6100b6565b005b6100976100923660046101e4565b6100e2565b6040516100669190610257565b60006020819052908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff909116600090815260208190526040902090519055565b6100ea610122565b50505073ffffffffffffffffffffffffffffffffffffffff166000908152602081815260409182902082519182019092529054815290565b6040518060200160405280600081525090565b8035610140816102bb565b92915050565b60006020828403121561015857600080fd5b6101626020610273565b905060006101708484610179565b82525092915050565b8035610140816102d2565b60006020828403121561019657600080fd5b60006101a28484610135565b949350505050565b600080604083850312156101bd57600080fd5b60006101c98585610135565b92505060206101da85828601610146565b9150509250929050565b6000806000606084860312156101f957600080fd5b60006102058686610135565b935050602061021686828701610179565b925050604061022786828701610179565b9150509250925092565b805160208301906102428482610248565b50505050565b610251816102b8565b82525050565b602081016101408284610231565b602081016101408284610248565b60405181810167ffffffffffffffff8111828210171561029257600080fd5b604052919050565b600073ffffffffffffffffffffffffffffffffffffffff8216610140565b90565b6102c48161029a565b81146102cf57600080fd5b50565b6102c4816102b856fea365627a7a72315820496a8ba785233191e50815130087ca50dab4b2f6363b7d4b407a67bf878975eb6c6578706572696d656e74616cf564736f6c63430005100040", "sourceMap": "1006:520:123:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1006:520:123;;;;;;;", "deployedSourceMap": "1006:520:123:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1006:520:123;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1063:57;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;1127:154;;;;;;;;;:::i;:::-;;1287:237;;;;;;;;;:::i;:::-;;;;;;;;1063:57;;;;;;;;;;;;;;:::o;1127:154::-;1245:22;;;;:15;:22;;;;;;;;;;:29;;;;1127:154::o;1287:237::-;1452:20;;:::i;:::-;-1:-1:-1;;;1495:22:123;;:15;:22;;;;;;;;;;;;1488:29;;;;;;;;;;;;;1287:237::o;1006:520::-;;;;;;;;;;;;;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;;57:78;;;;;169:322;;281:4;269:9;264:3;260:19;256:30;253:2;;;299:1;296;289:12;253:2;317:20;332:4;317:20;;;308:29;-1:-1;388:1;420:49;465:3;445:9;420:49;;;395:75;;-1:-1;406:5;247:244;-1:-1;;247:244;498:130;565:20;;590:33;565:20;590:33;;635:241;;739:2;727:9;718:7;714:23;710:32;707:2;;;755:1;752;745:12;707:2;790:1;807:53;852:7;832:9;807:53;;;797:63;701:175;-1:-1;;;;701:175;883:412;;;1027:2;1015:9;1006:7;1002:23;998:32;995:2;;;1043:1;1040;1033:12;995:2;1078:1;1095:53;1140:7;1120:9;1095:53;;;1085:63;;1057:97;1185:2;1203:76;1271:7;1262:6;1251:9;1247:22;1203:76;;;1193:86;;1164:121;989:306;;;;;;1302:491;;;;1440:2;1428:9;1419:7;1415:23;1411:32;1408:2;;;1456:1;1453;1446:12;1408:2;1491:1;1508:53;1553:7;1533:9;1508:53;;;1498:63;;1470:97;1598:2;1616:53;1661:7;1652:6;1641:9;1637:22;1616:53;;;1606:63;;1577:98;1706:2;1724:53;1769:7;1760:6;1749:9;1745:22;1724:53;;;1714:63;;1685:98;1402:391;;;;;;1851:319;2057:23;;1990:4;1981:14;;;2086:63;1985:3;2057:23;2086:63;;;2010:145;1963:207;;;;2177:103;2250:24;2268:5;2250:24;;;2245:3;2238:37;2232:48;;;2407:305;2571:2;2556:18;;2585:117;2560:9;2675:6;2585:117;;2719:213;2837:2;2822:18;;2851:71;2826:9;2895:6;2851:71;;2939:256;3001:2;2995:9;3027:17;;;3102:18;3087:34;;3123:22;;;3084:62;3081:2;;;3159:1;3156;3149:12;3081:2;3175;3168:22;2979:216;;-1:-1;2979:216;3202:91;;3373:42;3362:54;;3264:24;3345:76;3428:72;3490:5;3473:27;3507:117;3576:24;3594:5;3576:24;;;3569:5;3566:35;3556:2;;3615:1;3612;3605:12;3556:2;3550:74;;3631:117;3700:24;3718:5;3700: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 { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { IInterestSetter } from \"../protocol/interfaces/IInterestSetter.sol\";\nimport { Interest } from \"../protocol/lib/Interest.sol\";\n\n\n/**\n * @title TestInterestSetter\n * @author dYdX\n *\n * Interest setter used for testing that always returns a constant interest rate\n */\ncontract TestInterestSetter is\n IInterestSetter\n{\n mapping (address => Interest.Rate) public g_interestRates;\n\n function setInterestRate(\n address token,\n Interest.Rate memory rate\n )\n public\n {\n g_interestRates[token] = rate;\n }\n\n function getInterestRate(\n address token,\n uint256 /* borrowWei */,\n uint256 /* supplyWei */\n )\n public\n view\n returns (Interest.Rate memory)\n {\n return g_interestRates[token];\n }\n}\n", "sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/testing/TestInterestSetter.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/testing/TestInterestSetter.sol", "exportedSymbols": { "TestInterestSetter": [ 34024 ] }, "id": 34025, "nodeType": "SourceUnit", "nodes": [ { "id": 33980, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:123" }, { "id": 33981, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:123" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "@openzeppelin/contracts/math/SafeMath.sol", "id": 33983, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 37366, "src": "662:69:123", "symbolAliases": [ { "foreign": 33982, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol", "file": "../protocol/interfaces/IInterestSetter.sol", "id": 33985, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 24790, "src": "732:77:123", "symbolAliases": [ { "foreign": 33984, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Interest.sol", "file": "../protocol/lib/Interest.sol", "id": 33987, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 27751, "src": "810:56:123", "symbolAliases": [ { "foreign": 33986, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 33988, "name": "IInterestSetter", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24789, "src": "1041:15:123", "typeDescriptions": { "typeIdentifier": "t_contract$_IInterestSetter_$24789", "typeString": "contract IInterestSetter" } }, "id": 33989, "nodeType": "InheritanceSpecifier", "src": "1041:15:123" } ], "contractDependencies": [ 24789 ], "contractKind": "contract", "documentation": "@title TestInterestSetter\n@author dYdX\n * Interest setter used for testing that always returns a constant interest rate", "fullyImplemented": true, "id": 34024, "linearizedBaseContracts": [ 34024, 24789 ], "name": "TestInterestSetter", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 33993, "name": "g_interestRates", "nodeType": "VariableDeclaration", "scope": 34024, "src": "1063:57:123", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate)" }, "typeName": { "id": 33992, "keyType": { "id": 33990, "name": "address", "nodeType": "ElementaryTypeName", "src": "1072:7:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1063:34:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate)" }, "valueType": { "contractScope": null, "id": 33991, "name": "Interest.Rate", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27464, "src": "1083:13:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage_ptr", "typeString": "struct Interest.Rate" } } }, "value": null, "visibility": "public" }, { "body": { "id": 34006, "nodeType": "Block", "src": "1235:46:123", "statements": [ { "expression": { "argumentTypes": null, "id": 34004, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 34000, "name": "g_interestRates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33993, "src": "1245:15:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate storage ref)" } }, "id": 34002, "indexExpression": { "argumentTypes": null, "id": 34001, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33995, "src": "1261:5:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1245:22:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 34003, "name": "rate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33997, "src": "1270:4:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate memory" } }, "src": "1245:29:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "id": 34005, "nodeType": "ExpressionStatement", "src": "1245:29:123" } ] }, "documentation": null, "id": 34007, "implemented": true, "kind": "function", "modifiers": [], "name": "setInterestRate", "nodeType": "FunctionDefinition", "parameters": { "id": 33998, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 33995, "name": "token", "nodeType": "VariableDeclaration", "scope": 34007, "src": "1161:13:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 33994, "name": "address", "nodeType": "ElementaryTypeName", "src": "1161:7:123", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 33997, "name": "rate", "nodeType": "VariableDeclaration", "scope": 34007, "src": "1184:25:123", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate" }, "typeName": { "contractScope": null, "id": 33996, "name": "Interest.Rate", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27464, "src": "1184:13:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage_ptr", "typeString": "struct Interest.Rate" } }, "value": null, "visibility": "internal" } ], "src": "1151:64:123" }, "returnParameters": { "id": 33999, "nodeType": "ParameterList", "parameters": [], "src": "1235:0:123" }, "scope": 34024, "src": "1127:154:123", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 34022, "nodeType": "Block", "src": "1478:46:123", "statements": [ { "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 34018, "name": "g_interestRates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33993, "src": "1495:15:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate storage ref)" } }, "id": 34020, "indexExpression": { "argumentTypes": null, "id": 34019, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34009, "src": "1511:5:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1495:22:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "functionReturnParameters": 34017, "id": 34021, "nodeType": "Return", "src": "1488:29:123" } ] }, "documentation": null, "id": 34023, "implemented": true, "kind": "function", "modifiers": [], "name": "getInterestRate", "nodeType": "FunctionDefinition", "parameters": { "id": 34014, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 34009, "name": "token", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1321:13:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 34008, "name": "address", "nodeType": "ElementaryTypeName", "src": "1321:7:123", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 34011, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1344:7:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 34010, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1344:7:123", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 34013, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1377:7:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 34012, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1377:7:123", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1311:95:123" }, "returnParameters": { "id": 34017, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 34016, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1452:20:123", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate" }, "typeName": { "contractScope": null, "id": 34015, "name": "Interest.Rate", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27464, "src": "1452:13:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage_ptr", "typeString": "struct Interest.Rate" } }, "value": null, "visibility": "internal" } ], "src": "1451:22:123" }, "scope": 34024, "src": "1287:237:123", "stateMutability": "view", "superFunction": 24788, "visibility": "public" } ], "scope": 34025, "src": "1006:520:123" } ], "src": "603:924:123" }, "legacyAST": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/testing/TestInterestSetter.sol", "exportedSymbols": { "TestInterestSetter": [ 34024 ] }, "id": 34025, "nodeType": "SourceUnit", "nodes": [ { "id": 33980, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "603:23:123" }, { "id": 33981, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "627:33:123" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "@openzeppelin/contracts/math/SafeMath.sol", "id": 33983, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 37366, "src": "662:69:123", "symbolAliases": [ { "foreign": 33982, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol", "file": "../protocol/interfaces/IInterestSetter.sol", "id": 33985, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 24790, "src": "732:77:123", "symbolAliases": [ { "foreign": 33984, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Interest.sol", "file": "../protocol/lib/Interest.sol", "id": 33987, "nodeType": "ImportDirective", "scope": 34025, "sourceUnit": 27751, "src": "810:56:123", "symbolAliases": [ { "foreign": 33986, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 33988, "name": "IInterestSetter", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24789, "src": "1041:15:123", "typeDescriptions": { "typeIdentifier": "t_contract$_IInterestSetter_$24789", "typeString": "contract IInterestSetter" } }, "id": 33989, "nodeType": "InheritanceSpecifier", "src": "1041:15:123" } ], "contractDependencies": [ 24789 ], "contractKind": "contract", "documentation": "@title TestInterestSetter\n@author dYdX\n * Interest setter used for testing that always returns a constant interest rate", "fullyImplemented": true, "id": 34024, "linearizedBaseContracts": [ 34024, 24789 ], "name": "TestInterestSetter", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 33993, "name": "g_interestRates", "nodeType": "VariableDeclaration", "scope": 34024, "src": "1063:57:123", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate)" }, "typeName": { "id": 33992, "keyType": { "id": 33990, "name": "address", "nodeType": "ElementaryTypeName", "src": "1072:7:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1063:34:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate)" }, "valueType": { "contractScope": null, "id": 33991, "name": "Interest.Rate", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27464, "src": "1083:13:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage_ptr", "typeString": "struct Interest.Rate" } } }, "value": null, "visibility": "public" }, { "body": { "id": 34006, "nodeType": "Block", "src": "1235:46:123", "statements": [ { "expression": { "argumentTypes": null, "id": 34004, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 34000, "name": "g_interestRates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33993, "src": "1245:15:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate storage ref)" } }, "id": 34002, "indexExpression": { "argumentTypes": null, "id": 34001, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33995, "src": "1261:5:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1245:22:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 34003, "name": "rate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33997, "src": "1270:4:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate memory" } }, "src": "1245:29:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "id": 34005, "nodeType": "ExpressionStatement", "src": "1245:29:123" } ] }, "documentation": null, "id": 34007, "implemented": true, "kind": "function", "modifiers": [], "name": "setInterestRate", "nodeType": "FunctionDefinition", "parameters": { "id": 33998, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 33995, "name": "token", "nodeType": "VariableDeclaration", "scope": 34007, "src": "1161:13:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 33994, "name": "address", "nodeType": "ElementaryTypeName", "src": "1161:7:123", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 33997, "name": "rate", "nodeType": "VariableDeclaration", "scope": 34007, "src": "1184:25:123", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate" }, "typeName": { "contractScope": null, "id": 33996, "name": "Interest.Rate", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 27464, "src": "1184:13:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage_ptr", "typeString": "struct Interest.Rate" } }, "value": null, "visibility": "internal" } ], "src": "1151:64:123" }, "returnParameters": { "id": 33999, "nodeType": "ParameterList", "parameters": [], "src": "1235:0:123" }, "scope": 34024, "src": "1127:154:123", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 34022, "nodeType": "Block", "src": "1478:46:123", "statements": [ { "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 34018, "name": "g_interestRates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 33993, "src": "1495:15:123", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Rate_$27464_storage_$", "typeString": "mapping(address => struct Interest.Rate storage ref)" } }, "id": 34020, "indexExpression": { "argumentTypes": null, "id": 34019, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34009, "src": "1511:5:123", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1495:22:123", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_storage", "typeString": "struct Interest.Rate storage ref" } }, "functionReturnParameters": 34017, "id": 34021, "nodeType": "Return", "src": "1488:29:123" } ] }, "documentation": null, "id": 34023, "implemented": true, "kind": "function", "modifiers": [], "name": "getInterestRate", "nodeType": "FunctionDefinition", "parameters": { "id": 34014, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 34009, "name": "token", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1321:13:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 34008, "name": "address", "nodeType": "ElementaryTypeName", "src": "1321:7:123", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 34011, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1344:7:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 34010, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1344:7:123", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 34013, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1377:7:123", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 34012, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1377:7:123", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1311:95:123" }, "returnParameters": { "id": 34017, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 34016, "name": "", "nodeType": "VariableDeclaration", "scope": 34023, "src": "1452:20:123", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Rate_$27464_memory_ptr", "typeString": "struct Interest.Rate" }, "typeName": { "contractScope": null, "id": 34015, "name": "Interest.Rate", "nodeType": "Use