Skip to content

FluidUsdOracleViews ​

Git Source

Inherits:IUSDOracle, FluidUsdOracleAltPriceRead, TokenSymbolResolver

All public view / query methods: getPrice, getPriceRawForMode, getPriceDetailed, getConfiguredTokenOracles, etc.

Functions ​

_beforeGuardedPriceRead ​

Guard hook for price reads; L2 overrides with the sequencer gate. Raw/impl entries skip it on purpose.

solidity
function _beforeGuardedPriceRead() internal view virtual;

isGuardian ​

Returns whether the given address is an enabled guardian.

solidity
function isGuardian(address addr_) external view override returns (bool);

getTokenConfig ​

Returns token-level metadata used by pricing.

solidity
function getTokenConfig(address token_)
    external
    view
    override
    returns (bool operatePaused_, bool liquidatePaused_, uint8 tokenType_, uint8 decimals_);

isTokenConfigGovernanceApproved ​

Returns whether token-level source config is governance-approved.

solidity
function isTokenConfigGovernanceApproved(address token_) external view override returns (bool);

isEmodeValid ​

True if configsMap[token_] lists at least one key with this eMode.

solidity
function isEmodeValid(uint256 emode_, address token_) external view override returns (bool);

getPrice ​

Returns the price for a given token key. Intended for DexV2 and MoneyMarket.

Runs the tree in Write mode: Fluid/capped legs use IFluidOracleWrite getters. Reads should use getPriceView.

solidity
function getPrice(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    virtual
    override
    returns (uint256 price_);

getPriceView ​

View-only variant of getPrice() for read-only consumers.

solidity
function getPriceView(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    view
    virtual
    override
    returns (uint256 price_);

getPriceDetailed ​

Returns detailed pricing: full getPrice() result, token decimals, and token peg type. Reverts with the same errors as getPrice() when pricing fails. Intended for V1 vault wrappers (T1-T4) that need both the price and token decimals.

Intentionally non-view for future flexibility. Use getPriceDetailedView() for read-only consumers.

solidity
function getPriceDetailed(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    virtual
    override
    returns (uint256 price_, uint8 decimals_, uint8 tokenType_);

getPriceDetailedView ​

View-only variant of getPriceDetailed() for read-only consumers such as vault oracles. Reverts with the same errors as getPriceView() when pricing fails.

solidity
function getPriceDetailedView(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    view
    virtual
    override
    returns (uint256 price_, uint8 decimals_, uint8 tokenType_);

getPriceDetailedViewRaw ​

Same as getPriceDetailedView(), for resolver/UI reads only. May bypass checks that can revert on the guarded getter.

Resolver read path: intentionally not behind _beforeGuardedPriceRead (e.g. skips the L2 sequencer gate).

solidity
function getPriceDetailedViewRaw(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    view
    virtual
    override
    returns (uint256 price_, uint8 decimals_, uint8 tokenType_);

getPriceRawForMode ​

Returns the raw composed price for a token and price mode, plus token metadata. No caps, no deviation, no reverts (returns 0 on failure). Includes alt-source fallback when configured. Intended for limit handlers, auth contracts, and other consumers that always need a resolved price. Capped rate sources use getExchangeRate() (uncapped, no operate/liquidate/collateral/debt distinction). Chainlink uses the liquidate (lenient) staleness timespan.

solidity
function getPriceRawForMode(address token_, uint8 priceMode_)
    public
    view
    virtual
    override
    returns (uint256 priceRaw_, uint8 decimals_, uint8 tokenType_);

getPricesRawForMode ​

Multi-token getPriceRawForMode(), same per-token semantics. Guard (L2 sequencer) checked once per batch.

Returns three parallel arrays, one entry per token in tokens_ order.

solidity
function getPricesRawForMode(address[] calldata tokens_, uint8[] calldata priceModes_)
    public
    view
    virtual
    override
    returns (uint256[] memory pricesRaw_, uint8[] memory decimals_, uint8[] memory tokenTypes_);

Parameters

NameTypeDescription
tokens_address[]
priceModes_uint8[]One mode per token; length mismatch reverts UsdOracle__InvalidParams.

_priceRawForMode ​

Unguarded body shared by the single and batch getters.

solidity
function _priceRawForMode(address token_, uint8 priceMode_)
    internal
    view
    returns (uint256 priceRaw_, uint8 decimals_, uint8 tokenType_);

getConfiguredTokenOracles ​

Returns every oracle key row for token_ with best-effort primary (and alt) leg rates and composed prices.

Uses non-reverting source reads (doRevert_ = false); failed legs surface as rate == 0 and may zero the composed price.

solidity
function getConfiguredTokenOracles(address token_)
    external
    view
    override
    returns (ConfiguredTokenOracle[] memory infos_);

Parameters

NameTypeDescription
token_addressToken to enumerate.

Returns

NameTypeDescription
infos_ConfiguredTokenOracle[]One struct per configured (eMode, isOperate, isCollateral) row in configsMap[token_].

_getPriceImpl ​

Enforces pause bits, resolves key config (eMode fallback to 0), then PEG vs non-PEG price resolution.

solidity
function _getPriceImpl(address token_, uint256 emode_, bool isOperate_, bool isCollateral_, bool isWrite_)
    internal
    returns (uint256 price_);

_getPriceImplStatic ​

View entry helper: staticcall _getPriceImplNoWrite so one non-view price tree serves Write and view.

solidity
function _getPriceImplStatic(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    internal
    view
    returns (uint256 price_);

_getPriceImplNoWrite ​

Self-staticcall target for _getPriceImplStatic (Write mode off); public only for the bridge, self-call gated.

solidity
function _getPriceImplNoWrite(address token_, uint256 emode_, bool isOperate_, bool isCollateral_)
    public
    virtual
    returns (uint256 price_);

_metadata ​

Copies packed token metadata from _tokenSources[token].primarySrc storage slot 0.

solidity
function _metadata(TokenSourceConfig storage tokenCfg_) internal view returns (TokenMetadata memory meta_);

_getMetadata ​

Reads listing metadata from _tokenSources[token_].primarySrc.

solidity
function _getMetadata(address token_) internal view returns (uint8 decimals_, uint8 tokenType_);

_buildConfiguredTokenOracle ​

Builds a single ConfiguredTokenOracle entry. Extracted to avoid stack-too-deep in the loop.

solidity
function _buildConfiguredTokenOracle(address token_, string memory tokenSymbol_, ConfigMap memory configMap_)
    internal
    view
    returns (ConfiguredTokenOracle memory info_);