IDelayedOracle
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
Name | Type | Description |
---|---|---|
_result | uint256 | The value in 18 decimals format of the next price feed |
_validity | bool | Whether 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
Name | Type | Description |
---|---|---|
_ok | bool | Whether 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
Name | Type | Description |
---|---|---|
_success | bool | Whether the update was successful or not |
Events
UpdateResult
Emitted when the oracle is updated
event UpdateResult(uint256 _newMedian, uint256 _lastUpdateTime);
Parameters
Name | Type | Description |
---|---|---|
_newMedian | uint256 | The new median value |
_lastUpdateTime | uint256 | The 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;
}