Skip to content

FluidUsdOracleAltPriceRead ​

Git Source

Inherits:FluidUsdOracleSourceRead

Handles alt-source flow: deviation check and/or fallback.

Functions ​

_getPriceWithAlt ​

Reads primary price (non-reverting), then resolves fallback, deviation, and overall cap. For non-PEG: fallbackAltCfg_ and deviationCfg_ both point to altSrc. For PEG: fallbackAltCfg_ is the selected mapping's altSrc; deviationCfg_ crosses mappings (and doubles as the cross-path reference for overall cap). The reference price is read at most once, reused for deviation check and cross-path cap. CROSS_PATH operate fail-closes (doRevert_=true). CROSS_PATH liquidate reads the ref soft and skips the cap when it is 0 so a dead other path cannot halt liquidations.

solidity
function _getPriceWithAlt(
    TokenSources storage primaryCfg_,
    TokenSources storage fallbackAltCfg_,
    bool hasFallbackAlt_,
    TokenSources storage deviationCfg_,
    OracleKeyConfig memory keyConfig_,
    PriceReadContext memory ctx_,
    uint8 capDirection_
) internal returns (uint256 price_);

_getResolvedPrice ​

Resolves price from the non-PEG source config storage reference. Non-PEG: deviation and fallback both use altSrc. Applies per-leg caps via sourceCapMode and overall cap if configured.

solidity
function _getResolvedPrice(
    TokenSourceConfig storage srcCfg_,
    TokenMetadata memory meta_,
    OracleKeyConfig memory keyConfig_,
    PriceReadContext memory ctx_
) internal returns (uint256 price_);

_getPegResolvedPrice ​

PEG-token resolved price:

  • deviation compares _tokenSources.primarySrc vs _additionalTokenSources.primarySrc
  • fallback remains within the selected mapping and uses that mapping's alt sources
  • per-leg caps, deviation, and overall cap (cross-path or operand) handled by _getPriceWithAlt
solidity
function _getPegResolvedPrice(
    address token_,
    TokenSourceConfig storage tokenCfg_,
    TokenMetadata memory meta_,
    OracleKeyConfig memory keyConfig_,
    PriceReadContext memory ctx_
) internal returns (uint256 price_);