Skip to content

FluidUsdOracleSourceRead ​

Git Source

Inherits:FluidUsdOracleCore, ChainlinkSourceReader, FluidSourceReader

Implements source reads with a doRevert_ flag: true = revert on failure, false = return 0.

Functions ​

_applyMultiplier ​

Applies source multiplier so every leg is normalized to ORACLE_PRECISION.

solidity
function _applyMultiplier(uint256 rate_, int8 multiplier_) internal pure returns (uint256);

_normalizeRate ​

Applies the leg multiplier, then zero-checks per doRevert_ (division can round small rates to 0).

solidity
function _normalizeRate(uint256 rate_, int8 multiplier_, bool doRevert_) internal pure returns (uint256);

_applyLegCap ​

Applies a per-leg cap: returns min(rate, cap) or max(rate, cap) depending on capDirection_. capOperand_ is in 2-decimal precision (100 = 1.00 = 1e27 in ORACLE_PRECISION).

solidity
function _applyLegCap(uint256 rate_, uint16 capOperand_, uint8 capDirection_) internal pure returns (uint256);

_applyOverallCap ​

Applies overall cap to the final price. Cross-path modes use refPrice_ (PEG: other mapping primary; else altSrc). Operand modes compare against overallCapOperand * 1e25. refPrice_ is ignored for non-cross-path modes.

solidity
function _applyOverallCap(uint256 price_, uint256 refPrice_, OracleKeyConfig memory keyConfig_)
    internal
    pure
    returns (uint256);

_readSource ​

Reads a single configured source and returns its normalized 1e27 rate. When doRevert_ is true, reverts on failure. When false, returns 0 instead.

solidity
function _readSource(
    uint8 sourceType_,
    address source_,
    int8 multiplier_,
    bool isOperate_,
    bool isCollateral_,
    bool doRevert_
) internal view returns (uint256 rate_);

_readSourceMaybeWrite ​

solidity
function _readSourceMaybeWrite(
    uint8 sourceType_,
    address source_,
    int8 multiplier_,
    PriceReadContext memory ctx_,
    bool doRevert_
) internal returns (uint256 rate_);

_readSourceRaw ​

Reads a single source in "raw" mode for getPriceRawForMode. Returns 0 on any failure (never reverts). Capped rate / Fluid oracle sources use the uncapped getExchangeRate() getter instead of the directional getExchangeRate* methods, returning the unfiltered price without operate/liquidate/collateral/debt distinction. Chainlink sources use the liquidate (more lenient) staleness timespan since getPriceRawForMode has no isOperate parameter. Returns 0 on stale data instead of reverting.

solidity
function _readSourceRaw(uint8 sourceType_, address source_, int8 multiplier_)
    internal
    view
    returns (uint256 rate_);

_readSourcesWithRates ​

Reads up to 3 sources from a TokenSources bucket (non-reverting), returning configs, rates, and composed price.

solidity
function _readSourcesWithRates(TokenSources storage bucket_, bool isOperate_, bool isCollateral_)
    internal
    view
    returns (SourcesWithRates memory result_);

_readComposedPrice ​

Computes a composed price from a TokenSources bucket. Loads slot 2 / 3 only if the prior source type indicates they are configured. When capDirection_ != SOURCE_CAP_NONE, applies per-leg capping using each leg's capOperand. When doRevert_ is true, reverts on any source failure or zero price. When false, returns 0 instead.

solidity
function _readComposedPrice(
    TokenSources storage bucket_,
    PriceReadContext memory ctx_,
    bool doRevert_,
    uint8 capDirection_
) internal returns (uint256 price_);

_readComposedPriceRaw ​

Raw composed price from a TokenSources bucket (for getPriceRawForMode). Loads slot 2 / 3 only if the prior source type indicates they are configured. Never reverts.

solidity
function _readComposedPriceRaw(TokenSources storage bucket_) internal view returns (uint256 priceRaw_);