Skip to content

Ratio2xFallbackCLRSOracleL2 ​

Git Source

Inherits:FluidOracleL2, FallbackOracleImpl2, FallbackCLRSOracleL2

Gets the exchange rate between the underlying asset and the peg asset by using:

  1. 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.
  2. set into ratio with another price fetched the same way. I.e. it is possible to do Chainlink Oracle / Chainlink Oracle. E.g. wstETH per 1 weETH on a L2 via CL feeds.

Functions ​

constructor ​

sets the two CLRS oracle configs

solidity
constructor(
    string memory infoName_,
    FallbackCLRSOracleL2.CLRSConstructorParams memory cLRSParams1_,
    FallbackCLRSOracleL2.CLRSConstructorParams memory cLRSParams2_,
    address sequencerUptimeFeed_
)
    FallbackCLRSOracleL2(infoName_, cLRSParams1_, sequencerUptimeFeed_)
    FallbackOracleImpl2(cLRSParams2_.mainSource, cLRSParams2_.chainlinkParams, cLRSParams2_.redstoneOracle);

Parameters

NameTypeDescription
infoName_stringOracle identify helper name.
cLRSParams1_FallbackCLRSOracleL2.CLRSConstructorParamsCLRS Fallback Oracle data for ratio dividend
cLRSParams2_FallbackCLRSOracleL2.CLRSConstructorParamsCLRS Fallback Oracle data for ratio divisor
sequencerUptimeFeed_addressL2 sequencer uptime Chainlink feed

getExchangeRateOperate ​

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

getExchangeRateLiquidate ​

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

getExchangeRate ​

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

FALLBACK_ORACLE2_MAIN_SOURCE ​

which oracle to use as main source:

  • 1 = Chainlink ONLY (no fallback)
  • 2 = Chainlink with Redstone Fallback
  • 3 = Redstone with Chainlink Fallback
solidity
function FALLBACK_ORACLE2_MAIN_SOURCE() public view returns (uint8);