FluidUsdOracleSourceRead ​
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.
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).
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).
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.
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.
function _readSource(
uint8 sourceType_,
address source_,
int8 multiplier_,
bool isOperate_,
bool isCollateral_,
bool doRevert_
) internal view returns (uint256 rate_);_readSourceMaybeWrite ​
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.
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.
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.
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.
function _readComposedPriceRaw(TokenSources storage bucket_) internal view returns (uint256 priceRaw_);