Skip to content

CLRS2UniV3CheckCLRSOracleL2 ​

Git Source

Inherits:FluidOracleL2, FallbackOracleImpl2, UniV3CheckCLRSOracleL2

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

  1. rate from Chainlink price feeds (or Redstone as fallback).
  2. result from 1. combined with a uniV3CheckCLRSOracle to get from someToken <> someToken2 e.g. when going from wstETH to USDC:
  3. wstETH -> stETH -> ETH Chainlink feed.
  4. ETH -> USDC via UniV3 ETH <> USDC pool checked against ETH -> USDC Chainlink feed.

Functions ​

constructor ​

constructs a CLRS2UniV3CheckCLRSOracleL2 with all inherited contracts

solidity
constructor(
    string memory infoName_,
    CLRS2ConstructorParams memory cLRS2Params_,
    UniV3CheckCLRSConstructorParams memory uniV3CheckCLRSParams_,
    address sequencerUptimeFeed_
)
    FallbackOracleImpl2(cLRS2Params_.fallbackMainSource, cLRS2Params_.chainlinkParams, cLRS2Params_.redstoneOracle)
    UniV3CheckCLRSOracleL2(infoName_, uniV3CheckCLRSParams_, sequencerUptimeFeed_);

Parameters

NameTypeDescription
infoName_stringOracle identify helper name.
cLRS2Params_CLRS2ConstructorParamsCLRS2ConstructorParams for wstETH <> CLRS Token2 conversion
uniV3CheckCLRSParams_UniV3CheckCLRSConstructorParamsUniV3CheckCLRSOracle constructor params
sequencerUptimeFeed_addressL2 sequencer uptime Chainlink feed

getExchangeRateOperate ​

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

getExchangeRateLiquidate ​

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

getExchangeRate ​

solidity
function getExchangeRate()
    public
    view
    override(FluidOracleL2, UniV3CheckCLRSOracleL2)
    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);

Structs ​

CLRS2ConstructorParams ​

solidity
struct CLRS2ConstructorParams {
    uint8 fallbackMainSource;
    ChainlinkConstructorParams chainlinkParams;
    RedstoneOracleData redstoneOracle;
}