IDelayedOracle

Git Source

Inherits: IBaseOracle

Functions

priceSource

Address of the non-delayed price source

Assumes that the price source is a valid IBaseOracle

function priceSource() external view returns (IBaseOracle _priceSource);

getNextResultWithValidity

The next valid price feed, taking effect at the next updateResult call

function getNextResultWithValidity() external view returns (uint256 _result, bool _validity);

Returns

NameTypeDescription
_resultuint256The value in 18 decimals format of the next price feed
_validityboolWhether the next price feed is valid or not

updateDelay

The delay in seconds that should elapse between updates

function updateDelay() external view returns (uint256 _updateDelay);

lastUpdateTime

The timestamp of the last update

function lastUpdateTime() external view returns (uint256 _lastUpdateTime);

shouldUpdate

Indicates if a delay has passed since the last update

function shouldUpdate() external view returns (bool _ok);

Returns

NameTypeDescription
_okboolWhether the oracle should be updated or not

updateResult

Updates the current price with the last next price, and reads the next price feed

Will revert if the delay since last update has not elapsed

function updateResult() external returns (bool _success);

Returns

NameTypeDescription
_successboolWhether the update was successful or not

Events

UpdateResult

Emitted when the oracle is updated

event UpdateResult(uint256 _newMedian, uint256 _lastUpdateTime);

Parameters

NameTypeDescription
_newMedianuint256The new median value
_lastUpdateTimeuint256The timestamp of the update

Errors

DelayedOracle_NullPriceSource

Throws if the provided price source address is null

error DelayedOracle_NullPriceSource();

DelayedOracle_NullDelay

Throws if the provided delay is null

error DelayedOracle_NullDelay();

DelayedOracle_DelayHasNotElapsed

Throws when trying to update the oracle before the delay has elapsed

error DelayedOracle_DelayHasNotElapsed();

DelayedOracle_NoCurrentValue

Throws when trying to read the current value and it is invalid

error DelayedOracle_NoCurrentValue();

Structs

Feed

struct Feed {
  uint256 value;
  bool isValid;
}