OracleManager.sol

OracleManager

The Oracle Manager stores oracle implementations. External contracts can call getPrice to get the price of an asset.

oracles

contract IBasePriceOracle[] oracles

Active oracle implementations.

Stored in priority order.

numOracles

uint256 numOracles

The number of active oracle implementations.

quoteAsset

address quoteAsset

The ERC20 in which the price is quoted.

MIN_SUPPORTED_ORACLES

uint256 MIN_SUPPORTED_ORACLES

The minimum number of supported oracles.

MAX_SUPPORTED_ORACLES

uint256 MAX_SUPPORTED_ORACLES

The maximum number of supported oracles.

constructor

constructor(address _quoteAsset) public

Sets the ERC20 in which the price is quoted.

Parameters

getPrice

function getPrice(address _asset) external view returns (uint256)

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

Return Values

setOracles

function setOracles(contract IBasePriceOracle[] _oracles) external

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

getOracles

function getOracles() external view returns (contract IBasePriceOracle[] _oracles)

Retrieves the oracle implementations.

Used for off-chain data retrieval.

Return Values

Last updated