OracleManager.sol
OracleManager
The Oracle Manager stores oracle implementations. External contracts can call getPrice
to get the price of an asset.
oracles
Active oracle implementations.
Stored in priority order.
numOracles
The number of active oracle implementations.
quoteAsset
The ERC20 in which the price is quoted.
MIN_SUPPORTED_ORACLES
The minimum number of supported oracles.
MAX_SUPPORTED_ORACLES
The maximum number of supported oracles.
constructor
Sets the ERC20 in which the price is quoted.
Parameters
_quoteAsset
address
the address of the quote token.
getPrice
Returns the price of the asset quoted in terms of the base asset.
Iterates through oracles
in order, and calls IBasePriceOracle.getPrice()
if the oracle supports the asset. Reverts if no oracle supports by asset.
Parameters
_asset
address
the address of the asset to quote.
Return Values
[0]
uint256
The price of the asset in WAD.
setOracles
Sets the oracle implementations.
First it zeroes out the oracles
array in storage. It copies elements from _oracles
then updates numOracles
. 10 >= number of oracles > 0. Can be called only by the owner.
Parameters
_oracles
contract IBasePriceOracle[]
an array of IBasePriceOracle
implementations.
getOracles
Retrieves the oracle implementations.
Used for off-chain data retrieval.
Return Values
_oracles
contract IBasePriceOracle[]
The current active oracle implementations in iteration order.
Last updated