HardcodedOracle

Git Source

Inherits: IBaseOracle

This oracle is used to simulate a price source that returns a hardcoded price

State Variables

price

The hardcoded price the oracle returns [wad]

uint256 public price;

symbol

Symbol of the quote: token / baseToken (e.g. 'ETH / USD')

string public symbol;

Functions

constructor

constructor(string memory _symbol, uint256 _price);

Parameters

NameTypeDescription
_symbolstringThe symbol of the oracle
_priceuint256The hardcoded price the oracle returns [wad]

getResultWithValidity

Fetch the latest oracle result and whether it is valid or not

This method should never revert

function getResultWithValidity() external view returns (uint256 _price, bool _validity);

read

Fetch the latest oracle result

Will revert if is the price feed is invalid

function read() external view returns (uint256 _value);