FluidUsdOracleSequencerL2 ​
Inherits:Error
Title: FluidUsdOracleSequencerL2
L2 Chainlink sequencer uptime feed reads, grace-period math, and sequencerL2Data() view.
Core sequencer algorithm is copied 1:1 from contracts/oracle/fluidOracleL2.sol (FluidOracleL2). Intentional differences from v1 FluidOracleL2:
_ensureSequencerUpAndValid()usesFluidUsdOracleErrorwithUsdOracle__SequencerDownandUsdOracle__SequencerGracePeriodinstead of a singleFluidOracleL2__SequencerOutage.- Constructor rejects
sequencerUptimeFeed_ == address(0)(UsdOracle-specific).
Constants ​
_SEQUENCER_ORACLE ​
Chainlink L2 Sequencer Uptime feed to detect sequencer outages
IChainlinkAggregatorV3 internal immutable _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 minutesFunctions ​
constructor ​
Stores the Chainlink L2 sequencer uptime feed used for outage and grace-period checks.
constructor(address sequencerUptimeFeed_) ;Parameters
| Name | Type | Description |
|---|---|---|
sequencerUptimeFeed_ | address | Chainlink sequencer uptime aggregator; must be a contract, not address(0). |
sequencerL2Data ​
Exposes Chainlink sequencer uptime feed state and grace-period diagnostics for off-chain monitoring and debugging.
When the sequencer is up, gracePeriod_ is the outage-duration-based grace window (capped at maxGracePeriod_). When the sequencer is down, gracePeriod_ is set to maxGracePeriod_ and lastOutageStartedAt_ is derived from feed rounds.
function sequencerL2Data()
public
view
returns (
address sequencerUptimeFeed_,
uint256 maxGracePeriod_,
bool isSequencerUp_,
uint256 lastUptimeStartedAt_,
uint256 gracePeriod_,
bool gracePeriodPassed_,
uint256 lastOutageStartedAt_,
bool isSequencerUpAndValid_
);Returns
| Name | Type | Description |
|---|---|---|
sequencerUptimeFeed_ | address | Chainlink IChainlinkAggregatorV3 sequencer uptime feed used by this contract. |
maxGracePeriod_ | uint256 | Upper bound on the grace period after a sequencer outage (_SEQUENCER_MAX_GRACE_PERIOD). |
isSequencerUp_ | bool | True if the feed’s latest answer indicates the sequencer is currently up (Chainlink convention: answer 0 = up). |
lastUptimeStartedAt_ | uint256 | Timestamp at the start of the current consecutive uptime window (0 if sequencer is down). |
gracePeriod_ | uint256 | Required wait after uptime resumes before prices are considered valid (capped); see @dev. |
gracePeriodPassed_ | bool | True if block.timestamp - lastUptimeStartedAt_ exceeds gracePeriod_ while the sequencer is up. |
lastOutageStartedAt_ | uint256 | Timestamp when the preceding downtime began (used for grace math; 0 when not applicable). |
isSequencerUpAndValid_ | bool | isSequencerUp_ && gracePeriodPassed_; matches _ensureSequencerUpAndValid() success conditions. |
_ensureSequencerUpAndValid ​
Reverts with UsdOracle__SequencerDown if the feed reports the sequencer down, or UsdOracle__SequencerGracePeriod if the sequencer is up but the grace window after the last outage has not elapsed.
function _ensureSequencerUpAndValid() internal view;_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_);