{ "contractName": "PriceOracle", "abi": [ { "inputs": [ { "internalType": "contract IERC20Token", "name": "_tokenA", "type": "address" }, { "internalType": "contract IERC20Token", "name": "_tokenB", "type": "address" }, { "internalType": "contract IChainlinkPriceOracle", "name": "_tokenAOracle", "type": "address" }, { "internalType": "contract IChainlinkPriceOracle", "name": "_tokenBOracle", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "tokenA", "outputs": [ { "internalType": "contract IERC20Token", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "tokenAOracle", "outputs": [ { "internalType": "contract IChainlinkPriceOracle", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "tokenB", "outputs": [ { "internalType": "contract IERC20Token", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "tokenBOracle", "outputs": [ { "internalType": "contract IChainlinkPriceOracle", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract IERC20Token", "name": "", "type": "address" } ], "name": "tokenDecimals", "outputs": [ { "internalType": "uint8", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract IERC20Token", "name": "", "type": "address" } ], "name": "tokensToOracles", "outputs": [ { "internalType": "contract IChainlinkPriceOracle", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract IERC20Token", "name": "_tokenA", "type": "address" }, { "internalType": "contract IERC20Token", "name": "_tokenB", "type": "address" } ], "name": "latestRate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastUpdateTime", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "contract IERC20Token", "name": "_tokenA", "type": "address" }, { "internalType": "contract IERC20Token", "name": "_tokenB", "type": "address" } ], "name": "latestRateAndUpdateTime", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenA\",\"type\":\"address\"},{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenB\",\"type\":\"address\"},{\"internalType\":\"contract IChainlinkPriceOracle\",\"name\":\"_tokenAOracle\",\"type\":\"address\"},{\"internalType\":\"contract IChainlinkPriceOracle\",\"name\":\"_tokenBOracle\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"lastUpdateTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenA\",\"type\":\"address\"},{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenB\",\"type\":\"address\"}],\"name\":\"latestRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenA\",\"type\":\"address\"},{\"internalType\":\"contract IERC20Token\",\"name\":\"_tokenB\",\"type\":\"address\"}],\"name\":\"latestRateAndUpdateTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenA\",\"outputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenAOracle\",\"outputs\":[{\"internalType\":\"contract IChainlinkPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenB\",\"outputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenBOracle\",\"outputs\":[{\"internalType\":\"contract IChainlinkPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenDecimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20Token\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokensToOracles\",\"outputs\":[{\"internalType\":\"contract IChainlinkPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Provides the off-chain rate between two tokens The price oracle uses chainlink oracles internally to get the rates of the two tokens with respect to a common denominator, and then returns the rate between them, which is equivalent to the rate of TokenA / TokenB\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"initializes a new PriceOracle instance note that the oracles must have the same common denominator (USD, ETH etc.)\",\"params\":{\"_tokenA\":\"first token to support\",\"_tokenAOracle\":\"first token price oracle\",\"_tokenB\":\"second token to support\",\"_tokenBOracle\":\"second token price oracle\"}},\"lastUpdateTime()\":{\"details\":\"returns the timestamp of the last price update\",\"returns\":{\"_0\":\"timestamp\"}},\"latestRate(address,address)\":{\"details\":\"returns the latest known rate between the two given tokens for a given pair of tokens A and B, returns the rate of A / B (the number of B units equivalent to a single A unit) the rate is returned as a fraction (numerator / denominator) for accuracy\",\"params\":{\"_tokenA\":\"token to get the rate of 1 unit of\",\"_tokenB\":\"token to get the rate of 1 `_tokenA` against\"},\"returns\":{\"_0\":\"numerator\",\"_1\":\"denominator\"}},\"latestRateAndUpdateTime(address,address)\":{\"details\":\"returns both the rate and the timestamp of the last update in a single call (gas optimization)\",\"params\":{\"_tokenA\":\"token to get the rate of 1 unit of\",\"_tokenB\":\"token to get the rate of 1 `_tokenA` against\"},\"returns\":{\"_0\":\"numerator\",\"_1\":\"denominator\",\"_2\":\"timestamp of the last update\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/PriceOracle.sol\":\"PriceOracle\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/token/interfaces/IERC20Token.sol\":{\"keccak256\":\"0xe6f988c3156e88258474526a541d5a42b6a9adae98b04177a059d9f723bc82cd\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://9a6eb77a5b9ce70995a11a6e48ac3985a4c70896fe5fe04d46146ad7c1c83ea3\",\"dweb:/ipfs/QmYvGSveZFG51tghwkVuu6eK9Jy8frHpfLxHTMyvNZN461\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/PriceOracle.sol\":{\"keccak256\":\"0x5d03fb3ec2ef50006712ad6fd47d14aed49c4d57971e8d918618093f690e6170\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://8dae9bd9a95911008b10d316a1efaa6f05224bf37dec02ace44ef5a303aff3ee\",\"dweb:/ipfs/Qmeuv2c6R2KwFWganFF7US5s5TcYm1toGM2o4XkS1zGx4R\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol\":{\"keccak256\":\"0x1ab7391a19ca8a3ad2f3c4a1074e080d4d76dfdb834637bdd0c1e6b6acdf28af\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://d6d8c99621ca884b72da2d84eddfec8ec8c5533915691d6eec94a07adf445608\",\"dweb:/ipfs/QmaXr6DN7VbfxfMn3PsTy7SAMgZVVXbdeaw11BsAjVL2x1\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol\":{\"keccak256\":\"0x073efa69fcd6b5e60f841b28b366d63b62ff48ab12a06ce3f5a7f41afd6ce885\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://e8b8ecb2d29197ca77f0ed98f728ace54e6edcfdf5cd1194ae22701607eaf608\",\"dweb:/ipfs/QmcsR6Q35Hurh3TrPkYAboicz9bQQoGCWmZLzUCDyhotH8\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IChainlinkPriceOracle.sol\":{\"keccak256\":\"0x544a1d335c9a30e5543f5c069bbd9f73e6478b0a6941481619a0d20eea159c2a\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://8649d3ff5e21bf5ff21d45a62193974e08ccec27b392e91cbfdad479a60e87f0\",\"dweb:/ipfs/QmatS5peisTv9PdqVz9eSuveQdhJBqpxfpr5q4YsMv51CZ\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IPriceOracle.sol\":{\"keccak256\":\"0x39f4f7af694f7f24373901d8edd57245c6e59970cd1b35137ded4bbebe2155bb\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://30d1011854960be9ab326844d4d97324084955593b2903bee969aba6b1b5f8e9\",\"dweb:/ipfs/QmeTQNZRDNrboKD3ikyMj3tNVHGsa1GqBuAXytJAhhK5Az\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506040516109dc3803806109dc8339818101604052608081101561003357600080fd5b508051602082015160408301516060909301519192909183836100568282610157565b83836100628282610157565b600080546001600160a01b03808b166001600160a01b03199283161790925560018054928a169290911691909117905561009b886101c7565b6001600160a01b0389166000908152600260205260409020805460ff191660ff929092169190911790556100ce876101c7565b6001600160a01b039788166000818152600260209081526040808320805460ff9690961660ff1990961695909517909455600380549a8c166001600160a01b03199b8c168117909155600480549a8d169a8c168b1790559b909a168152600590995281892080548916909a179099559787525050509390922080549091169091179055506102c1565b61016082610263565b61016981610263565b806001600160a01b0316826001600160a01b031614156101c3576040805162461bcd60e51b815260206004820152601060248201526f4552525f53414d455f4144445245535360801b604482015290519081900360640190fd5b5050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156101f65750601261025e565b816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561022f57600080fd5b505afa158015610243573d6000803e3d6000fd5b505050506040513d602081101561025957600080fd5b505190505b919050565b6001600160a01b0381166102be576040805162461bcd60e51b815260206004820152601360248201527f4552525f494e56414c49445f4144445245535300000000000000000000000000604482015290519081900360640190fd5b50565b61070c806102d06000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b1772d7a11610066578063b1772d7a14610147578063b9e1715b14610193578063c8f33c911461019b578063cbd962d1146101b5578063f997fda7146101db57610093565b80630fc63d10146100985780635f64b55b146100bc5780638ee573ac146100c4578063ae81800414610100575b600080fd5b6100a06101e3565b604080516001600160a01b039092168252519081900360200190f35b6100a06101f2565b6100ea600480360360208110156100da57600080fd5b50356001600160a01b0316610201565b6040805160ff9092168252519081900360200190f35b61012e6004803603604081101561011657600080fd5b506001600160a01b0381358116916020013516610216565b6040805192835260208301919091528051918290030190f35b6101756004803603604081101561015d57600080fd5b506001600160a01b03813581169160200135166103a5565b60408051938452602084019290925282820152519081900360600190f35b6100a06103d4565b6101a36103e3565b60408051918252519081900360200190f35b6100a0600480360360208110156101cb57600080fd5b50356001600160a01b03166104ec565b6100a0610507565b6000546001600160a01b031681565b6001546001600160a01b031681565b60026020526000908152604090205460ff1681565b60008083836102258282610516565b6001600160a01b0380871660009081526005602090815260408083205481516350d25bcd60e01b81529151939416926350d25bcd92600480840193919291829003018186803b15801561027757600080fd5b505afa15801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b50516001600160a01b0380881660009081526005602090815260408083205481516350d25bcd60e01b81529151959650929492909316926350d25bcd9260048083019392829003018186803b1580156102f957600080fd5b505afa15801561030d573d6000803e3d6000fd5b505050506040513d602081101561032357600080fd5b50516001600160a01b03808a1660009081526002602052604080822054928b16825290205491925060ff9081169116808211156103735761036c8360ff83850316600a0a6105af565b9250610396565b8060ff168260ff161015610396576103938460ff84840316600a0a6105af565b93505b50919890975095505050505050565b60008060008060006103b78787610216565b9150915081816103c56103e3565b94509450945050509250925092565b6003546001600160a01b031681565b600080600360009054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b50516004805460408051634102dfb560e11b815290519394506000936001600160a01b0390921692638205bf6a928282019260209290829003018186803b1580156104a857600080fd5b505afa1580156104bc573d6000803e3d6000fd5b505050506040513d60208110156104d257600080fd5b505190508082116104e357806104e5565b815b9250505090565b6005602052600090815260409020546001600160a01b031681565b6004546001600160a01b031681565b6105208282610616565b6001600160a01b03828116600090815260056020526040902054161580159061056257506001600160a01b038181166000908152600560205260409020541615155b6105ab576040805162461bcd60e51b815260206004820152601560248201527422a9292faaa729aaa82827a92a22a22faa27a5a2a760591b604482015290519081900360640190fd5b5050565b6000826105be57506000610610565b828202828482816105cb57fe5b041461060d576040805162461bcd60e51b815260206004820152600c60248201526b4552525f4f564552464c4f5760a01b604482015290519081900360640190fd5b90505b92915050565b61061f82610682565b61062881610682565b806001600160a01b0316826001600160a01b031614156105ab576040805162461bcd60e51b815260206004820152601060248201526f4552525f53414d455f4144445245535360801b604482015290519081900360640190fd5b6001600160a01b0381166106d3576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f4144445245535360681b604482015290519081900360640190fd5b5056fea2646970667358221220022bb923a68c1656dd285dc381e0a9d05c2218475c0b4d9e4b9d7f999b97b5e164736f6c634300060c0033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063b1772d7a11610066578063b1772d7a14610147578063b9e1715b14610193578063c8f33c911461019b578063cbd962d1146101b5578063f997fda7146101db57610093565b80630fc63d10146100985780635f64b55b146100bc5780638ee573ac146100c4578063ae81800414610100575b600080fd5b6100a06101e3565b604080516001600160a01b039092168252519081900360200190f35b6100a06101f2565b6100ea600480360360208110156100da57600080fd5b50356001600160a01b0316610201565b6040805160ff9092168252519081900360200190f35b61012e6004803603604081101561011657600080fd5b506001600160a01b0381358116916020013516610216565b6040805192835260208301919091528051918290030190f35b6101756004803603604081101561015d57600080fd5b506001600160a01b03813581169160200135166103a5565b60408051938452602084019290925282820152519081900360600190f35b6100a06103d4565b6101a36103e3565b60408051918252519081900360200190f35b6100a0600480360360208110156101cb57600080fd5b50356001600160a01b03166104ec565b6100a0610507565b6000546001600160a01b031681565b6001546001600160a01b031681565b60026020526000908152604090205460ff1681565b60008083836102258282610516565b6001600160a01b0380871660009081526005602090815260408083205481516350d25bcd60e01b81529151939416926350d25bcd92600480840193919291829003018186803b15801561027757600080fd5b505afa15801561028b573d6000803e3d6000fd5b505050506040513d60208110156102a157600080fd5b50516001600160a01b0380881660009081526005602090815260408083205481516350d25bcd60e01b81529151959650929492909316926350d25bcd9260048083019392829003018186803b1580156102f957600080fd5b505afa15801561030d573d6000803e3d6000fd5b505050506040513d602081101561032357600080fd5b50516001600160a01b03808a1660009081526002602052604080822054928b16825290205491925060ff9081169116808211156103735761036c8360ff83850316600a0a6105af565b9250610396565b8060ff168260ff161015610396576103938460ff84840316600a0a6105af565b93505b50919890975095505050505050565b60008060008060006103b78787610216565b9150915081816103c56103e3565b94509450945050509250925092565b6003546001600160a01b031681565b600080600360009054906101000a90046001600160a01b03166001600160a01b0316638205bf6a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b50516004805460408051634102dfb560e11b815290519394506000936001600160a01b0390921692638205bf6a928282019260209290829003018186803b1580156104a857600080fd5b505afa1580156104bc573d6000803e3d6000fd5b505050506040513d60208110156104d257600080fd5b505190508082116104e357806104e5565b815b9250505090565b6005602052600090815260409020546001600160a01b031681565b6004546001600160a01b031681565b6105208282610616565b6001600160a01b03828116600090815260056020526040902054161580159061056257506001600160a01b038181166000908152600560205260409020541615155b6105ab576040805162461bcd60e51b815260206004820152601560248201527422a9292faaa729aaa82827a92a22a22faa27a5a2a760591b604482015290519081900360640190fd5b5050565b6000826105be57506000610610565b828202828482816105cb57fe5b041461060d576040805162461bcd60e51b815260206004820152600c60248201526b4552525f4f564552464c4f5760a01b604482015290519081900360640190fd5b90505b92915050565b61061f82610682565b61062881610682565b806001600160a01b0316826001600160a01b031614156105ab576040805162461bcd60e51b815260206004820152601060248201526f4552525f53414d455f4144445245535360801b604482015290519081900360640190fd5b6001600160a01b0381166106d3576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f4144445245535360681b604482015290519081900360640190fd5b5056fea2646970667358221220022bb923a68c1656dd285dc381e0a9d05c2218475c0b4d9e4b9d7f999b97b5e164736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "520:6445:58:-:0;;;1678:643;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1678:643:58;;;;;;;;;;;;;;;;;;;;;2469:43;1678:643;;2469:21;:43::i;:::-;1926:13;1950;2469:43:::1;1926:13:::0;1950;2469:21:::1;:43::i;:::-;1982:6:::2;:16:::0;;-1:-1:-1;;;;;1982:16:58;;::::2;-1:-1:-1::0;;;;;;1982:16:58;;::::2;;::::0;;;-1:-1:-1;2009:16:58;;;;::::2;::::0;;;::::2;::::0;;;::::2;::::0;;2061:17:::2;1982:16:::0;2061:8:::2;:17::i;:::-;-1:-1:-1::0;;;;;2036:22:58;::::2;;::::0;;;:13:::2;:22;::::0;;;;:42;;-1:-1:-1;;2036:42:58::2;-1:-1:-1::0;2036:42:58;;;::::2;::::0;;;::::2;::::0;;2114:17:::2;2123:7:::0;2114:8:::2;:17::i;:::-;-1:-1:-1::0;;;;;2089:22:58;;::::2;;::::0;;;:13:::2;:22;::::0;;;;;;;:42;;-1:-1:-1;;2089:42:58::2;;::::0;;;::::2;::::0;;;::::2;::::0;;;2144:12:::2;:28:::0;;-1:-1:-1;;;;;;2144:28:58;;::::2;::::0;;::::2;::::0;;::::2;::::0;;;2183:12:::2;:28:::0;;;::::2;::::0;;::::2;::::0;;::::2;::::0;;2222:24;;;::::2;::::0;;:15:::2;:24:::0;;;;;;:40;;;::::2;::::0;;::::2;::::0;;;2273:24;;;-1:-1:-1;;;2273:24:58;;;;:40;;;;::::2;::::0;;::::2;::::0;;;-1:-1:-1;520:6445:58;;2587:223;2681:24;2695:9;2681:13;:24::i;:::-;2716;2730:9;2716:13;:24::i;:::-;-1:-1:-1;;;;;2759:22:58;;;;;;;;2751:51;;;;;-1:-1:-1;;;2751:51:58;;;;;;;;;;;;-1:-1:-1;;;2751:51:58;;;;;;;;;;;;;;;2587:223;;:::o;6767:195::-;6827:5;661:42;-1:-1:-1;;;;;6849:21:58;;;6845:73;;;-1:-1:-1;749:2:58;6887:19;;6845:73;6937:6;-1:-1:-1;;;;;6937:15:58;;:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6937:17:58;;-1:-1:-1;6767:195:58;;;;:::o;692:128:64:-;-1:-1:-1;;;;;766:22:64;;758:54;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;;;;692:128;:::o;520:6445:58:-;;;;;;;", "deployedSourceMap": "520:6445:58:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;760:25;;;:::i;:::-;;;;-1:-1:-1;;;;;760:25:58;;;;;;;;;;;;;;824;;;:::i;888:51::-;;;;;;;;;;;;;;;;-1:-1:-1;888:51:58;-1:-1:-1;;;;;888:51:58;;:::i;:::-;;;;;;;;;;;;;;;;;;;3894:1619;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;3894:1619:58;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;6379:325;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;6379:325:58;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;978:50;;;:::i;5635:360::-;;;:::i;:::-;;;;;;;;;;;;;;;;1162:69;;;;;;;;;;;;;;;;-1:-1:-1;1162:69:58;-1:-1:-1;;;;;1162:69:58;;:::i;1070:50::-;;;:::i;760:25::-;;;-1:-1:-1;;;;;760:25:58;;:::o;824:::-;;;-1:-1:-1;;;;;824:25:58;;:::o;888:51::-;;;;;;;;;;;;;;;:::o;3894:1619::-;4065:7;4074;4029;4038;2965:34;2982:7;2991;2965:16;:34::i;:::-;-1:-1:-1;;;;;4128:24:58;;::::1;4099:18;4128:24:::0;;;:15:::1;:24;::::0;;;;;;;;:39;;-1:-1:-1;;;4128:39:58;;;;4099:18;;4128:24:::1;::::0;-1:-1:-1;;4128:39:58::1;::::0;;::::1;::::0;:24;;:39;;;;;;:24;:39;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;4128:39:58;-1:-1:-1;;;;;4208:24:58;;::::1;4179:18;4208:24:::0;;;:15:::1;4128:39;4208:24:::0;;;;;;;;:39;;-1:-1:-1;;;4208:39:58;;;;4128;;-1:-1:-1;4179:18:58;;4208:24;;;::::1;::::0;-1:-1:-1;;4208:39:58::1;::::0;;::::1;::::0;4128;4208;;;;;:24;:39;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;4208:39:58;-1:-1:-1;;;;;4282:22:58;;::::1;4259:20;4282:22:::0;;;:13:::1;4208:39;4282:22:::0;;;;;;4338;;::::1;::::0;;;;;4208:39;;-1:-1:-1;4282:22:58::1;::::0;;::::1;::::0;4338::::1;5169:31:::0;;::::1;5165:297;;;5230:64;:10:::0;5245:48:::1;5261:31:::0;;::::1;5245:48;5253:2;5245:48;5230:14;:64::i;:::-;5217:77;;5165:297;;;5342:14;5325:31;;:14;:31;;;5321:141;;;5386:64;:10:::0;5401:48:::1;5417:31:::0;;::::1;5401:48;5409:2;5401:48;5386:14;:64::i;:::-;5373:77;;5321:141;-1:-1:-1::0;5482:10:58;;5494;;-1:-1:-1;3894:1619:58;-1:-1:-1;;;;;;3894:1619:58:o;6379:325::-;6520:7;6529;6538;6564:17;6583:19;6606:28;6617:7;6626;6606:10;:28::i;:::-;6563:71;;;;6655:9;6666:11;6679:16;:14;:16::i;:::-;6647:49;;;;;;;;6379:325;;;;;:::o;978:50::-;;;-1:-1:-1;;;;;978:50:58;;:::o;5635:360::-;5825:12;;:30;;;-1:-1:-1;;;5825:30:58;;;;5727:7;;;;-1:-1:-1;;;;;5825:12:58;;;;:28;;:30;;;;;;;;;;;;;;;:12;:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5825:30:58;5887:12;;;:30;;;-1:-1:-1;;;5887:30:58;;;;5825;;-1:-1:-1;5866:18:58;;-1:-1:-1;;;;;5887:12:58;;;;:28;;:30;;;;5825;;5887;;;;;;:12;:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5887:30:58;;-1:-1:-1;5938:23:58;;;:49;;5977:10;5938:49;;;5964:10;5938:49;5930:57;;;;5635:360;:::o;1162:69::-;;;;;;;;;;;;-1:-1:-1;;;;;1162:69:58;;:::o;1070:50::-;;;-1:-1:-1;;;;;1070:50:58;;:::o;3074:301::-;3167:57;3197:7;3215;3167:21;:57::i;:::-;-1:-1:-1;;;;;3251:24:58;;;3288:1;3251:24;;;:15;:24;;;;;;;3243:47;;;;:98;;-1:-1:-1;;;;;;3302:24:58;;;3339:1;3302:24;;;:15;:24;;;;;;;3294:47;;3243:98;3235:132;;;;;-1:-1:-1;;;3235:132:58;;;;;;;;;;;;-1:-1:-1;;;3235:132:58;;;;;;;;;;;;;;;3074:301;;:::o;1149:250:60:-;1209:7;1262;1258:34;;-1:-1:-1;1291:1:60;1284:8;;1258:34;1317:7;;;1322:2;1317;:7;:2;1343:6;;;;;:12;1335:37;;;;;-1:-1:-1;;;1335:37:60;;;;;;;;;;;;-1:-1:-1;;;1335:37:60;;;;;;;;;;;;;;;1390:1;-1:-1:-1;1149:250:60;;;;;:::o;2587:223:58:-;2681:24;2695:9;2681:13;:24::i;:::-;2716;2730:9;2716:13;:24::i;:::-;-1:-1:-1;;;;;2759:22:58;;;;;;;;2751:51;;;;;-1:-1:-1;;;2751:51:58;;;;;;;;;;;;-1:-1:-1;;;2751:51:58;;;;;;;;;;;;;;692:128:64;-1:-1:-1;;;;;766:22:64;;758:54;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;-1:-1:-1;;;758:54:64;;;;;;;;;;;;;;;692:128;:::o", "source": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\r\npragma solidity 0.6.12;\r\nimport \"./Utils.sol\";\r\nimport \"./SafeMath.sol\";\r\nimport \"./interfaces/IPriceOracle.sol\";\r\nimport \"./interfaces/IChainlinkPriceOracle.sol\";\r\n\r\n/**\r\n * @dev Provides the off-chain rate between two tokens\r\n *\r\n * The price oracle uses chainlink oracles internally to get the rates of the two tokens\r\n * with respect to a common denominator, and then returns the rate between them, which\r\n * is equivalent to the rate of TokenA / TokenB\r\n*/\r\ncontract PriceOracle is IPriceOracle, Utils {\r\n using SafeMath for uint256;\r\n\r\n IERC20Token private constant ETH_ADDRESS = IERC20Token(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);\r\n uint8 private constant ETH_DECIMALS = 18;\r\n\r\n IERC20Token public tokenA; // token A the oracle supports\r\n IERC20Token public tokenB; // token B the oracle supports\r\n mapping (IERC20Token => uint8) public tokenDecimals; // token -> token decimals\r\n\r\n IChainlinkPriceOracle public override tokenAOracle; // token A chainlink price oracle\r\n IChainlinkPriceOracle public override tokenBOracle; // token B chainlink price oracle\r\n mapping (IERC20Token => IChainlinkPriceOracle) public tokensToOracles; // token -> price oracle for easier access\r\n\r\n /**\r\n * @dev initializes a new PriceOracle instance\r\n * note that the oracles must have the same common denominator (USD, ETH etc.)\r\n *\r\n * @param _tokenA first token to support\r\n * @param _tokenB second token to support\r\n * @param _tokenAOracle first token price oracle\r\n * @param _tokenBOracle second token price oracle\r\n */\r\n constructor(IERC20Token _tokenA, IERC20Token _tokenB, IChainlinkPriceOracle _tokenAOracle, IChainlinkPriceOracle _tokenBOracle)\r\n public\r\n validUniqueAddresses(address(_tokenA), address(_tokenB))\r\n validUniqueAddresses(address(_tokenAOracle), address(_tokenBOracle))\r\n {\r\n tokenA = _tokenA;\r\n tokenB = _tokenB;\r\n tokenDecimals[_tokenA] = decimals(_tokenA);\r\n tokenDecimals[_tokenB] = decimals(_tokenB);\r\n\r\n tokenAOracle = _tokenAOracle;\r\n tokenBOracle = _tokenBOracle;\r\n tokensToOracles[_tokenA] = _tokenAOracle;\r\n tokensToOracles[_tokenB] = _tokenBOracle;\r\n }\r\n\r\n // ensures that the provided addresses are unique valid\r\n modifier validUniqueAddresses(address _address1, address _address2) {\r\n _validUniqueAddresses(_address1, _address2);\r\n _;\r\n }\r\n\r\n // error message binary size optimization\r\n function _validUniqueAddresses(address _address1, address _address2) internal pure {\r\n _validAddress(_address1);\r\n _validAddress(_address2);\r\n require(_address1 != _address2, \"ERR_SAME_ADDRESS\");\r\n }\r\n\r\n // ensures that the provides tokens are supported by the oracle\r\n modifier supportedTokens(IERC20Token _tokenA, IERC20Token _tokenB) {\r\n _supportedTokens(_tokenA, _tokenB);\r\n _;\r\n }\r\n\r\n // error message binary size optimization\r\n function _supportedTokens(IERC20Token _tokenA, IERC20Token _tokenB) internal view {\r\n _validUniqueAddresses(address(_tokenA), address(_tokenB));\r\n require(address(tokensToOracles[_tokenA]) != address(0) && address(tokensToOracles[_tokenB]) != address(0), \"ERR_UNSUPPORTED_TOKEN\");\r\n }\r\n\r\n /**\r\n * @dev returns the latest known rate between the two given tokens\r\n * for a given pair of tokens A and B, returns the rate of A / B\r\n * (the number of B units equivalent to a single A unit)\r\n * the rate is returned as a fraction (numerator / denominator) for accuracy\r\n *\r\n * @param _tokenA token to get the rate of 1 unit of\r\n * @param _tokenB token to get the rate of 1 `_tokenA` against\r\n *\r\n * @return numerator\r\n * @return denominator\r\n */\r\n function latestRate(IERC20Token _tokenA, IERC20Token _tokenB)\r\n public\r\n view\r\n override\r\n supportedTokens(_tokenA, _tokenB)\r\n returns (uint256, uint256)\r\n {\r\n uint256 rateTokenA = uint256(tokensToOracles[_tokenA].latestAnswer());\r\n uint256 rateTokenB = uint256(tokensToOracles[_tokenB].latestAnswer());\r\n uint8 decimalsTokenA = tokenDecimals[_tokenA];\r\n uint8 decimalsTokenB = tokenDecimals[_tokenB];\r\n\r\n // the normalization works as follows:\r\n // - token A with decimals of dA and price of rateA per one token (e.g., for 10^dA weiA)\r\n // - token B with decimals of dB < dA and price of rateB per one token (e.g., for 10^dB weiB)\r\n // then the normalized rate, representing the rate between 1 weiA and 1 weiB is rateA / (rateB * 10^(dA - dB)).\r\n //\r\n // for example:\r\n // - token A with decimals of 5 and price of $10 per one token (e.g., for 100,000 weiA)\r\n // - token B with decimals of 2 and price of $2 per one token (e.g., for 100 weiB)\r\n // then the normalized rate would be: 5 / (2 * 10^3) = 0.0025, which is the correct rate since\r\n // 1 weiA costs $0.00005, 1 weiB costs $0.02, and weiA / weiB is 0.0025.\r\n\r\n if (decimalsTokenA > decimalsTokenB) {\r\n rateTokenB = rateTokenB.mul(uint256(10) ** (decimalsTokenA - decimalsTokenB));\r\n }\r\n else if (decimalsTokenA < decimalsTokenB) {\r\n rateTokenA = rateTokenA.mul(uint256(10) ** (decimalsTokenB - decimalsTokenA));\r\n }\r\n\r\n return (rateTokenA, rateTokenB);\r\n }\r\n\r\n /**\r\n * @dev returns the timestamp of the last price update\r\n *\r\n * @return timestamp\r\n */\r\n function lastUpdateTime()\r\n public\r\n view\r\n override\r\n returns (uint256) {\r\n // returns the oldest timestamp between the two\r\n uint256 timestampA = tokenAOracle.latestTimestamp();\r\n uint256 timestampB = tokenBOracle.latestTimestamp();\r\n\r\n return timestampA > timestampB ? timestampA : timestampB;\r\n }\r\n\r\n /**\r\n * @dev returns both the rate and the timestamp of the last update in a single call (gas optimization)\r\n *\r\n * @param _tokenA token to get the rate of 1 unit of\r\n * @param _tokenB token to get the rate of 1 `_tokenA` against\r\n *\r\n * @return numerator\r\n * @return denominator\r\n * @return timestamp of the last update\r\n */\r\n function latestRateAndUpdateTime(IERC20Token _tokenA, IERC20Token _tokenB)\r\n public\r\n view\r\n override\r\n returns (uint256, uint256, uint256)\r\n {\r\n (uint256 numerator, uint256 denominator) = latestRate(_tokenA, _tokenB);\r\n\r\n return (numerator, denominator, lastUpdateTime());\r\n }\r\n\r\n /** @dev returns the decimals of a given token */\r\n function decimals(IERC20Token _token) private view returns (uint8) {\r\n if (_token == ETH_ADDRESS) {\r\n return ETH_DECIMALS;\r\n }\r\n\r\n return _token.decimals();\r\n }\r\n}\r\n", "sourcePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/PriceOracle.sol", "ast": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/PriceOracle.sol", "exportedSymbols": { "PriceOracle": [ 22205 ] }, "id": 22206, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 21820, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "52:23:58" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol", "file": "./Utils.sol", "id": 21821, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22662, "src": "77:21:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol", "file": "./SafeMath.sol", "id": 21822, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22355, "src": "100:24:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IPriceOracle.sol", "file": "./interfaces/IPriceOracle.sol", "id": 21823, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22892, "src": "126:39:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IChainlinkPriceOracle.sol", "file": "./interfaces/IChainlinkPriceOracle.sol", "id": 21824, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22822, "src": "167:48:58", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 21826, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22891, "src": "544:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$22891", "typeString": "contract IPriceOracle" } }, "id": 21827, "nodeType": "InheritanceSpecifier", "src": "544:12:58" }, { "arguments": null, "baseName": { "contractScope": null, "id": 21828, "name": "Utils", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22661, "src": "558:5:58", "typeDescriptions": { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } }, "id": 21829, "nodeType": "InheritanceSpecifier", "src": "558:5:58" } ], "contractDependencies": [ 22661, 22891 ], "contractKind": "contract", "documentation": { "id": 21825, "nodeType": "StructuredDocumentation", "src": "219:299:58", "text": " @dev Provides the off-chain rate between two tokens\n The price oracle uses chainlink oracles internally to get the rates of the two tokens\n with respect to a common denominator, and then returns the rate between them, which\n is equivalent to the rate of TokenA / TokenB" }, "fullyImplemented": true, "id": 22205, "linearizedBaseContracts": [ 22205, 22661, 22891 ], "name": "PriceOracle", "nodeType": "ContractDefinition", "nodes": [ { "id": 21832, "libraryName": { "contractScope": null, "id": 21830, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22354, "src": "577:8:58", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$22354", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "571:27:58", "typeName": { "id": 21831, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "590:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": true, "id": 21837, "mutability": "constant", "name": "ETH_ADDRESS", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "606:98:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21833, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "606:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "307845656565654565656545654565654565456545656545454565656565456565656565656545456545", "id": 21835, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "661:42:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "value": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 21834, "name": "IERC20Token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21127, "src": "649:11:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20Token_$21127_$", "typeString": "type(contract IERC20Token)" } }, "id": 21836, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "649:55:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "visibility": "private" }, { "constant": true, "id": 21840, "mutability": "constant", "name": "ETH_DECIMALS", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "711:40:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 21838, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "711:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": { "argumentTypes": null, "hexValue": "3138", "id": 21839, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "749:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_18_by_1", "typeString": "int_const 18" }, "value": "18" }, "visibility": "private" }, { "constant": false, "functionSelector": "0fc63d10", "id": 21842, "mutability": "mutable", "name": "tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "760:25:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21841, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "760:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "5f64b55b", "id": 21844, "mutability": "mutable", "name": "tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "824:25:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21843, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "824:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "8ee573ac", "id": 21848, "mutability": "mutable", "name": "tokenDecimals", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "888:51:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" }, "typeName": { "id": 21847, "keyType": { "contractScope": null, "id": 21845, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "897:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Mapping", "src": "888:30:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" }, "valueType": { "id": 21846, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "912:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } }, "value": null, "visibility": "public" }, { "baseFunctions": [ 22856 ], "constant": false, "functionSelector": "b9e1715b", "id": 21851, "mutability": "mutable", "name": "tokenAOracle", "nodeType": "VariableDeclaration", "overrides": { "id": 21850, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1007:8:58" }, "scope": 22205, "src": "978:50:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21849, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "978:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "public" }, { "baseFunctions": [ 22861 ], "constant": false, "functionSelector": "f997fda7", "id": 21854, "mutability": "mutable", "name": "tokenBOracle", "nodeType": "VariableDeclaration", "overrides": { "id": 21853, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1099:8:58" }, "scope": 22205, "src": "1070:50:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21852, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1070:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "cbd962d1", "id": 21858, "mutability": "mutable", "name": "tokensToOracles", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "1162:69:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" }, "typeName": { "id": 21857, "keyType": { "contractScope": null, "id": 21855, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1171:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Mapping", "src": "1162:46:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" }, "valueType": { "contractScope": null, "id": 21856, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1186:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } }, "value": null, "visibility": "public" }, { "body": { "id": 21934, "nodeType": "Block", "src": "1971:350:58", "statements": [ { "expression": { "argumentTypes": null, "id": 21892, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21890, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21842, "src": "1982:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21891, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "1991:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "1982:16:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 21893, "nodeType": "ExpressionStatement", "src": "1982:16:58" }, { "expression": { "argumentTypes": null, "id": 21896, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21894, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21844, "src": "2009:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21895, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2018:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "2009:16:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 21897, "nodeType": "ExpressionStatement", "src": "2009:16:58" }, { "expression": { "argumentTypes": null, "id": 21904, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21898, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "2036:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 21900, "indexExpression": { "argumentTypes": null, "id": 21899, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2050:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2036:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21902, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2070:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21901, "name": "decimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22204, "src": "2061:8:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint8_$", "typeString": "function (contract IERC20Token) view returns (uint8)" } }, "id": 21903, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2061:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "2036:42:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "id": 21905, "nodeType": "ExpressionStatement", "src": "2036:42:58" }, { "expression": { "argumentTypes": null, "id": 21912, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21906, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "2089:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 21908, "indexExpression": { "argumentTypes": null, "id": 21907, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2103:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2089:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21910, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2123:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21909, "name": "decimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22204, "src": "2114:8:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint8_$", "typeString": "function (contract IERC20Token) view returns (uint8)" } }, "id": 21911, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2114:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "2089:42:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "id": 21913, "nodeType": "ExpressionStatement", "src": "2089:42:58" }, { "expression": { "argumentTypes": null, "id": 21916, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21914, "name": "tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21851, "src": "2144:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21915, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "2159:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2144:28:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21917, "nodeType": "ExpressionStatement", "src": "2144:28:58" }, { "expression": { "argumentTypes": null, "id": 21920, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21918, "name": "tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21854, "src": "2183:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21919, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "2198:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2183:28:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21921, "nodeType": "ExpressionStatement", "src": "2183:28:58" }, { "expression": { "argumentTypes": null, "id": 21926, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21922, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "2222:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 21924, "indexExpression": { "argumentTypes": null, "id": 21923, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2238:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2222:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21925, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "2249:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2222:40:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21927, "nodeType": "ExpressionStatement", "src": "2222:40:58" }, { "expression": { "argumentTypes": null, "id": 21932, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21928, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "2273:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 21930, "indexExpression": { "argumentTypes": null, "id": 21929, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2289:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2273:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21931, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "2300:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2273:40:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21933, "nodeType": "ExpressionStatement", "src": "2273:40:58" } ] }, "documentation": { "id": 21859, "nodeType": "StructuredDocumentation", "src": "1284:388:58", "text": " @dev initializes a new PriceOracle instance\n note that the oracles must have the same common denominator (USD, ETH etc.)\n @param _tokenA first token to support\n @param _tokenB second token to support\n @param _tokenAOracle first token price oracle\n @param _tokenBOracle second token price oracle" }, "id": 21935, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21872, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "1860:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21871, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1852:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21870, "name": "address", "nodeType": "ElementaryTypeName", "src": "1852:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21873, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1852:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21876, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "1878:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21875, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1870:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21874, "name": "address", "nodeType": "ElementaryTypeName", "src": "1870:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21877, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1870:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 21878, "modifierName": { "argumentTypes": null, "id": 21869, "name": "validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21948, "src": "1831:20:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_address_$_t_address_$", "typeString": "modifier (address,address)" } }, "nodeType": "ModifierInvocation", "src": "1831:56:58" }, { "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21882, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "1926:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 21881, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1918:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21880, "name": "address", "nodeType": "ElementaryTypeName", "src": "1918:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21883, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1918:22:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21886, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "1950:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 21885, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1942:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21884, "name": "address", "nodeType": "ElementaryTypeName", "src": "1942:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21887, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1942:22:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 21888, "modifierName": { "argumentTypes": null, "id": 21879, "name": "validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21948, "src": "1897:20:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_address_$_t_address_$", "typeString": "modifier (address,address)" } }, "nodeType": "ModifierInvocation", "src": "1897:68:58" } ], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21868, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21861, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1690:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21860, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1690:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21863, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1711:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21862, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1711:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21865, "mutability": "mutable", "name": "_tokenAOracle", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1732:35:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21864, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1732:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21867, "mutability": "mutable", "name": "_tokenBOracle", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1769:35:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21866, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1769:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "internal" } ], "src": "1689:116:58" }, "returnParameters": { "id": 21889, "nodeType": "ParameterList", "parameters": [], "src": "1971:0:58" }, "scope": 22205, "src": "1678:643:58", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 21947, "nodeType": "Block", "src": "2458:74:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21942, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21937, "src": "2491:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 21943, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21939, "src": "2502:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21941, "name": "_validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21971, "src": "2469:21:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address) pure" } }, "id": 21944, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2469:43:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21945, "nodeType": "ExpressionStatement", "src": "2469:43:58" }, { "id": 21946, "nodeType": "PlaceholderStatement", "src": "2523:1:58" } ] }, "documentation": null, "id": 21948, "name": "validUniqueAddresses", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 21940, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21937, "mutability": "mutable", "name": "_address1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21948, "src": "2420:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21936, "name": "address", "nodeType": "ElementaryTypeName", "src": "2420:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21939, "mutability": "mutable", "name": "_address2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21948, "src": "2439:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21938, "name": "address", "nodeType": "ElementaryTypeName", "src": "2439:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2419:38:58" }, "src": "2390:142:58", "virtual": false, "visibility": "internal" }, { "body": { "id": 21970, "nodeType": "Block", "src": "2670:140:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21956, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21950, "src": "2695:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21955, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "2681:13:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 21957, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2681:24:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21958, "nodeType": "ExpressionStatement", "src": "2681:24:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21960, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21952, "src": "2730:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21959, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "2716:13:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 21961, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2716:24:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21962, "nodeType": "ExpressionStatement", "src": "2716:24:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 21966, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 21964, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21950, "src": "2759:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 21965, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21952, "src": "2772:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2759:22:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f53414d455f41444452455353", "id": 21967, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2783:18:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_f8a367a12797014b9e2f1d71cd920760e1c54a6511a9a16d5ab22fb4d28800b6", "typeString": "literal_string \"ERR_SAME_ADDRESS\"" }, "value": "ERR_SAME_ADDRESS" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_f8a367a12797014b9e2f1d71cd920760e1c54a6511a9a16d5ab22fb4d28800b6", "typeString": "literal_string \"ERR_SAME_ADDRESS\"" } ], "id": 21963, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "2751:7:58", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 21968, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2751:51:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21969, "nodeType": "ExpressionStatement", "src": "2751:51:58" } ] }, "documentation": null, "id": 21971, "implemented": true, "kind": "function", "modifiers": [], "name": "_validUniqueAddresses", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21953, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21950, "mutability": "mutable", "name": "_address1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21971, "src": "2618:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21949, "name": "address", "nodeType": "ElementaryTypeName", "src": "2618:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21952, "mutability": "mutable", "name": "_address2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21971, "src": "2637:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21951, "name": "address", "nodeType": "ElementaryTypeName", "src": "2637:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2617:38:58" }, "returnParameters": { "id": 21954, "nodeType": "ParameterList", "parameters": [], "src": "2670:0:58" }, "scope": 22205, "src": "2587:223:58", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 21983, "nodeType": "Block", "src": "2954:65:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21978, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21973, "src": "2982:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 21979, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21975, "src": "2991:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21977, "name": "_supportedTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22030, "src": "2965:16:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$returns$__$", "typeString": "function (contract IERC20Token,contract IERC20Token) view" } }, "id": 21980, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2965:34:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21981, "nodeType": "ExpressionStatement", "src": "2965:34:58" }, { "id": 21982, "nodeType": "PlaceholderStatement", "src": "3010:1:58" } ] }, "documentation": null, "id": 21984, "name": "supportedTokens", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 21976, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21973, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21984, "src": "2912:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21972, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "2912:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21975, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21984, "src": "2933:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21974, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "2933:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "2911:42:58" }, "src": "2887:132:58", "virtual": false, "visibility": "internal" }, { "body": { "id": 22029, "nodeType": "Block", "src": "3156:219:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21994, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21986, "src": "3197:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21993, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3189:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21992, "name": "address", "nodeType": "ElementaryTypeName", "src": "3189:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21995, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3189:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21998, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21988, "src": "3215:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21997, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3207:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21996, "name": "address", "nodeType": "ElementaryTypeName", "src": "3207:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21999, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3207:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21991, "name": "_validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21971, "src": "3167:21:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address) pure" } }, "id": 22000, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3167:57:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22001, "nodeType": "ExpressionStatement", "src": "3167:57:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 22025, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22013, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22005, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "3251:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22007, "indexExpression": { "argumentTypes": null, "id": 22006, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21986, "src": "3267:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "3251:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 22004, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3243:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22003, "name": "address", "nodeType": "ElementaryTypeName", "src": "3243:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22008, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3243:33:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22011, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3288:1:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22010, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3280:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22009, "name": "address", "nodeType": "ElementaryTypeName", "src": "3280:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22012, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3280:10:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "3243:47:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22024, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22016, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "3302:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22018, "indexExpression": { "argumentTypes": null, "id": 22017, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21988, "src": "3318:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "3302:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 22015, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3294:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22014, "name": "address", "nodeType": "ElementaryTypeName", "src": "3294:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22019, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3294:33:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22022, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3339:1:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22021, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3331:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22020, "name": "address", "nodeType": "ElementaryTypeName", "src": "3331:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22023, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3331:10:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "3294:47:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "3243:98:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f554e535550504f525445445f544f4b454e", "id": 22026, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "3343:23:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_fe5e253e0ad9d51f460b73c35652983a29904d3e214ecea083c7dec391c7b884", "typeString": "literal_string \"ERR_UNSUPPORTED_TOKEN\"" }, "value": "ERR_UNSUPPORTED_TOKEN" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_fe5e253e0ad9d51f460b73c35652983a29904d3e214ecea083c7dec391c7b884", "typeString": "literal_string \"ERR_UNSUPPORTED_TOKEN\"" } ], "id": 22002, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "3235:7:58", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22027, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3235:132:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22028, "nodeType": "ExpressionStatement", "src": "3235:132:58" } ] }, "documentation": null, "id": 22030, "implemented": true, "kind": "function", "modifiers": [], "name": "_supportedTokens", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21989, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21986, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22030, "src": "3100:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21985, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3100:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21988, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22030, "src": "3121:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21987, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3121:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "3099:42:58" }, "returnParameters": { "id": 21990, "nodeType": "ParameterList", "parameters": [], "src": "3156:0:58" }, "scope": 22205, "src": "3074:301:58", "stateMutability": "view", "virtual": false, "visibility": "internal" }, { "baseFunctions": [ 22872 ], "body": { "id": 22125, "nodeType": "Block", "src": "4088:1425:58", "statements": [ { "assignments": [ 22048 ], "declarations": [ { "constant": false, "id": 22048, "mutability": "mutable", "name": "rateTokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4099:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22047, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4099:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22057, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22051, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "4128:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22053, "indexExpression": { "argumentTypes": null, "id": 22052, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4144:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4128:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22054, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestAnswer", "nodeType": "MemberAccess", "referencedDeclaration": 22815, "src": "4128:37:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_int256_$", "typeString": "function () view external returns (int256)" } }, "id": 22055, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4128:39:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int256", "typeString": "int256" } ], "id": 22050, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "4120:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22049, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4120:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22056, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4120:48:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "4099:69:58" }, { "assignments": [ 22059 ], "declarations": [ { "constant": false, "id": 22059, "mutability": "mutable", "name": "rateTokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4179:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22058, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4179:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22068, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22062, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "4208:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22064, "indexExpression": { "argumentTypes": null, "id": 22063, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4224:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4208:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22065, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestAnswer", "nodeType": "MemberAccess", "referencedDeclaration": 22815, "src": "4208:37:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_int256_$", "typeString": "function () view external returns (int256)" } }, "id": 22066, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4208:39:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int256", "typeString": "int256" } ], "id": 22061, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "4200:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22060, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4200:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22067, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4200:48:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "4179:69:58" }, { "assignments": [ 22070 ], "declarations": [ { "constant": false, "id": 22070, "mutability": "mutable", "name": "decimalsTokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4259:20:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22069, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "4259:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "id": 22074, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22071, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "4282:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 22073, "indexExpression": { "argumentTypes": null, "id": 22072, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4296:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4282:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "VariableDeclarationStatement", "src": "4259:45:58" }, { "assignments": [ 22076 ], "declarations": [ { "constant": false, "id": 22076, "mutability": "mutable", "name": "decimalsTokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4315:20:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22075, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "4315:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "id": 22080, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22077, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "4338:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 22079, "indexExpression": { "argumentTypes": null, "id": 22078, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4352:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4338:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "VariableDeclarationStatement", "src": "4315:45:58" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22083, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22081, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5169:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "id": 22082, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5186:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5169:31:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22102, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22100, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5325:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 22101, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5342:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5325:31:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 22119, "nodeType": "IfStatement", "src": "5321:141:58", "trueBody": { "id": 22118, "nodeType": "Block", "src": "5358:104:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22116, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22103, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5373:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22114, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "3130", "id": 22108, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "5409:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" }, "value": "10" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" } ], "id": 22107, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "5401:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22106, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5401:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22109, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5401:11:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22112, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22110, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5417:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 22111, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5434:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5417:31:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } ], "id": 22113, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5416:33:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5401:48:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 22104, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5386:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22105, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "mul", "nodeType": "MemberAccess", "referencedDeclaration": 22327, "src": "5386:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 22115, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5386:64:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5373:77:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22117, "nodeType": "ExpressionStatement", "src": "5373:77:58" } ] } }, "id": 22120, "nodeType": "IfStatement", "src": "5165:297:58", "trueBody": { "id": 22099, "nodeType": "Block", "src": "5202:104:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22097, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22084, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5217:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22095, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "3130", "id": 22089, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "5253:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" }, "value": "10" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" } ], "id": 22088, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "5245:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22087, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5245:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22090, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5245:11:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22093, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22091, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5261:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 22092, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5278:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5261:31:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } ], "id": 22094, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5260:33:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5245:48:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 22085, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5230:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22086, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "mul", "nodeType": "MemberAccess", "referencedDeclaration": 22327, "src": "5230:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 22096, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5230:64:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5217:77:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22098, "nodeType": "ExpressionStatement", "src": "5217:77:58" } ] } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 22121, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5482:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 22122, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5494:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 22123, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5481:24:58", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256)" } }, "functionReturnParameters": 22046, "id": 22124, "nodeType": "Return", "src": "5474:31:58" } ] }, "documentation": { "id": 22031, "nodeType": "StructuredDocumentation", "src": "3383:505:58", "text": " @dev returns the latest known rate between the two given tokens\n for a given pair of tokens A and B, returns the rate of A / B\n (the number of B units equivalent to a single A unit)\n the rate is returned as a fraction (numerator / denominator) for accuracy\n @param _tokenA token to get the rate of 1 unit of\n @param _tokenB token to get the rate of 1 `_tokenA` against\n @return numerator\n @return denominator" }, "functionSelector": "ae818004", "id": 22126, "implemented": true, "kind": "function", "modifiers": [ { "arguments": [ { "argumentTypes": null, "id": 22039, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4029:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 22040, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4038:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "id": 22041, "modifierName": { "argumentTypes": null, "id": 22038, "name": "supportedTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21984, "src": "4013:15:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$", "typeString": "modifier (contract IERC20Token,contract IERC20Token)" } }, "nodeType": "ModifierInvocation", "src": "4013:33:58" } ], "name": "latestRate", "nodeType": "FunctionDefinition", "overrides": { "id": 22037, "nodeType": "OverrideSpecifier", "overrides": [], "src": "3995:8:58" }, "parameters": { "id": 22036, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22033, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "3914:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22032, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3914:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22035, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "3935:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22034, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3935:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "3913:42:58" }, "returnParameters": { "id": 22046, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22043, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "4065:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22042, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4065:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22045, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "4074:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22044, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4074:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "4064:18:58" }, "scope": 22205, "src": "3894:1619:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 22877 ], "body": { "id": 22152, "nodeType": "Block", "src": "5736:259:58", "statements": [ { "assignments": [ 22134 ], "declarations": [ { "constant": false, "id": 22134, "mutability": "mutable", "name": "timestampA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22152, "src": "5804:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22133, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5804:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22138, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22135, "name": "tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21851, "src": "5825:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22136, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestTimestamp", "nodeType": "MemberAccess", "referencedDeclaration": 22820, "src": "5825:28:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 22137, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5825:30:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "5804:51:58" }, { "assignments": [ 22140 ], "declarations": [ { "constant": false, "id": 22140, "mutability": "mutable", "name": "timestampB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22152, "src": "5866:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22139, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5866:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22144, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22141, "name": "tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21854, "src": "5887:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22142, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestTimestamp", "nodeType": "MemberAccess", "referencedDeclaration": 22820, "src": "5887:28:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 22143, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5887:30:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "5866:51:58" }, { "expression": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22147, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22145, "name": "timestampA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22134, "src": "5938:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "id": 22146, "name": "timestampB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22140, "src": "5951:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5938:23:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 22149, "name": "timestampB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22140, "src": "5977:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22150, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "5938:49:58", "trueExpression": { "argumentTypes": null, "id": 22148, "name": "timestampA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22134, "src": "5964:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 22132, "id": 22151, "nodeType": "Return", "src": "5930:57:58" } ] }, "documentation": { "id": 22127, "nodeType": "StructuredDocumentation", "src": "5521:108:58", "text": " @dev returns the timestamp of the last price update\n @return timestamp" }, "functionSelector": "c8f33c91", "id": 22153, "implemented": true, "kind": "function", "modifiers": [], "name": "lastUpdateTime", "nodeType": "FunctionDefinition", "overrides": { "id": 22129, "nodeType": "OverrideSpecifier", "overrides": [], "src": "5700:8:58" }, "parameters": { "id": 22128, "nodeType": "ParameterList", "parameters": [], "src": "5658:2:58" }, "returnParameters": { "id": 22132, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22131, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22153, "src": "5727:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22130, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5727:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "5726:9:58" }, "scope": 22205, "src": "5635:360:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 22890 ], "body": { "id": 22183, "nodeType": "Block", "src": "6552:152:58", "statements": [ { "assignments": [ 22169, 22171 ], "declarations": [ { "constant": false, "id": 22169, "mutability": "mutable", "name": "numerator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22183, "src": "6564:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22168, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6564:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22171, "mutability": "mutable", "name": "denominator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22183, "src": "6583:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22170, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6583:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22176, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22173, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22156, "src": "6617:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 22174, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22158, "src": "6626:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 22172, "name": "latestRate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22126, "src": "6606:10:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$_t_uint256_$", "typeString": "function (contract IERC20Token,contract IERC20Token) view returns (uint256,uint256)" } }, "id": 22175, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6606:28:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256)" } }, "nodeType": "VariableDeclarationStatement", "src": "6563:71:58" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 22177, "name": "numerator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22169, "src": "6655:9:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 22178, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22171, "src": "6666:11:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 22179, "name": "lastUpdateTime", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22153, "src": "6679:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 22180, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6679:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 22181, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "6654:42:58", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256,uint256)" } }, "functionReturnParameters": 22167, "id": 22182, "nodeType": "Return", "src": "6647:49:58" } ] }, "documentation": { "id": 22154, "nodeType": "StructuredDocumentation", "src": "6003:370:58", "text": " @dev returns both the rate and the timestamp of the last update in a single call (gas optimization)\n @param _tokenA token to get the rate of 1 unit of\n @param _tokenB token to get the rate of 1 `_tokenA` against\n @return numerator\n @return denominator\n @return timestamp of the last update" }, "functionSelector": "b1772d7a", "id": 22184, "implemented": true, "kind": "function", "modifiers": [], "name": "latestRateAndUpdateTime", "nodeType": "FunctionDefinition", "overrides": { "id": 22160, "nodeType": "OverrideSpecifier", "overrides": [], "src": "6493:8:58" }, "parameters": { "id": 22159, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22156, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6412:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22155, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6412:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22158, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6433:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22157, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6433:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "6411:42:58" }, "returnParameters": { "id": 22167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22162, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6520:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22161, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6520:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22164, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6529:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22163, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6529:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22166, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6538:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6538:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "6519:27:58" }, "scope": 22205, "src": "6379:325:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "body": { "id": 22203, "nodeType": "Block", "src": "6834:128:58", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "id": 22194, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22192, "name": "_token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22187, "src": "6849:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 22193, "name": "ETH_ADDRESS", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21837, "src": "6859:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "6849:21:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 22198, "nodeType": "IfStatement", "src": "6845:73:58", "trueBody": { "id": 22197, "nodeType": "Block", "src": "6872:46:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22195, "name": "ETH_DECIMALS", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21840, "src": "6894:12:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "functionReturnParameters": 22191, "id": 22196, "nodeType": "Return", "src": "6887:19:58" } ] } }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22199, "name": "_token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22187, "src": "6937:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 22200, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "decimals", "nodeType": "MemberAccess", "referencedDeclaration": 21076, "src": "6937:15:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", "typeString": "function () view external returns (uint8)" } }, "id": 22201, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6937:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "functionReturnParameters": 22191, "id": 22202, "nodeType": "Return", "src": "6930:24:58" } ] }, "documentation": { "id": 22185, "nodeType": "StructuredDocumentation", "src": "6712:49:58", "text": "@dev returns the decimals of a given token " }, "id": 22204, "implemented": true, "kind": "function", "modifiers": [], "name": "decimals", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22188, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22187, "mutability": "mutable", "name": "_token", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22204, "src": "6785:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22186, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6785:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "6784:20:58" }, "returnParameters": { "id": 22191, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22190, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22204, "src": "6827:5:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22189, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "6827:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "src": "6826:7:58" }, "scope": 22205, "src": "6767:195:58", "stateMutability": "view", "virtual": false, "visibility": "private" } ], "scope": 22206, "src": "520:6445:58" } ], "src": "52:6915:58" }, "legacyAST": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/PriceOracle.sol", "exportedSymbols": { "PriceOracle": [ 22205 ] }, "id": 22206, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 21820, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "52:23:58" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/Utils.sol", "file": "./Utils.sol", "id": 21821, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22662, "src": "77:21:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol", "file": "./SafeMath.sol", "id": 21822, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22355, "src": "100:24:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IPriceOracle.sol", "file": "./interfaces/IPriceOracle.sol", "id": 21823, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22892, "src": "126:39:58", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/interfaces/IChainlinkPriceOracle.sol", "file": "./interfaces/IChainlinkPriceOracle.sol", "id": 21824, "nodeType": "ImportDirective", "scope": 22206, "sourceUnit": 22822, "src": "167:48:58", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 21826, "name": "IPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22891, "src": "544:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IPriceOracle_$22891", "typeString": "contract IPriceOracle" } }, "id": 21827, "nodeType": "InheritanceSpecifier", "src": "544:12:58" }, { "arguments": null, "baseName": { "contractScope": null, "id": 21828, "name": "Utils", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22661, "src": "558:5:58", "typeDescriptions": { "typeIdentifier": "t_contract$_Utils_$22661", "typeString": "contract Utils" } }, "id": 21829, "nodeType": "InheritanceSpecifier", "src": "558:5:58" } ], "contractDependencies": [ 22661, 22891 ], "contractKind": "contract", "documentation": { "id": 21825, "nodeType": "StructuredDocumentation", "src": "219:299:58", "text": " @dev Provides the off-chain rate between two tokens\n The price oracle uses chainlink oracles internally to get the rates of the two tokens\n with respect to a common denominator, and then returns the rate between them, which\n is equivalent to the rate of TokenA / TokenB" }, "fullyImplemented": true, "id": 22205, "linearizedBaseContracts": [ 22205, 22661, 22891 ], "name": "PriceOracle", "nodeType": "ContractDefinition", "nodes": [ { "id": 21832, "libraryName": { "contractScope": null, "id": 21830, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22354, "src": "577:8:58", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$22354", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "571:27:58", "typeName": { "id": 21831, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "590:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": true, "id": 21837, "mutability": "constant", "name": "ETH_ADDRESS", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "606:98:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21833, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "606:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "307845656565654565656545654565654565456545656545454565656565456565656565656545456545", "id": 21835, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "661:42:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "value": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 21834, "name": "IERC20Token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21127, "src": "649:11:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20Token_$21127_$", "typeString": "type(contract IERC20Token)" } }, "id": 21836, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "649:55:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "visibility": "private" }, { "constant": true, "id": 21840, "mutability": "constant", "name": "ETH_DECIMALS", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "711:40:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 21838, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "711:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": { "argumentTypes": null, "hexValue": "3138", "id": 21839, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "749:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_18_by_1", "typeString": "int_const 18" }, "value": "18" }, "visibility": "private" }, { "constant": false, "functionSelector": "0fc63d10", "id": 21842, "mutability": "mutable", "name": "tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "760:25:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21841, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "760:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "5f64b55b", "id": 21844, "mutability": "mutable", "name": "tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "824:25:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21843, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "824:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "8ee573ac", "id": 21848, "mutability": "mutable", "name": "tokenDecimals", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "888:51:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" }, "typeName": { "id": 21847, "keyType": { "contractScope": null, "id": 21845, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "897:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Mapping", "src": "888:30:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" }, "valueType": { "id": 21846, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "912:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } }, "value": null, "visibility": "public" }, { "baseFunctions": [ 22856 ], "constant": false, "functionSelector": "b9e1715b", "id": 21851, "mutability": "mutable", "name": "tokenAOracle", "nodeType": "VariableDeclaration", "overrides": { "id": 21850, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1007:8:58" }, "scope": 22205, "src": "978:50:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21849, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "978:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "public" }, { "baseFunctions": [ 22861 ], "constant": false, "functionSelector": "f997fda7", "id": 21854, "mutability": "mutable", "name": "tokenBOracle", "nodeType": "VariableDeclaration", "overrides": { "id": 21853, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1099:8:58" }, "scope": 22205, "src": "1070:50:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21852, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1070:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "cbd962d1", "id": 21858, "mutability": "mutable", "name": "tokensToOracles", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22205, "src": "1162:69:58", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" }, "typeName": { "id": 21857, "keyType": { "contractScope": null, "id": 21855, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1171:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Mapping", "src": "1162:46:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" }, "valueType": { "contractScope": null, "id": 21856, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1186:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } }, "value": null, "visibility": "public" }, { "body": { "id": 21934, "nodeType": "Block", "src": "1971:350:58", "statements": [ { "expression": { "argumentTypes": null, "id": 21892, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21890, "name": "tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21842, "src": "1982:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21891, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "1991:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "1982:16:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 21893, "nodeType": "ExpressionStatement", "src": "1982:16:58" }, { "expression": { "argumentTypes": null, "id": 21896, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21894, "name": "tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21844, "src": "2009:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21895, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2018:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "2009:16:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 21897, "nodeType": "ExpressionStatement", "src": "2009:16:58" }, { "expression": { "argumentTypes": null, "id": 21904, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21898, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "2036:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 21900, "indexExpression": { "argumentTypes": null, "id": 21899, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2050:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2036:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21902, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2070:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21901, "name": "decimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22204, "src": "2061:8:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint8_$", "typeString": "function (contract IERC20Token) view returns (uint8)" } }, "id": 21903, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2061:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "2036:42:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "id": 21905, "nodeType": "ExpressionStatement", "src": "2036:42:58" }, { "expression": { "argumentTypes": null, "id": 21912, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21906, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "2089:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 21908, "indexExpression": { "argumentTypes": null, "id": 21907, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2103:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2089:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21910, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2123:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21909, "name": "decimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22204, "src": "2114:8:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$returns$_t_uint8_$", "typeString": "function (contract IERC20Token) view returns (uint8)" } }, "id": 21911, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2114:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "2089:42:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "id": 21913, "nodeType": "ExpressionStatement", "src": "2089:42:58" }, { "expression": { "argumentTypes": null, "id": 21916, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21914, "name": "tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21851, "src": "2144:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21915, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "2159:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2144:28:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21917, "nodeType": "ExpressionStatement", "src": "2144:28:58" }, { "expression": { "argumentTypes": null, "id": 21920, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 21918, "name": "tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21854, "src": "2183:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21919, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "2198:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2183:28:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21921, "nodeType": "ExpressionStatement", "src": "2183:28:58" }, { "expression": { "argumentTypes": null, "id": 21926, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21922, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "2222:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 21924, "indexExpression": { "argumentTypes": null, "id": 21923, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "2238:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2222:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21925, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "2249:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2222:40:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21927, "nodeType": "ExpressionStatement", "src": "2222:40:58" }, { "expression": { "argumentTypes": null, "id": 21932, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 21928, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "2273:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 21930, "indexExpression": { "argumentTypes": null, "id": 21929, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "2289:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2273:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 21931, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "2300:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "src": "2273:40:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 21933, "nodeType": "ExpressionStatement", "src": "2273:40:58" } ] }, "documentation": { "id": 21859, "nodeType": "StructuredDocumentation", "src": "1284:388:58", "text": " @dev initializes a new PriceOracle instance\n note that the oracles must have the same common denominator (USD, ETH etc.)\n @param _tokenA first token to support\n @param _tokenB second token to support\n @param _tokenAOracle first token price oracle\n @param _tokenBOracle second token price oracle" }, "id": 21935, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21872, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21861, "src": "1860:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21871, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1852:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21870, "name": "address", "nodeType": "ElementaryTypeName", "src": "1852:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21873, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1852:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21876, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21863, "src": "1878:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21875, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1870:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21874, "name": "address", "nodeType": "ElementaryTypeName", "src": "1870:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21877, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1870:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 21878, "modifierName": { "argumentTypes": null, "id": 21869, "name": "validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21948, "src": "1831:20:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_address_$_t_address_$", "typeString": "modifier (address,address)" } }, "nodeType": "ModifierInvocation", "src": "1831:56:58" }, { "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21882, "name": "_tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21865, "src": "1926:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 21881, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1918:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21880, "name": "address", "nodeType": "ElementaryTypeName", "src": "1918:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21883, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1918:22:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21886, "name": "_tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21867, "src": "1950:13:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 21885, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1942:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21884, "name": "address", "nodeType": "ElementaryTypeName", "src": "1942:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21887, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1942:22:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 21888, "modifierName": { "argumentTypes": null, "id": 21879, "name": "validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21948, "src": "1897:20:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_address_$_t_address_$", "typeString": "modifier (address,address)" } }, "nodeType": "ModifierInvocation", "src": "1897:68:58" } ], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21868, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21861, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1690:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21860, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1690:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21863, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1711:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21862, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "1711:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21865, "mutability": "mutable", "name": "_tokenAOracle", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1732:35:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21864, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1732:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21867, "mutability": "mutable", "name": "_tokenBOracle", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21935, "src": "1769:35:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" }, "typeName": { "contractScope": null, "id": 21866, "name": "IChainlinkPriceOracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22821, "src": "1769:21:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "value": null, "visibility": "internal" } ], "src": "1689:116:58" }, "returnParameters": { "id": 21889, "nodeType": "ParameterList", "parameters": [], "src": "1971:0:58" }, "scope": 22205, "src": "1678:643:58", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 21947, "nodeType": "Block", "src": "2458:74:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21942, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21937, "src": "2491:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 21943, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21939, "src": "2502:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21941, "name": "_validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21971, "src": "2469:21:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address) pure" } }, "id": 21944, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2469:43:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21945, "nodeType": "ExpressionStatement", "src": "2469:43:58" }, { "id": 21946, "nodeType": "PlaceholderStatement", "src": "2523:1:58" } ] }, "documentation": null, "id": 21948, "name": "validUniqueAddresses", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 21940, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21937, "mutability": "mutable", "name": "_address1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21948, "src": "2420:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21936, "name": "address", "nodeType": "ElementaryTypeName", "src": "2420:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21939, "mutability": "mutable", "name": "_address2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21948, "src": "2439:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21938, "name": "address", "nodeType": "ElementaryTypeName", "src": "2439:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2419:38:58" }, "src": "2390:142:58", "virtual": false, "visibility": "internal" }, { "body": { "id": 21970, "nodeType": "Block", "src": "2670:140:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21956, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21950, "src": "2695:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21955, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "2681:13:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 21957, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2681:24:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21958, "nodeType": "ExpressionStatement", "src": "2681:24:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21960, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21952, "src": "2730:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21959, "name": "_validAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22634, "src": "2716:13:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$returns$__$", "typeString": "function (address) pure" } }, "id": 21961, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2716:24:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21962, "nodeType": "ExpressionStatement", "src": "2716:24:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 21966, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 21964, "name": "_address1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21950, "src": "2759:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 21965, "name": "_address2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21952, "src": "2772:9:58", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2759:22:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f53414d455f41444452455353", "id": 21967, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2783:18:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_f8a367a12797014b9e2f1d71cd920760e1c54a6511a9a16d5ab22fb4d28800b6", "typeString": "literal_string \"ERR_SAME_ADDRESS\"" }, "value": "ERR_SAME_ADDRESS" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_f8a367a12797014b9e2f1d71cd920760e1c54a6511a9a16d5ab22fb4d28800b6", "typeString": "literal_string \"ERR_SAME_ADDRESS\"" } ], "id": 21963, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "2751:7:58", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 21968, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2751:51:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21969, "nodeType": "ExpressionStatement", "src": "2751:51:58" } ] }, "documentation": null, "id": 21971, "implemented": true, "kind": "function", "modifiers": [], "name": "_validUniqueAddresses", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21953, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21950, "mutability": "mutable", "name": "_address1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21971, "src": "2618:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21949, "name": "address", "nodeType": "ElementaryTypeName", "src": "2618:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21952, "mutability": "mutable", "name": "_address2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21971, "src": "2637:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 21951, "name": "address", "nodeType": "ElementaryTypeName", "src": "2637:7:58", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2617:38:58" }, "returnParameters": { "id": 21954, "nodeType": "ParameterList", "parameters": [], "src": "2670:0:58" }, "scope": 22205, "src": "2587:223:58", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 21983, "nodeType": "Block", "src": "2954:65:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21978, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21973, "src": "2982:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 21979, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21975, "src": "2991:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21977, "name": "_supportedTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22030, "src": "2965:16:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$returns$__$", "typeString": "function (contract IERC20Token,contract IERC20Token) view" } }, "id": 21980, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2965:34:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 21981, "nodeType": "ExpressionStatement", "src": "2965:34:58" }, { "id": 21982, "nodeType": "PlaceholderStatement", "src": "3010:1:58" } ] }, "documentation": null, "id": 21984, "name": "supportedTokens", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 21976, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21973, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21984, "src": "2912:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21972, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "2912:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21975, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 21984, "src": "2933:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21974, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "2933:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "2911:42:58" }, "src": "2887:132:58", "virtual": false, "visibility": "internal" }, { "body": { "id": 22029, "nodeType": "Block", "src": "3156:219:58", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21994, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21986, "src": "3197:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21993, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3189:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21992, "name": "address", "nodeType": "ElementaryTypeName", "src": "3189:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21995, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3189:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 21998, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21988, "src": "3215:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 21997, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3207:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 21996, "name": "address", "nodeType": "ElementaryTypeName", "src": "3207:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 21999, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3207:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 21991, "name": "_validUniqueAddresses", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21971, "src": "3167:21:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address) pure" } }, "id": 22000, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3167:57:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22001, "nodeType": "ExpressionStatement", "src": "3167:57:58" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 22025, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22013, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22005, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "3251:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22007, "indexExpression": { "argumentTypes": null, "id": 22006, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21986, "src": "3267:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "3251:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 22004, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3243:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22003, "name": "address", "nodeType": "ElementaryTypeName", "src": "3243:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22008, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3243:33:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22011, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3288:1:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22010, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3280:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22009, "name": "address", "nodeType": "ElementaryTypeName", "src": "3280:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22012, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3280:10:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "3243:47:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 22024, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22016, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "3302:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22018, "indexExpression": { "argumentTypes": null, "id": 22017, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21988, "src": "3318:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "3302:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } ], "id": 22015, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3294:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22014, "name": "address", "nodeType": "ElementaryTypeName", "src": "3294:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22019, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3294:33:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 22022, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3339:1:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 22021, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "3331:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 22020, "name": "address", "nodeType": "ElementaryTypeName", "src": "3331:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22023, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3331:10:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "3294:47:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "3243:98:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4552525f554e535550504f525445445f544f4b454e", "id": 22026, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "3343:23:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_fe5e253e0ad9d51f460b73c35652983a29904d3e214ecea083c7dec391c7b884", "typeString": "literal_string \"ERR_UNSUPPORTED_TOKEN\"" }, "value": "ERR_UNSUPPORTED_TOKEN" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_fe5e253e0ad9d51f460b73c35652983a29904d3e214ecea083c7dec391c7b884", "typeString": "literal_string \"ERR_UNSUPPORTED_TOKEN\"" } ], "id": 22002, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "3235:7:58", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 22027, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3235:132:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 22028, "nodeType": "ExpressionStatement", "src": "3235:132:58" } ] }, "documentation": null, "id": 22030, "implemented": true, "kind": "function", "modifiers": [], "name": "_supportedTokens", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 21989, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 21986, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22030, "src": "3100:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21985, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3100:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 21988, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22030, "src": "3121:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 21987, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3121:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "3099:42:58" }, "returnParameters": { "id": 21990, "nodeType": "ParameterList", "parameters": [], "src": "3156:0:58" }, "scope": 22205, "src": "3074:301:58", "stateMutability": "view", "virtual": false, "visibility": "internal" }, { "baseFunctions": [ 22872 ], "body": { "id": 22125, "nodeType": "Block", "src": "4088:1425:58", "statements": [ { "assignments": [ 22048 ], "declarations": [ { "constant": false, "id": 22048, "mutability": "mutable", "name": "rateTokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4099:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22047, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4099:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22057, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22051, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "4128:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22053, "indexExpression": { "argumentTypes": null, "id": 22052, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4144:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4128:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22054, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestAnswer", "nodeType": "MemberAccess", "referencedDeclaration": 22815, "src": "4128:37:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_int256_$", "typeString": "function () view external returns (int256)" } }, "id": 22055, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4128:39:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int256", "typeString": "int256" } ], "id": 22050, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "4120:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22049, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4120:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22056, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4120:48:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "4099:69:58" }, { "assignments": [ 22059 ], "declarations": [ { "constant": false, "id": 22059, "mutability": "mutable", "name": "rateTokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4179:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22058, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4179:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22068, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22062, "name": "tokensToOracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21858, "src": "4208:15:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_contract$_IChainlinkPriceOracle_$22821_$", "typeString": "mapping(contract IERC20Token => contract IChainlinkPriceOracle)" } }, "id": 22064, "indexExpression": { "argumentTypes": null, "id": 22063, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4224:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4208:24:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22065, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestAnswer", "nodeType": "MemberAccess", "referencedDeclaration": 22815, "src": "4208:37:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_int256_$", "typeString": "function () view external returns (int256)" } }, "id": 22066, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4208:39:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int256", "typeString": "int256" } ], "id": 22061, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "4200:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22060, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4200:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22067, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "4200:48:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "4179:69:58" }, { "assignments": [ 22070 ], "declarations": [ { "constant": false, "id": 22070, "mutability": "mutable", "name": "decimalsTokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4259:20:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22069, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "4259:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "id": 22074, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22071, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "4282:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 22073, "indexExpression": { "argumentTypes": null, "id": 22072, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4296:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4282:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "VariableDeclarationStatement", "src": "4259:45:58" }, { "assignments": [ 22076 ], "declarations": [ { "constant": false, "id": 22076, "mutability": "mutable", "name": "decimalsTokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22125, "src": "4315:20:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22075, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "4315:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "id": 22080, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 22077, "name": "tokenDecimals", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21848, "src": "4338:13:58", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_contract$_IERC20Token_$21127_$_t_uint8_$", "typeString": "mapping(contract IERC20Token => uint8)" } }, "id": 22079, "indexExpression": { "argumentTypes": null, "id": 22078, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4352:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "4338:22:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "VariableDeclarationStatement", "src": "4315:45:58" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22083, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22081, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5169:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "id": 22082, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5186:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5169:31:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22102, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22100, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5325:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 22101, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5342:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5325:31:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 22119, "nodeType": "IfStatement", "src": "5321:141:58", "trueBody": { "id": 22118, "nodeType": "Block", "src": "5358:104:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22116, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22103, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5373:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22114, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "3130", "id": 22108, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "5409:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" }, "value": "10" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" } ], "id": 22107, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "5401:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22106, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5401:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22109, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5401:11:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22112, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22110, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5417:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 22111, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5434:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5417:31:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } ], "id": 22113, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5416:33:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5401:48:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 22104, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5386:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22105, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "mul", "nodeType": "MemberAccess", "referencedDeclaration": 22327, "src": "5386:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 22115, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5386:64:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5373:77:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22117, "nodeType": "ExpressionStatement", "src": "5373:77:58" } ] } }, "id": 22120, "nodeType": "IfStatement", "src": "5165:297:58", "trueBody": { "id": 22099, "nodeType": "Block", "src": "5202:104:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22097, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22084, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5217:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22095, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "3130", "id": 22089, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "5253:2:58", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" }, "value": "10" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" } ], "id": 22088, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "5245:7:58", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 22087, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5245:7:58", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 22090, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5245:11:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 22093, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22091, "name": "decimalsTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22070, "src": "5261:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 22092, "name": "decimalsTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22076, "src": "5278:14:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5261:31:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } } ], "id": 22094, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5260:33:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "5245:48:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 22085, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5230:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22086, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "mul", "nodeType": "MemberAccess", "referencedDeclaration": 22327, "src": "5230:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 22096, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5230:64:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5217:77:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22098, "nodeType": "ExpressionStatement", "src": "5217:77:58" } ] } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 22121, "name": "rateTokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22048, "src": "5482:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 22122, "name": "rateTokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22059, "src": "5494:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 22123, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "5481:24:58", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256)" } }, "functionReturnParameters": 22046, "id": 22124, "nodeType": "Return", "src": "5474:31:58" } ] }, "documentation": { "id": 22031, "nodeType": "StructuredDocumentation", "src": "3383:505:58", "text": " @dev returns the latest known rate between the two given tokens\n for a given pair of tokens A and B, returns the rate of A / B\n (the number of B units equivalent to a single A unit)\n the rate is returned as a fraction (numerator / denominator) for accuracy\n @param _tokenA token to get the rate of 1 unit of\n @param _tokenB token to get the rate of 1 `_tokenA` against\n @return numerator\n @return denominator" }, "functionSelector": "ae818004", "id": 22126, "implemented": true, "kind": "function", "modifiers": [ { "arguments": [ { "argumentTypes": null, "id": 22039, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22033, "src": "4029:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 22040, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22035, "src": "4038:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "id": 22041, "modifierName": { "argumentTypes": null, "id": 22038, "name": "supportedTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21984, "src": "4013:15:58", "typeDescriptions": { "typeIdentifier": "t_modifier$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$", "typeString": "modifier (contract IERC20Token,contract IERC20Token)" } }, "nodeType": "ModifierInvocation", "src": "4013:33:58" } ], "name": "latestRate", "nodeType": "FunctionDefinition", "overrides": { "id": 22037, "nodeType": "OverrideSpecifier", "overrides": [], "src": "3995:8:58" }, "parameters": { "id": 22036, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22033, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "3914:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22032, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3914:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22035, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "3935:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22034, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "3935:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "3913:42:58" }, "returnParameters": { "id": 22046, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22043, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "4065:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22042, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4065:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22045, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22126, "src": "4074:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22044, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "4074:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "4064:18:58" }, "scope": 22205, "src": "3894:1619:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 22877 ], "body": { "id": 22152, "nodeType": "Block", "src": "5736:259:58", "statements": [ { "assignments": [ 22134 ], "declarations": [ { "constant": false, "id": 22134, "mutability": "mutable", "name": "timestampA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22152, "src": "5804:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22133, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5804:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22138, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22135, "name": "tokenAOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21851, "src": "5825:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22136, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestTimestamp", "nodeType": "MemberAccess", "referencedDeclaration": 22820, "src": "5825:28:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 22137, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5825:30:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "5804:51:58" }, { "assignments": [ 22140 ], "declarations": [ { "constant": false, "id": 22140, "mutability": "mutable", "name": "timestampB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22152, "src": "5866:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22139, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5866:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22144, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22141, "name": "tokenBOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21854, "src": "5887:12:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IChainlinkPriceOracle_$22821", "typeString": "contract IChainlinkPriceOracle" } }, "id": 22142, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "latestTimestamp", "nodeType": "MemberAccess", "referencedDeclaration": 22820, "src": "5887:28:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 22143, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "5887:30:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "5866:51:58" }, { "expression": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22147, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22145, "name": "timestampA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22134, "src": "5938:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "id": 22146, "name": "timestampB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22140, "src": "5951:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "5938:23:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 22149, "name": "timestampB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22140, "src": "5977:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 22150, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "5938:49:58", "trueExpression": { "argumentTypes": null, "id": 22148, "name": "timestampA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22134, "src": "5964:10:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 22132, "id": 22151, "nodeType": "Return", "src": "5930:57:58" } ] }, "documentation": { "id": 22127, "nodeType": "StructuredDocumentation", "src": "5521:108:58", "text": " @dev returns the timestamp of the last price update\n @return timestamp" }, "functionSelector": "c8f33c91", "id": 22153, "implemented": true, "kind": "function", "modifiers": [], "name": "lastUpdateTime", "nodeType": "FunctionDefinition", "overrides": { "id": 22129, "nodeType": "OverrideSpecifier", "overrides": [], "src": "5700:8:58" }, "parameters": { "id": 22128, "nodeType": "ParameterList", "parameters": [], "src": "5658:2:58" }, "returnParameters": { "id": 22132, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22131, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22153, "src": "5727:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22130, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "5727:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "5726:9:58" }, "scope": 22205, "src": "5635:360:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 22890 ], "body": { "id": 22183, "nodeType": "Block", "src": "6552:152:58", "statements": [ { "assignments": [ 22169, 22171 ], "declarations": [ { "constant": false, "id": 22169, "mutability": "mutable", "name": "numerator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22183, "src": "6564:17:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22168, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6564:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22171, "mutability": "mutable", "name": "denominator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22183, "src": "6583:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22170, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6583:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 22176, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 22173, "name": "_tokenA", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22156, "src": "6617:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, { "argumentTypes": null, "id": 22174, "name": "_tokenB", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22158, "src": "6626:7:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } ], "id": 22172, "name": "latestRate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22126, "src": "6606:10:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_contract$_IERC20Token_$21127_$_t_contract$_IERC20Token_$21127_$returns$_t_uint256_$_t_uint256_$", "typeString": "function (contract IERC20Token,contract IERC20Token) view returns (uint256,uint256)" } }, "id": 22175, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6606:28:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256)" } }, "nodeType": "VariableDeclarationStatement", "src": "6563:71:58" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 22177, "name": "numerator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22169, "src": "6655:9:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 22178, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22171, "src": "6666:11:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 22179, "name": "lastUpdateTime", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22153, "src": "6679:14:58", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 22180, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6679:16:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 22181, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "6654:42:58", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", "typeString": "tuple(uint256,uint256,uint256)" } }, "functionReturnParameters": 22167, "id": 22182, "nodeType": "Return", "src": "6647:49:58" } ] }, "documentation": { "id": 22154, "nodeType": "StructuredDocumentation", "src": "6003:370:58", "text": " @dev returns both the rate and the timestamp of the last update in a single call (gas optimization)\n @param _tokenA token to get the rate of 1 unit of\n @param _tokenB token to get the rate of 1 `_tokenA` against\n @return numerator\n @return denominator\n @return timestamp of the last update" }, "functionSelector": "b1772d7a", "id": 22184, "implemented": true, "kind": "function", "modifiers": [], "name": "latestRateAndUpdateTime", "nodeType": "FunctionDefinition", "overrides": { "id": 22160, "nodeType": "OverrideSpecifier", "overrides": [], "src": "6493:8:58" }, "parameters": { "id": 22159, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22156, "mutability": "mutable", "name": "_tokenA", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6412:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22155, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6412:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22158, "mutability": "mutable", "name": "_tokenB", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6433:19:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22157, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6433:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "6411:42:58" }, "returnParameters": { "id": 22167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22162, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6520:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22161, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6520:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22164, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6529:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22163, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6529:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22166, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22184, "src": "6538:7:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 22165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "6538:7:58", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "6519:27:58" }, "scope": 22205, "src": "6379:325:58", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "body": { "id": 22203, "nodeType": "Block", "src": "6834:128:58", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "id": 22194, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 22192, "name": "_token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22187, "src": "6849:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 22193, "name": "ETH_ADDRESS", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21837, "src": "6859:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "src": "6849:21:58", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 22198, "nodeType": "IfStatement", "src": "6845:73:58", "trueBody": { "id": 22197, "nodeType": "Block", "src": "6872:46:58", "statements": [ { "expression": { "argumentTypes": null, "id": 22195, "name": "ETH_DECIMALS", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 21840, "src": "6894:12:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "functionReturnParameters": 22191, "id": 22196, "nodeType": "Return", "src": "6887:19:58" } ] } }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 22199, "name": "_token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22187, "src": "6937:6:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "id": 22200, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "decimals", "nodeType": "MemberAccess", "referencedDeclaration": 21076, "src": "6937:15:58", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", "typeString": "function () view external returns (uint8)" } }, "id": 22201, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "6937:17:58", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "functionReturnParameters": 22191, "id": 22202, "nodeType": "Return", "src": "6930:24:58" } ] }, "documentation": { "id": 22185, "nodeType": "StructuredDocumentation", "src": "6712:49:58", "text": "@dev returns the decimals of a given token " }, "id": 22204, "implemented": true, "kind": "function", "modifiers": [], "name": "decimals", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 22188, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22187, "mutability": "mutable", "name": "_token", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22204, "src": "6785:18:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" }, "typeName": { "contractScope": null, "id": 22186, "name": "IERC20Token", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 21127, "src": "6785:11:58", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20Token_$21127", "typeString": "contract IERC20Token" } }, "value": null, "visibility": "internal" } ], "src": "6784:20:58" }, "returnParameters": { "id": 22191, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 22190, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 22204, "src": "6827:5:58", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 22189, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "6827:5:58", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "src": "6826:7:58" }, "scope": 22205, "src": "6767:195:58", "stateMutability": "view", "virtual": false, "visibility": "private" } ], "scope": 22206, "src": "520:6445:58" } ], "src": "52:6915:58" }, "compiler": { "name": "solc", "version": "0.6.12+commit.27d51765.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.2.3", "updatedAt": "2020-10-20T08:24:47.841Z", "devdoc": { "details": "Provides the off-chain rate between two tokens The price oracle uses chainlink oracles internally to get the rates of the two tokens with respect to a common denominator, and then returns the rate between them, which is equivalent to the rate of TokenA / TokenB", "kind": "dev", "methods": { "constructor": { "details": "initializes a new PriceOracle instance note that the oracles must have the same common denominator (USD, ETH etc.)", "params": { "_tokenA": "first token to support", "_tokenAOracle": "first token price oracle", "_tokenB": "second token to support", "_tokenBOracle": "second token price oracle" } }, "lastUpdateTime()": { "details": "returns the timestamp of the last price update", "returns": { "_0": "timestamp" } }, "latestRate(address,address)": { "details": "returns the latest known rate between the two given tokens for a given pair of tokens A and B, returns the rate of A / B (the number of B units equivalent to a single A unit) the rate is returned as a fraction (numerator / denominator) for accuracy", "params": { "_tokenA": "token to get the rate of 1 unit of", "_tokenB": "token to get the rate of 1 `_tokenA` against" }, "returns": { "_0": "numerator", "_1": "denominator" } }, "latestRateAndUpdateTime(address,address)": { "details": "returns both the rate and the timestamp of the last update in a single call (gas optimization)", "params": { "_tokenA": "token to get the rate of 1 unit of", "_tokenB": "token to get the rate of 1 `_tokenA` against" }, "returns": { "_0": "numerator", "_1": "denominator", "_2": "timestamp of the last update" } } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }