@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
482 lines • 21.8 kB
JSON
{
"contractName": "IInterestSetter",
"abi": [
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "borrowWei",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "supplyWei",
"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\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowWei\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"supplyWei\",\"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\"}],\"devdoc\":{\"author\":\"dYdX * Interface that Interest Setters for DolomiteMargin must implement in order to report interest rates.\",\"methods\":{\"getInterestRate(address,uint256,uint256)\":{\"params\":{\"borrowWei\":\"The total borrowed token amount for the market\",\"supplyWei\":\"The total supplied token amount for the market\",\"token\":\"The address of the ERC20 token for the market\"},\"return\":\"The interest rate per second\"}},\"title\":\"IInterestSetter\"},\"userdoc\":{\"methods\":{\"getInterestRate(address,uint256,uint256)\":{\"notice\":\"Get the interest rate of a token given some borrowed and supplied amounts\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol\":\"IInterestSetter\"},\"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\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"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 { Interest } from \"../lib/Interest.sol\";\n\n\n/**\n * @title IInterestSetter\n * @author dYdX\n *\n * Interface that Interest Setters for DolomiteMargin must implement in order to report interest rates.\n */\ninterface IInterestSetter {\n\n // ============ Public Functions ============\n\n /**\n * Get the interest rate of a token given some borrowed and supplied amounts\n *\n * @param token The address of the ERC20 token for the market\n * @param borrowWei The total borrowed token amount for the market\n * @param supplyWei The total supplied token amount for the market\n * @return The interest rate per second\n */\n function getInterestRate(\n address token,\n uint256 borrowWei,\n uint256 supplyWei\n )\n external\n view\n returns (Interest.Rate memory);\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol",
"exportedSymbols": {
"IInterestSetter": [
24789
]
},
"id": 24790,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24774,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:84"
},
{
"id": 24775,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:84"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Interest.sol",
"file": "../lib/Interest.sol",
"id": 24777,
"nodeType": "ImportDirective",
"scope": 24790,
"sourceUnit": 27751,
"src": "662:47:84",
"symbolAliases": [
{
"foreign": 24776,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IInterestSetter\n@author dYdX\n * Interface that Interest Setters for DolomiteMargin must implement in order to report interest rates.",
"fullyImplemented": false,
"id": 24789,
"linearizedBaseContracts": [
24789
],
"name": "IInterestSetter",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Get the interest rate of a token given some borrowed and supplied amounts\n * @param token The address of the ERC20 token for the market\n@param borrowWei The total borrowed token amount for the market\n@param supplyWei The total supplied token amount for the market\n@return The interest rate per second",
"id": 24788,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getInterestRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24784,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24779,
"name": "token",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1372:13:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24778,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1372:7:84",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24781,
"name": "borrowWei",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1395:17:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24780,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1395:7:84",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24783,
"name": "supplyWei",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1422:17:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24782,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1422:7:84",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1362:83:84"
},
"returnParameters": {
"id": 24787,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24786,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1493:20:84",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Rate_$27464_memory_ptr",
"typeString": "struct Interest.Rate"
},
"typeName": {
"contractScope": null,
"id": 24785,
"name": "Interest.Rate",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27464,
"src": "1493:13:84",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Rate_$27464_storage_ptr",
"typeString": "struct Interest.Rate"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1492:22:84"
},
"scope": 24789,
"src": "1338:177:84",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 24790,
"src": "869:648:84"
}
],
"src": "603:915:84"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IInterestSetter.sol",
"exportedSymbols": {
"IInterestSetter": [
24789
]
},
"id": 24790,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 24774,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:84"
},
{
"id": 24775,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:84"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Interest.sol",
"file": "../lib/Interest.sol",
"id": 24777,
"nodeType": "ImportDirective",
"scope": 24790,
"sourceUnit": 27751,
"src": "662:47:84",
"symbolAliases": [
{
"foreign": 24776,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "interface",
"documentation": "@title IInterestSetter\n@author dYdX\n * Interface that Interest Setters for DolomiteMargin must implement in order to report interest rates.",
"fullyImplemented": false,
"id": 24789,
"linearizedBaseContracts": [
24789
],
"name": "IInterestSetter",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": null,
"documentation": "Get the interest rate of a token given some borrowed and supplied amounts\n * @param token The address of the ERC20 token for the market\n@param borrowWei The total borrowed token amount for the market\n@param supplyWei The total supplied token amount for the market\n@return The interest rate per second",
"id": 24788,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "getInterestRate",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 24784,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24779,
"name": "token",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1372:13:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24778,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1372:7:84",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24781,
"name": "borrowWei",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1395:17:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24780,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1395:7:84",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 24783,
"name": "supplyWei",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1422:17:84",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24782,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1422:7:84",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1362:83:84"
},
"returnParameters": {
"id": 24787,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 24786,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 24788,
"src": "1493:20:84",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Rate_$27464_memory_ptr",
"typeString": "struct Interest.Rate"
},
"typeName": {
"contractScope": null,
"id": 24785,
"name": "Interest.Rate",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 27464,
"src": "1493:13:84",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Rate_$27464_storage_ptr",
"typeString": "struct Interest.Rate"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1492:22:84"
},
"scope": 24789,
"src": "1338:177:84",
"stateMutability": "view",
"superFunction": null,
"visibility": "external"
}
],
"scope": 24790,
"src": "869:648:84"
}
],
"src": "603:915:84"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2025-06-22T04:01:53.958Z",
"devdoc": {
"author": "dYdX * Interface that Interest Setters for DolomiteMargin must implement in order to report interest rates.",
"methods": {
"getInterestRate(address,uint256,uint256)": {
"params": {
"borrowWei": "The total borrowed token amount for the market",
"supplyWei": "The total supplied token amount for the market",
"token": "The address of the ERC20 token for the market"
},
"return": "The interest rate per second"
}
},
"title": "IInterestSetter"
},
"userdoc": {
"methods": {
"getInterestRate(address,uint256,uint256)": {
"notice": "Get the interest rate of a token given some borrowed and supplied amounts"
}
}
}
}