Skip to content

FluidUsdOracleTokenSourceConfigs ​

Git Source

Inherits:FluidUsdOracleUpgradeable

Token-level source configuration: primary/alt sources in _tokenSources and _additionalTokenSources. Source feeds are configured per-token and validated once here (Chainlink latestRoundData, capped-rate getRate, etc.). All per-key configs that reference this token+mode inherit the validated sources automatically — no feed re-specification or re-validation needed when adding new keys. These methods do NOT use the transient admin session (no registerTransientOracleKey needed).

Functions ​

setSourceConfig ​

Sets primary (up to three leg) source configuration for a listed token.

Does not use the transient oracle key session. TEAM_MULTISIG may only create a new primary config, not overwrite. Blocked entirely once the token is governance-approved.

solidity
function setSourceConfig(
    address token_,
    SourceConfig memory src1_,
    SourceConfig memory src2_,
    SourceConfig memory src3_
) external onlyGovernanceOrMultisig validAddress(token_);

Parameters

NameTypeDescription
token_addressListed token address.
src1_SourceConfigRequired first source chain leg.
src2_SourceConfigOptional second leg; use SOURCE_NOT_SET / zero address to omit.
src3_SourceConfigOptional third leg; must be unset if src2_ is unset.

removeSourceConfig ​

Removes primary source configuration for a token.

If alt sources exist, calls removeAltSourceConfig first. Only governance.

solidity
function removeSourceConfig(address token_) external onlyGovernance validAddress(token_);

Parameters

NameTypeDescription
token_addressToken whose primary sources are cleared.

setAltSourceConfig ​

Sets alt (fallback / deviation second-leg) source configuration for a token.

Requires primary sources. TEAM_MULTISIG may only create a new alt config, not overwrite. Blocked entirely once the token is governance-approved.

solidity
function setAltSourceConfig(
    address token_,
    SourceConfig memory alt1_,
    SourceConfig memory alt2_,
    SourceConfig memory alt3_
) external onlyGovernanceOrMultisig validAddress(token_);

Parameters

NameTypeDescription
token_addressListed token address.
alt1_SourceConfigFirst alt leg (required if configuring alt).
alt2_SourceConfigOptional second alt leg.
alt3_SourceConfigOptional third alt leg.

removeAltSourceConfig ​

Removes alt source configuration and clears FLAG_HAS_ALT_SOURCE.

Reverts if any key for token_ still has fallback enabled or deviation check (maxDeviationBPS > 0). Only governance.

solidity
function removeAltSourceConfig(address token_) public onlyGovernance validAddress(token_);

Parameters

NameTypeDescription
token_addressToken whose alt sources are cleared.

setAdditionalSourceConfig ​

Sets additional market-price sources for a PEG token (_additionalTokenSources.primarySrc).

TEAM_MULTISIG may only create a new additional config, not overwrite. Only valid for TOKEN_TYPE_PEG. Blocked entirely once the token is governance-approved.

solidity
function setAdditionalSourceConfig(
    address token_,
    SourceConfig memory src1_,
    SourceConfig memory src2_,
    SourceConfig memory src3_
) external onlyGovernanceOrMultisig validAddress(token_);

Parameters

NameTypeDescription
token_addressPEG token address.
src1_SourceConfigFirst market source leg.
src2_SourceConfigOptional second leg.
src3_SourceConfigOptional third leg.

removeAdditionalSourceConfig ​

Removes additional (market) primary sources for a PEG token.

If additional alt sources exist, removes them first. Only governance.

solidity
function removeAdditionalSourceConfig(address token_) external onlyGovernance validAddress(token_);

Parameters

NameTypeDescription
token_addressPEG token address.

setAdditionalAltSourceConfig ​

Sets alt sources for the additional (market) mapping on a PEG token.

Requires setAdditionalSourceConfig to exist. TEAM_MULTISIG may only create, not overwrite. Blocked entirely once the token is governance-approved.

solidity
function setAdditionalAltSourceConfig(
    address token_,
    SourceConfig memory alt1_,
    SourceConfig memory alt2_,
    SourceConfig memory alt3_
) external onlyGovernanceOrMultisig validAddress(token_);

Parameters

NameTypeDescription
token_addressPEG token address.
alt1_SourceConfigFirst additional-alt leg.
alt2_SourceConfigOptional second leg.
alt3_SourceConfigOptional third leg.

removeAdditionalAltSourceConfig ​

Removes additional alt sources and clears FLAG_HAS_ADDITIONAL_ALT_SOURCES.

Same key-level constraints as removeAltSourceConfig. Only governance.

solidity
function removeAdditionalAltSourceConfig(address token_) public onlyGovernance validAddress(token_);

Parameters

NameTypeDescription
token_addressPEG token address.

_validateThreeSourceConfig ​

Verifies that the source chain is contiguous and each configured source is valid.

solidity
function _validateThreeSourceConfig(
    SourceConfig memory sourceCfg1_,
    SourceConfig memory sourceCfg2_,
    SourceConfig memory sourceCfg3_
) internal;

_validateOptionalSourceConfig ​

Validates an optional 2nd/3rd source leg; no-op when SOURCE_NOT_SET.

solidity
function _validateOptionalSourceConfig(SourceConfig memory sourceCfg_) internal;

_verifySourceConfig ​

Verifies that the source configuration is valid for the given source type and address.

solidity
function _verifySourceConfig(uint8 sourceType_, address source_) internal;

_isChainlinkFeed ​

Checks if the provided address is a valid Chainlink feed by calling latestRoundData.

solidity
function _isChainlinkFeed(address contract_) internal view returns (bool);

_isCappedRate ​

Checks if the provided address implements the FluidCappedRate interface with required methods.

solidity
function _isCappedRate(address contract_) internal returns (bool);

_isFluidOracleWithDebt ​

Checks if the address implements Fluid oracle + debt getters (e.g. CLX). No centerPrice() required.

solidity
function _isFluidOracleWithDebt(address contract_) internal view returns (bool);

_writeSources ​

Writes a 3-source chain into a TokenSources bucket.

solidity
function _writeSources(
    TokenSources storage bucket_,
    SourceConfig memory src1_,
    SourceConfig memory src2_,
    SourceConfig memory src3_
) internal;

_deriveMultiplier ​

Derives and validates source multiplier; return is stored for read-path gas efficiency.

solidity
function _deriveMultiplier(uint8 sourceType_, address source_) internal view returns (int8 multiplier_);

_clearSources ​

Clears a 3-source chain from a TokenSources bucket.

solidity
function _clearSources(TokenSources storage bucket_) internal;