FluidUsdOracleTokenSourceConfigs ​
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.
function setSourceConfig(
address token_,
SourceConfig memory src1_,
SourceConfig memory src2_,
SourceConfig memory src3_
) external onlyGovernanceOrMultisig validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | Listed token address. |
src1_ | SourceConfig | Required first source chain leg. |
src2_ | SourceConfig | Optional second leg; use SOURCE_NOT_SET / zero address to omit. |
src3_ | SourceConfig | Optional 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.
function removeSourceConfig(address token_) external onlyGovernance validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | Token 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.
function setAltSourceConfig(
address token_,
SourceConfig memory alt1_,
SourceConfig memory alt2_,
SourceConfig memory alt3_
) external onlyGovernanceOrMultisig validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | Listed token address. |
alt1_ | SourceConfig | First alt leg (required if configuring alt). |
alt2_ | SourceConfig | Optional second alt leg. |
alt3_ | SourceConfig | Optional 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.
function removeAltSourceConfig(address token_) public onlyGovernance validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | Token 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.
function setAdditionalSourceConfig(
address token_,
SourceConfig memory src1_,
SourceConfig memory src2_,
SourceConfig memory src3_
) external onlyGovernanceOrMultisig validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | PEG token address. |
src1_ | SourceConfig | First market source leg. |
src2_ | SourceConfig | Optional second leg. |
src3_ | SourceConfig | Optional third leg. |
removeAdditionalSourceConfig ​
Removes additional (market) primary sources for a PEG token.
If additional alt sources exist, removes them first. Only governance.
function removeAdditionalSourceConfig(address token_) external onlyGovernance validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | PEG 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.
function setAdditionalAltSourceConfig(
address token_,
SourceConfig memory alt1_,
SourceConfig memory alt2_,
SourceConfig memory alt3_
) external onlyGovernanceOrMultisig validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | PEG token address. |
alt1_ | SourceConfig | First additional-alt leg. |
alt2_ | SourceConfig | Optional second leg. |
alt3_ | SourceConfig | Optional third leg. |
removeAdditionalAltSourceConfig ​
Removes additional alt sources and clears FLAG_HAS_ADDITIONAL_ALT_SOURCES.
Same key-level constraints as removeAltSourceConfig. Only governance.
function removeAdditionalAltSourceConfig(address token_) public onlyGovernance validAddress(token_);Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | PEG token address. |
_validateThreeSourceConfig ​
Verifies that the source chain is contiguous and each configured source is valid.
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.
function _validateOptionalSourceConfig(SourceConfig memory sourceCfg_) internal;_verifySourceConfig ​
Verifies that the source configuration is valid for the given source type and address.
function _verifySourceConfig(uint8 sourceType_, address source_) internal;_isChainlinkFeed ​
Checks if the provided address is a valid Chainlink feed by calling latestRoundData.
function _isChainlinkFeed(address contract_) internal view returns (bool);_isCappedRate ​
Checks if the provided address implements the FluidCappedRate interface with required methods.
function _isCappedRate(address contract_) internal returns (bool);_isFluidOracleWithDebt ​
Checks if the address implements Fluid oracle + debt getters (e.g. CLX). No centerPrice() required.
function _isFluidOracleWithDebt(address contract_) internal view returns (bool);_writeSources ​
Writes a 3-source chain into a TokenSources bucket.
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.
function _deriveMultiplier(uint8 sourceType_, address source_) internal view returns (int8 multiplier_);_clearSources ​
Clears a 3-source chain from a TokenSources bucket.
function _clearSources(TokenSources storage bucket_) internal;