FallbackOracleImpl

This contract is used to get the exchange rate from a main oracle feed and a fallback oracle feed.

_FALLBACK_ORACLE_MAIN_SOURCE

uint8 _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_

constructor

constructor(uint8 mainSource_, struct ChainlinkStructs.ChainlinkConstructorParams chainlinkParams_, struct RedstoneStructs.RedstoneOracleData redstoneOracle_) internal

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

Parameters

NameTypeDescription
mainSource_uint8which oracle to use as main source: - 1 = Chainlink ONLY (no fallback) - 2 = Chainlink with Redstone Fallback - 3 = Redstone with Chainlink Fallback
chainlinkParams_struct ChainlinkStructs.ChainlinkConstructorParamschainlink Oracle constructor params struct.
redstoneOracle_struct RedstoneStructs.RedstoneOracleDataRedstone Oracle data. (address can be set to zero address if using Chainlink only)

_getRateWithFallback

function _getRateWithFallback() internal view returns (uint256 exchangeRate_, bool fallback_)

returns the exchange rate for the main oracle source, or the fallback source (if configured) if the main exchange rate fails to be fetched. If returned rate is 0, fetching rate failed or something went wrong.

Return Values

NameTypeDescription
exchangeRate_uint256exchange rate
fallback_boolwhether fallback was necessary or not

_getChainlinkOrRedstoneAsFallback

function _getChainlinkOrRedstoneAsFallback() internal view returns (uint256 exchangeRate_)

returns the exchange rate for Chainlink, or Redstone if configured & Chainlink fails.