Skip to content

FallbackCLRSOracle ​

Git Source

Inherits:FluidOracle, FallbackOracleImpl

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 mainSource_,
    ChainlinkConstructorParams memory chainlinkParams_,
    RedstoneOracleData memory redstoneOracle_
) FallbackOracleImpl(mainSource_, chainlinkParams_, redstoneOracle_) FluidOracle(infoName_);

Parameters

NameTypeDescription
infoName_stringOracle identify helper name.
mainSource_uint8which oracle to use as main source: 1 = Chainlink, 2 = Redstone (other one is fallback).
chainlinkParams_ChainlinkConstructorParamschainlink Oracle constructor params struct.
redstoneOracle_RedstoneOracleDataRedstone Oracle data. (address can be set to zero address if using Chainlink only)

getExchangeRateOperate ​

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

getExchangeRateLiquidate ​

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

getExchangeRate ​

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

FALLBACK_ORACLE_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_ORACLE_MAIN_SOURCE() public view returns (uint8);