Skip to content

FluidGenericOracleBase ​

Git Source

Inherits: OracleError, GenericOracleStructs, ChainlinkSourceReader, FluidSourceReader, FluidDebtSourceReader

generic configurable Oracle Base combines up to 4 hops from sources such as

  • an existing IFluidOracle (e.g. ContractRate)
  • Redstone
  • Chainlink

State Variables ​

_SOURCE1 ​

solidity
address internal immutable _SOURCE1;

_SOURCE1_INVERT ​

solidity
bool internal immutable _SOURCE1_INVERT;

_SOURCE1_MULTIPLIER ​

solidity
uint256 internal immutable _SOURCE1_MULTIPLIER;

_SOURCE1_DIVISOR ​

solidity
uint256 internal immutable _SOURCE1_DIVISOR;

_SOURCE1_TYPE ​

solidity
SourceType internal immutable _SOURCE1_TYPE;

_SOURCE2 ​

solidity
address internal immutable _SOURCE2;

_SOURCE2_INVERT ​

solidity
bool internal immutable _SOURCE2_INVERT;

_SOURCE2_MULTIPLIER ​

solidity
uint256 internal immutable _SOURCE2_MULTIPLIER;

_SOURCE2_DIVISOR ​

solidity
uint256 internal immutable _SOURCE2_DIVISOR;

_SOURCE2_TYPE ​

solidity
SourceType internal immutable _SOURCE2_TYPE;

_SOURCE3 ​

solidity
address internal immutable _SOURCE3;

_SOURCE3_INVERT ​

solidity
bool internal immutable _SOURCE3_INVERT;

_SOURCE3_MULTIPLIER ​

solidity
uint256 internal immutable _SOURCE3_MULTIPLIER;

_SOURCE3_DIVISOR ​

solidity
uint256 internal immutable _SOURCE3_DIVISOR;

_SOURCE3_TYPE ​

solidity
SourceType internal immutable _SOURCE3_TYPE;

_SOURCE4 ​

solidity
address internal immutable _SOURCE4;

_SOURCE4_INVERT ​

solidity
bool internal immutable _SOURCE4_INVERT;

_SOURCE4_MULTIPLIER ​

solidity
uint256 internal immutable _SOURCE4_MULTIPLIER;

_SOURCE4_DIVISOR ​

solidity
uint256 internal immutable _SOURCE4_DIVISOR;

_SOURCE4_TYPE ​

solidity
SourceType internal immutable _SOURCE4_TYPE;

_SOURCE5 ​

solidity
address internal immutable _SOURCE5;

_SOURCE5_INVERT ​

solidity
bool internal immutable _SOURCE5_INVERT;

_SOURCE5_MULTIPLIER ​

solidity
uint256 internal immutable _SOURCE5_MULTIPLIER;

_SOURCE5_DIVISOR ​

solidity
uint256 internal immutable _SOURCE5_DIVISOR;

_SOURCE5_TYPE ​

solidity
SourceType internal immutable _SOURCE5_TYPE;

Functions ​

constructor ​

solidity
constructor(OracleHopSource[] memory sources_);

_verifyOracleHopSource ​

verifies a hop source config

solidity
function _verifyOracleHopSource(OracleHopSource memory source_) internal view virtual;

_readSource ​

reads the exchange rate for a hop source

solidity
function _readSource(address source_, SourceType sourceType_, bool isOperate_)
    internal
    view
    virtual
    returns (uint256 rate_);

_getExchangeRateForHop ​

gets the exchange rate for a single configured hop

solidity
function _getExchangeRateForHop(uint256 curHopsRate_, bool isOperate_, OracleHopSource memory source_)
    internal
    view
    virtual
    returns (uint256 rate_);

_getHopsExchangeRate ​

gets the exchange rate combined for all configured hops

solidity
function _getHopsExchangeRate(bool isOperate_) internal view returns (uint256 rate_);

getHopExchangeRates ​

Returns the exchange rate for each hop.

solidity
function getHopExchangeRates()
    public
    view
    returns (
        uint256 rateSource1Operate_,
        uint256 rateSource1Liquidate_,
        uint256 rateSource2Operate_,
        uint256 rateSource2Liquidate_,
        uint256 rateSource3Operate_,
        uint256 rateSource3Liquidate_,
        uint256 rateSource4Operate_,
        uint256 rateSource4Liquidate_,
        uint256 rateSource5Operate_,
        uint256 rateSource5Liquidate_
    );

Returns

NameTypeDescription
rateSource1Operate_uint256The exchange rate for hop 1 during operate.
rateSource1Liquidate_uint256The exchange rate for hop 1 during liquidate.
rateSource2Operate_uint256The exchange rate for hop 2 during operate.
rateSource2Liquidate_uint256The exchange rate for hop 2 during liquidate.
rateSource3Operate_uint256The exchange rate for hop 3 during operate.
rateSource3Liquidate_uint256The exchange rate for hop 3 during liquidate.
rateSource4Operate_uint256The exchange rate for hop 4 during operate.
rateSource4Liquidate_uint256The exchange rate for hop 4 during liquidate.
rateSource5Operate_uint256The exchange rate for hop 5 during operate.
rateSource5Liquidate_uint256The exchange rate for hop 5 during liquidate.

getOracleHopSources ​

Returns the configured OracleHopSources

solidity
function getOracleHopSources() public view returns (OracleHopSource[] memory sources_);