UNPKG

@dolomite-exchange/dolomite-margin

Version:

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

1,186 lines (1,185 loc) 71.6 kB
{ "contractName": "IChainlinkPriceOracleV1", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "stalenessDuration", "type": "uint256" } ], "name": "StalenessDurationUpdated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "token", "type": "address" }, { "indexed": true, "internalType": "address", "name": "aggregator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenPair", "type": "address" } ], "name": "TokenInsertedOrUpdated", "type": "event" }, { "constant": true, "inputs": [], "name": "ONE_DOLLAR", "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": "uint256", "name": "_stalenessThreshold", "type": "uint256" } ], "name": "ownerSetStalenessThreshold", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "_token", "type": "address" }, { "internalType": "uint8", "name": "_tokenDecimals", "type": "uint8" }, { "internalType": "address", "name": "_chainlinkAggregator", "type": "address" }, { "internalType": "address", "name": "_tokenPair", "type": "address" } ], "name": "ownerInsertOrUpdateOracleToken", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_token", "type": "address" } ], "name": "getAggregatorByToken", "outputs": [ { "internalType": "contract IChainlinkAggregator", "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_token", "type": "address" } ], "name": "getDecimalsByToken", "outputs": [ { "internalType": "uint8", "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_token", "type": "address" } ], "name": "getTokenPairByToken", "outputs": [ { "internalType": "address", "name": "_tokenPair", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "stalenessThreshold", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"stalenessDuration\",\"type\":\"uint256\"}],\"name\":\"StalenessDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenPair\",\"type\":\"address\"}],\"name\":\"TokenInsertedOrUpdated\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[],\"name\":\"ONE_DOLLAR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getAggregatorByToken\",\"outputs\":[{\"internalType\":\"contract IChainlinkAggregator\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getDecimalsByToken\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"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\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getTokenPairByToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_tokenPair\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_tokenDecimals\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"_chainlinkAggregator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenPair\",\"type\":\"address\"}],\"name\":\"ownerInsertOrUpdateOracleToken\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_stalenessThreshold\",\"type\":\"uint256\"}],\"name\":\"ownerSetStalenessThreshold\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"stalenessThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Dolomite * An implementation of the IPriceOracle interface that makes Chainlink prices compatible with the protocol.\",\"methods\":{\"getAggregatorByToken(address)\":{\"params\":{\"_token\":\"The token whose Chainlink aggregator should be retrieved\"},\"return\":\"The aggregator that corresponds with this token\"},\"getDecimalsByToken(address)\":{\"params\":{\"_token\":\"The token whose decimals should be retrieved\"},\"return\":\"The number of decimals that this token has\"},\"getPrice(address)\":{\"params\":{\"token\":\"The ERC20 token address of the market\"},\"return\":\"The USD price of a base unit of the token, then multiplied by 10^36. So a USD-stable coin with 18 decimal places would return 10^18. This is the price of the base unit rather than the price of a \\\"human-readable\\\" token amount. Every ERC20 may have a different number of decimals.\"},\"getTokenPairByToken(address)\":{\"params\":{\"_token\":\"The token whose token pair should be retrieved\"},\"return\":\"_tokenPair The token pair that corresponds with this token. The zero address means USD.\"},\"ownerInsertOrUpdateOracleToken(address,uint8,address,address)\":{\"details\":\"Insert or update a token in the oracle. This function can only be called by the owner of DolomiteMargin.\",\"params\":{\"_chainlinkAggregator\":\"The Chainlink aggregator that corresponds with this token\",\"_token\":\"The token whose Chainlink aggregator should be inserted or updated\",\"_tokenDecimals\":\"The number of decimals that this token has\",\"_tokenPair\":\"The token pair that corresponds with this token. The zero address means USD.\"}},\"ownerSetStalenessThreshold(uint256)\":{\"details\":\"Sets the new `stalenessThreshold`. This function can only be called by the owner of DolomiteMargin.\",\"params\":{\"_stalenessThreshold\":\"The duration of time that must pass before a price is considered stale from a Chainlink Aggregator\"}},\"stalenessThreshold()\":{\"return\":\"The duration of time that must pass before a price is considered stale from a Chainlink Aggregator\"}},\"title\":\"IChainlinkPriceOracleV1\"},\"userdoc\":{\"methods\":{\"getPrice(address)\":{\"notice\":\"Get the price of a token\"}}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkPriceOracleV1.sol\":\"IChainlinkPriceOracleV1\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkAccessControlAggregator.sol\":{\"keccak256\":\"0xbb94dc91633d6fb20e1d7e2b5ce1f11346e89a6bfc8c3ac5d163c35a3e4ad60a\",\"urls\":[\"bzz-raw://264c7c039caf44b1866769feb237010651730d546b54bb6f2b7bc77cf3b6c9c9\",\"dweb:/ipfs/QmX8TTF8E2G8TT1yig6qHC8amWDwaq1GG6iaKYTTHsYsjo\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkAggregator.sol\":{\"keccak256\":\"0x0209c9f35dbe82857a6441d8d61f271baeb5098549eabf5fc6d33503d0d3e073\",\"urls\":[\"bzz-raw://2f6af7b5198548a9a5e3d8a30203d7cd003eae93cca22b8466c10e0dcfcbc367\",\"dweb:/ipfs/Qme3bQ58ZoQLYDoJQHnvEeQZqgqyWTFBYBmMoiem7LPXmz\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkPriceOracleV1.sol\":{\"keccak256\":\"0x9dc8cb0802ae0aaef49c0864220968e737e99c58aea1414b3451c32213b818df\",\"urls\":[\"bzz-raw://1124837a46ab2bbb07918f72c68adf7cdb13f146b92c48b1a0fadb39c37809e8\",\"dweb:/ipfs/QmSM21AJAfN3oRXebs6pc2YWGPgfZHbGPL6QkMCjG1vKiu\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol\":{\"keccak256\":\"0x3f7c3d1397390ea44c6d5e5730d49476431c3df3b28334fe38218de5edc31138\",\"urls\":[\"bzz-raw://63ebf926fca9ce33aaabaf93805686acc25daded1648d6dab59c8c4d05116918\",\"dweb:/ipfs/QmeGkDp7ycYstpfqCYBiqoCYwy876gabx8r42o5koj3H5A\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Monetary.sol\":{\"keccak256\":\"0x5257274f2d4d3605f3e97ec45fb902111fe9a22506f0b4cf308ea933bc81bfe2\",\"urls\":[\"bzz-raw://85b8023b78805063a2ec8d376f1f5983994eabd96efd8ceadb0224dbb71c5678\",\"dweb:/ipfs/QmaDhzCzRqsuHuJfhToEC4pATQHwhh7yWWsjwfuRzFT1kG\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "/*\n\n Copyright 2020 Dolomite.\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\";\n\nimport { IChainlinkAggregator } from \"../interfaces/IChainlinkAggregator.sol\";\n\n\n/**\n * @title IChainlinkPriceOracleV1\n * @author Dolomite\n *\n * An implementation of the IPriceOracle interface that makes Chainlink prices compatible with the protocol.\n */\ncontract IChainlinkPriceOracleV1 is IPriceOracle {\n\n // ============ Events ============\n\n event StalenessDurationUpdated(uint256 stalenessDuration);\n\n event TokenInsertedOrUpdated(\n address indexed token,\n address indexed aggregator,\n address indexed tokenPair\n );\n\n // ============ Admin Functions ============\n\n /**\n * @dev Sets the new `stalenessThreshold`. This function can only be called by the owner of DolomiteMargin.\n *\n * @param _stalenessThreshold The duration of time that must pass before a price is considered stale from a\n * Chainlink Aggregator\n */\n function ownerSetStalenessThreshold(\n uint256 _stalenessThreshold\n )\n external;\n\n /**\n * @dev Insert or update a token in the oracle. This function can only be called by the owner of DolomiteMargin.\n *\n * @param _token The token whose Chainlink aggregator should be inserted or updated\n * @param _tokenDecimals The number of decimals that this token has\n * @param _chainlinkAggregator The Chainlink aggregator that corresponds with this token\n * @param _tokenPair The token pair that corresponds with this token. The zero address means USD.\n */\n function ownerInsertOrUpdateOracleToken(\n address _token,\n uint8 _tokenDecimals,\n address _chainlinkAggregator,\n address _tokenPair\n )\n external;\n\n // ============ Getter Functions ============\n\n /**\n *\n * @param _token The token whose Chainlink aggregator should be retrieved\n * @return The aggregator that corresponds with this token\n */\n function getAggregatorByToken(address _token) external view returns (IChainlinkAggregator);\n\n /**\n * @param _token The token whose decimals should be retrieved\n * @return The number of decimals that this token has\n */\n function getDecimalsByToken(address _token) external view returns (uint8);\n\n /**\n * @param _token The token whose token pair should be retrieved\n * @return _tokenPair The token pair that corresponds with this token. The zero address means USD.\n */\n function getTokenPairByToken(address _token) external view returns (address _tokenPair);\n\n /**\n * @return The duration of time that must pass before a price is considered stale from a Chainlink Aggregator\n */\n function stalenessThreshold() external view returns (uint256);\n}\n", "sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkPriceOracleV1.sol", "ast": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkPriceOracleV1.sol", "exportedSymbols": { "IChainlinkPriceOracleV1": [ 4272 ] }, "id": 4273, "nodeType": "SourceUnit", "nodes": [ { "id": 4210, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:21" }, { "id": 4211, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "619:33:21" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol", "file": "../../protocol/interfaces/IPriceOracle.sol", "id": 4213, "nodeType": "ImportDirective", "scope": 4273, "sourceUnit": 24836, "src": "654:74:21", "symbolAliases": [ { "foreign": 4212, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkAggregator.sol", "file": "../interfaces/IChainlinkAggregator.sol", "id": 4215, "nodeType": "ImportDirective", "scope": 4273, "sourceUnit": 4191, "src": "730:78:21", "symbolAliases": [ { "foreign": 4214, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4216, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24835, "src": "1021:12:21", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$24835", "typeString": "contract IPriceOracle" } }, "id": 4217, "nodeType": "InheritanceSpecifier", "src": "1021:12:21" } ], "contractDependencies": [ 24835 ], "contractKind": "contract", "documentation": "@title IChainlinkPriceOracleV1\n@author Dolomite\n * An implementation of the IPriceOracle interface that makes Chainlink prices compatible with the protocol.", "fullyImplemented": false, "id": 4272, "linearizedBaseContracts": [ 4272, 24835 ], "name": "IChainlinkPriceOracleV1", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 4221, "name": "StalenessDurationUpdated", "nodeType": "EventDefinition", "parameters": { "id": 4220, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4219, "indexed": false, "name": "stalenessDuration", "nodeType": "VariableDeclaration", "scope": 4221, "src": "1113:25:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4218, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1113:7:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1112:27:21" }, "src": "1082:58:21" }, { "anonymous": false, "documentation": null, "id": 4229, "name": "TokenInsertedOrUpdated", "nodeType": "EventDefinition", "parameters": { "id": 4228, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4223, "indexed": true, "name": "token", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1184:21:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4222, "name": "address", "nodeType": "ElementaryTypeName", "src": "1184:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4225, "indexed": true, "name": "aggregator", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1215:26:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4224, "name": "address", "nodeType": "ElementaryTypeName", "src": "1215:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4227, "indexed": true, "name": "tokenPair", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1251:25:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4226, "name": "address", "nodeType": "ElementaryTypeName", "src": "1251:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1174:108:21" }, "src": "1146:137:21" }, { "body": null, "documentation": "@dev Sets the new `stalenessThreshold`. This function can only be called by the owner of DolomiteMargin.\n * @param _stalenessThreshold The duration of time that must pass before a price is considered stale from a\n Chainlink Aggregator", "id": 4234, "implemented": false, "kind": "function", "modifiers": [], "name": "ownerSetStalenessThreshold", "nodeType": "FunctionDefinition", "parameters": { "id": 4232, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4231, "name": "_stalenessThreshold", "nodeType": "VariableDeclaration", "scope": 4234, "src": "1690:27:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4230, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1690:7:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1680:43:21" }, "returnParameters": { "id": 4233, "nodeType": "ParameterList", "parameters": [], "src": "1740:0:21" }, "scope": 4272, "src": "1645:96:21", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@dev Insert or update a token in the oracle. This function can only be called by the owner of DolomiteMargin.\n * @param _token The token whose Chainlink aggregator should be inserted or updated\n@param _tokenDecimals The number of decimals that this token has\n@param _chainlinkAggregator The Chainlink aggregator that corresponds with this token\n@param _tokenPair The token pair that corresponds with this token. The zero address means USD.", "id": 4245, "implemented": false, "kind": "function", "modifiers": [], "name": "ownerInsertOrUpdateOracleToken", "nodeType": "FunctionDefinition", "parameters": { "id": 4243, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4236, "name": "_token", "nodeType": "VariableDeclaration", "scope": 4245, "src": "2325:14:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4235, "name": "address", "nodeType": "ElementaryTypeName", "src": "2325:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4238, "name": "_tokenDecimals", "nodeType": "VariableDeclaration", "scope": 4245, "src": "2349:20:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 4237, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "2349:5:21", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4240, "name": "_chainlinkAggregator", "nodeType": "VariableDeclaration", "scope": 4245, "src": "2379:28:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4239, "name": "address", "nodeType": "ElementaryTypeName", "src": "2379:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4242, "name": "_tokenPair", "nodeType": "VariableDeclaration", "scope": 4245, "src": "2417:18:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4241, "name": "address", "nodeType": "ElementaryTypeName", "src": "2417:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2315:126:21" }, "returnParameters": { "id": 4244, "nodeType": "ParameterList", "parameters": [], "src": "2458:0:21" }, "scope": 4272, "src": "2276:183:21", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": " * @param _token The token whose Chainlink aggregator should be retrieved\n@return The aggregator that corresponds with this token", "id": 4252, "implemented": false, "kind": "function", "modifiers": [], "name": "getAggregatorByToken", "nodeType": "FunctionDefinition", "parameters": { "id": 4248, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4247, "name": "_token", "nodeType": "VariableDeclaration", "scope": 4252, "src": "2720:14:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4246, "name": "address", "nodeType": "ElementaryTypeName", "src": "2720:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2719:16:21" }, "returnParameters": { "id": 4251, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4250, "name": "", "nodeType": "VariableDeclaration", "scope": 4252, "src": "2759:20:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkAggregator_$4190", "typeString": "contract IChainlinkAggregator" }, "typeName": { "contractScope": null, "id": 4249, "name": "IChainlinkAggregator", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4190, "src": "2759:20:21", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkAggregator_$4190", "typeString": "contract IChainlinkAggregator" } }, "value": null, "visibility": "internal" } ], "src": "2758:22:21" }, "scope": 4272, "src": "2690:91:21", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@param _token The token whose decimals should be retrieved\n@return The number of decimals that this token has", "id": 4259, "implemented": false, "kind": "function", "modifiers": [], "name": "getDecimalsByToken", "nodeType": "FunctionDefinition", "parameters": { "id": 4255, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4254, "name": "_token", "nodeType": "VariableDeclaration", "scope": 4259, "src": "2963:14:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4253, "name": "address", "nodeType": "ElementaryTypeName", "src": "2963:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2962:16:21" }, "returnParameters": { "id": 4258, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4257, "name": "", "nodeType": "VariableDeclaration", "scope": 4259, "src": "3002:5:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 4256, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "3002:5:21", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "src": "3001:7:21" }, "scope": 4272, "src": "2935:74:21", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@param _token The token whose token pair should be retrieved\n@return _tokenPair The token pair that corresponds with this token. The zero address means USD.", "id": 4266, "implemented": false, "kind": "function", "modifiers": [], "name": "getTokenPairByToken", "nodeType": "FunctionDefinition", "parameters": { "id": 4262, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4261, "name": "_token", "nodeType": "VariableDeclaration", "scope": 4266, "src": "3240:14:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4260, "name": "address", "nodeType": "ElementaryTypeName", "src": "3240:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "3239:16:21" }, "returnParameters": { "id": 4265, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4264, "name": "_tokenPair", "nodeType": "VariableDeclaration", "scope": 4266, "src": "3279:18:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4263, "name": "address", "nodeType": "ElementaryTypeName", "src": "3279:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "3278:20:21" }, "scope": 4272, "src": "3211:88:21", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": null, "documentation": "@return The duration of time that must pass before a price is considered stale from a Chainlink Aggregator", "id": 4271, "implemented": false, "kind": "function", "modifiers": [], "name": "stalenessThreshold", "nodeType": "FunctionDefinition", "parameters": { "id": 4267, "nodeType": "ParameterList", "parameters": [], "src": "3462:2:21" }, "returnParameters": { "id": 4270, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4269, "name": "", "nodeType": "VariableDeclaration", "scope": 4271, "src": "3488:7:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4268, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3488:7:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3487:9:21" }, "scope": 4272, "src": "3435:62:21", "stateMutability": "view", "superFunction": null, "visibility": "external" } ], "scope": 4273, "src": "985:2514:21" } ], "src": "595:2905:21" }, "legacyAST": { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkPriceOracleV1.sol", "exportedSymbols": { "IChainlinkPriceOracleV1": [ 4272 ] }, "id": 4273, "nodeType": "SourceUnit", "nodes": [ { "id": 4210, "literals": [ "solidity", "^", "0.5", ".7" ], "nodeType": "PragmaDirective", "src": "595:23:21" }, { "id": 4211, "literals": [ "experimental", "ABIEncoderV2" ], "nodeType": "PragmaDirective", "src": "619:33:21" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IPriceOracle.sol", "file": "../../protocol/interfaces/IPriceOracle.sol", "id": 4213, "nodeType": "ImportDirective", "scope": 4273, "sourceUnit": 24836, "src": "654:74:21", "symbolAliases": [ { "foreign": 4212, "local": null } ], "unitAlias": "" }, { "absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/external/interfaces/IChainlinkAggregator.sol", "file": "../interfaces/IChainlinkAggregator.sol", "id": 4215, "nodeType": "ImportDirective", "scope": 4273, "sourceUnit": 4191, "src": "730:78:21", "symbolAliases": [ { "foreign": 4214, "local": null } ], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4216, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 24835, "src": "1021:12:21", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$24835", "typeString": "contract IPriceOracle" } }, "id": 4217, "nodeType": "InheritanceSpecifier", "src": "1021:12:21" } ], "contractDependencies": [ 24835 ], "contractKind": "contract", "documentation": "@title IChainlinkPriceOracleV1\n@author Dolomite\n * An implementation of the IPriceOracle interface that makes Chainlink prices compatible with the protocol.", "fullyImplemented": false, "id": 4272, "linearizedBaseContracts": [ 4272, 24835 ], "name": "IChainlinkPriceOracleV1", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 4221, "name": "StalenessDurationUpdated", "nodeType": "EventDefinition", "parameters": { "id": 4220, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4219, "indexed": false, "name": "stalenessDuration", "nodeType": "VariableDeclaration", "scope": 4221, "src": "1113:25:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4218, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1113:7:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1112:27:21" }, "src": "1082:58:21" }, { "anonymous": false, "documentation": null, "id": 4229, "name": "TokenInsertedOrUpdated", "nodeType": "EventDefinition", "parameters": { "id": 4228, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4223, "indexed": true, "name": "token", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1184:21:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4222, "name": "address", "nodeType": "ElementaryTypeName", "src": "1184:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4225, "indexed": true, "name": "aggregator", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1215:26:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4224, "name": "address", "nodeType": "ElementaryTypeName", "src": "1215:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4227, "indexed": true, "name": "tokenPair", "nodeType": "VariableDeclaration", "scope": 4229, "src": "1251:25:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4226, "name": "address", "nodeType": "ElementaryTypeName", "src": "1251:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }