Skip to content

UniV3CheckCLRSOracleL2 ​

Git Source

Inherits:FluidOracleL2, UniV3CheckCLRSOracle

Gets the exchange rate between the underlying asset and the peg asset by using: the price from a UniV3 pool (compared against 3 TWAPs) and (optionally) comparing it against a Chainlink or Redstone price (one of Chainlink or Redstone being the main source and the other one the fallback source). Alternatively it can also use Chainlink / Redstone as main price and use UniV3 as check price.

*The process for getting the aggregate oracle price is:

  1. Fetch the UniV3 TWAPS, the latest interval is used as the current price
  2. Verify this price is within an acceptable DELTA from the Uniswap TWAPS e.g.: a. 240 to 60s b. 60 to 15s c. 15 to 1s (last block) d. 1 to 0s (current)
  3. (unless UniV3 only mode): Verify this price is within an acceptable DELTA from the Chainlink / Redstone Oracle
  4. If it passes all checks, return the price. Otherwise use fallbacks, usually to Chainlink. In extreme edge-cases revert.*

For UniV3 with check mode, if fetching the check price fails, the UniV3 rate is used directly.

Functions ​

constructor ​

solidity
constructor(string memory infoName_, UniV3CheckCLRSConstructorParams memory params_, address sequencerUptimeFeed_)
    UniV3CheckCLRSOracle(infoName_, params_)
    FluidOracleL2(sequencerUptimeFeed_);

getExchangeRateOperate ​

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

getExchangeRateLiquidate ​

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

getExchangeRate ​

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