DenominatedOracle
Inherits: IBaseOracle, IDenominatedOracle
Transforms two price feeds with a shared token into a new denominated price feed between the other two tokens of the feeds
Requires an external base price feed with a shared token between the price source and the denomination price source
State Variables
priceSource
Address of the base price source that is used to calculate the price
Assumes that the price source is a valid IBaseOracle
IBaseOracle public priceSource;
denominationPriceSource
Address of the base price source that is used to calculate the denominated price
Assumes that the price source is a valid IBaseOracle
IBaseOracle public denominationPriceSource;
symbol
Concatenated symbols of the two price sources used for quoting (e.g. '(WBTC / ETH) * (ETH / USD)')
The order of the symbols must follow a continuous chain of tokens
string public symbol;
inverted
Whether the price source quote should be inverted or not
Used to fix an inverted path of token quotes into a continuous chain of tokens (e.g. '(ETH / WBTC)^-1 * (ETH / USD)')
bool public inverted;
Functions
constructor
constructor(IBaseOracle _priceSource, IBaseOracle _denominationPriceSource, bool _inverted);
Parameters
Name | Type | Description |
---|---|---|
_priceSource | IBaseOracle | Address of the base price source that is used to calculate the price |
_denominationPriceSource | IBaseOracle | Address of the denomination price source that is used to calculate price |
_inverted | bool | Flag that indicates whether the price source quote should be inverted or not |
getResultWithValidity
Fetch the latest oracle result and whether it is valid or not
This method should never revert
function getResultWithValidity() external view returns (uint256 _result, bool _validity);
read
Fetch the latest oracle result
Will revert if is the price feed is invalid
function read() external view returns (uint256 _result);