FluidOracleL2 ​
Inherits:IFluidOracle, OracleError
Base contract that any Fluid Oracle L2 must implement
State Variables ​
_SEQUENCER_ORACLE ​
Chainlink L2 Sequencer Uptime feed to detect sequencer outages
IChainlinkAggregatorV3 internal _SEQUENCER_ORACLE;
_SEQUENCER_MAX_GRACE_PERIOD ​
max time period until oracle assumes normal behavior after a sequencer outage.
uint256 internal constant _SEQUENCER_MAX_GRACE_PERIOD = 45 minutes;
Functions ​
constructor ​
sets the L2 sequencer uptime Chainlink feed
constructor(address sequencerUptimeFeed_);
sequencerL2Data ​
returns all sequencer uptime feed related data
function sequencerL2Data()
public
view
returns (
address sequencerUptimeFeed_,
uint256 maxGracePeriod_,
bool isSequencerUp_,
uint256 lastUptimeStartedAt_,
uint256 gracePeriod_,
bool gracePeriodPassed_,
uint256 lastOutageStartedAt_,
bool isSequencerUpAndValid_
);
_ensureSequencerUpAndValid ​
ensures that the sequencer is up and grace period has passed
function _ensureSequencerUpAndValid() internal view;
getExchangeRate ​
Deprecated. Use getExchangeRateOperate()
and getExchangeRateLiquidate()
instead. Only implemented for backwards compatibility.
function getExchangeRate() external view virtual returns (uint256 exchangeRate_);
getExchangeRateOperate ​
Get the exchangeRate_
between the underlying asset and the peg asset in 1e27 for operates
function getExchangeRateOperate() external view virtual returns (uint256 exchangeRate_);
getExchangeRateLiquidate ​
Get the exchangeRate_
between the underlying asset and the peg asset in 1e27 for liquidations
function getExchangeRateLiquidate() external view virtual returns (uint256 exchangeRate_);
_lastSequencerOutageStart ​
finds last round before uptimeStartRoundId_
where sequencer status was down, incl. handling cases of consecutive rounds where status was down.
function _lastSequencerOutageStart(uint80 uptimeStartRoundId_) private view returns (uint256 outageStartedAt_);
_sequencerUpStatus ​
finds last round where sequencer status was up, incl. handling cases of consecutive rounds where status was up.
function _sequencerUpStatus()
private
view
returns (bool isSequencerUp_, uint80 uptimeStartRoundId_, uint256 uptimeStartedAt_);
_gracePeriod ​
returns the gracePeriod_
duration and if the grace period has passed_
based on current uptime round data vs the last sequencer outage duration.
function _gracePeriod(uint80 uptimeStartRoundId_, uint256 uptimeStartedAt_)
private
view
returns (uint256 gracePeriod_, bool passed_, uint256 outageStartedAt_);