Skip to content

FallbackCLRSOracleL2 ​

Git Source

Inherits:FluidOracleL2, FallbackCLRSOracle

Title: Chainlink / Redstone Oracle (with fallback) for Layer 2 (with sequencer outage detection)

Gets the exchange rate between the underlying asset and the peg asset by using: the price from a Chainlink price feed or a Redstone Oracle with one of them being used as main source and the other one acting as a fallback if the main source fails for any reason. Reverts if fetched rate is 0.

Functions ​

constructor ​

sets the main source, Chainlink Oracle and Redstone Oracle data.

solidity
constructor(
    string memory infoName_,
    uint8 targetDecimals_,
    CLRSConstructorParams memory cLRSParams_,
    address sequencerUptimeFeed_
)
    FallbackCLRSOracle(
        infoName_, targetDecimals_, cLRSParams_.mainSource, cLRSParams_.chainlinkParams, cLRSParams_.redstoneOracle
    )
    FluidOracleL2(sequencerUptimeFeed_);

Parameters

NameTypeDescription
infoName_stringOracle identify helper name.
targetDecimals_uint8
cLRSParams_CLRSConstructorParamsCLRS Fallback Oracle data
sequencerUptimeFeed_addressL2 sequencer uptime Chainlink feed

getExchangeRateOperate ​

solidity
function getExchangeRateOperate()
    public
    view
    virtual
    override(FallbackCLRSOracle, FluidOracleL2)
    returns (uint256 exchangeRate_);

getExchangeRateLiquidate ​

solidity
function getExchangeRateLiquidate()
    public
    view
    virtual
    override(FallbackCLRSOracle, FluidOracleL2)
    returns (uint256 exchangeRate_);

getExchangeRate ​

solidity
function getExchangeRate()
    public
    view
    virtual
    override(FallbackCLRSOracle, FluidOracleL2)
    returns (uint256 exchangeRate_);

Structs ​

CLRSConstructorParams ​

solidity
struct CLRSConstructorParams {
    /// @param mainSource                     which oracle to use as main source for wstETH <> CLRS: 1 = Chainlink, 2 = Redstone (other one is fallback).
    uint8 mainSource;
    /// @param chainlinkParams                chainlink Oracle constructor params struct for wstETH <> CLRS.
    ChainlinkConstructorParams chainlinkParams;
    /// @param redstoneOracle                 Redstone Oracle data for wstETH <> CLRS. (address can be set to zero address if using Chainlink only)
    RedstoneOracleData redstoneOracle;
}