Oracle Registry

The Oracle Registry is a centralized price oracle system that provides USD valuations for all assets in the Flux protocol. It maps assets to oracle adapters and ensures consistent pricing across all vaults.

What is the Oracle Registry?

The Oracle Registry is a smart contract that:

  • Maps asset addresses to oracle adapter contracts

  • Provides standardized USD price queries

  • Supports multiple oracle types (Chainlink, Uniswap, Euler, etc.)

  • Is governance-controlled for security

  • Shared across all Flux vaults

Think of it as a "price feed router" that asset wrappers query to determine position values.


Why Centralized Oracle Management?

Consistent Pricing

All vaults and wrappers use the same price feeds:

VaultA → WETHWrapper → OracleRegistry → Chainlink
VaultB → WETHWrapper → OracleRegistry → Chainlink

                                   Same price!

Upgradeable Feeds

Oracle sources can be updated without redeploying wrappers:

Simplified Wrapper Logic

Wrappers don't need oracle logic - they just query the registry:

Governance Control

Only trusted governance can add/update oracle feeds:

  • Prevents malicious price manipulation

  • Ensures quality oracle sources

  • Centralizes security review process


The IOracleRegistry Interface


How It Works

Price Query Flow

Code Example


Oracle Adapters

Oracle adapters implement the IPriceOracle interface:

Supported Oracle Types

1. Chainlink Oracle Adapter

Uses Chainlink price feeds for reliable, decentralized prices.

Use Case: Established assets with Chainlink feeds (WETH, WBTC, USDC, etc.).

2. Uniswap V3 TWAP Oracle

Uses Uniswap V3 time-weighted average price.

Use Case: Long-tail assets without Chainlink feeds but with Uniswap liquidity.

3. Euler Oracle

Uses Euler's oracle system (combination of Chainlink and Uniswap).

Use Case: Assets supported by Euler's vetted oracle system.

4. Fixed Price Oracle

For stablecoins or known pegs.

Use Case: USDC/USDT/DAI pegged to $1.00.

5. Exchange Rate Oracle

For wrapped/rebasing tokens with deterministic exchange rates.

Use Case: wstETH, rETH, cbETH, etc.


Managing the Oracle Registry

Setting Oracle Adapters (Governance)

Updating Oracle Feeds

Why Safe?

  • Only governance can update

  • Changes take effect immediately (use timelock if desired)

  • Existing positions unaffected

  • Wrappers don't need redeployment

Querying Oracle Status


Decimal Handling

The registry handles decimal conversions automatically:

Asset Decimals → 18 Decimals USD

Result: All values returned as 18-decimal USD amounts for consistency.


Oracle Security Considerations

1. Price Manipulation

Risk: Oracle feeds can be manipulated (especially on-chain oracles like Uniswap).

Mitigations:

  • Use Chainlink for established assets (decentralized, manipulation-resistant)

  • Use TWAP for on-chain oracles (time-weighted resists flash loan attacks)

  • Set conservative liquidation buffers

  • Monitor for suspicious price movements

2. Stale Prices

Risk: Oracle feeds stop updating, providing stale prices.

Mitigations:

  • Oracle adapters should check staleness:

3. Oracle Failure

Risk: Oracle adapter reverts, preventing liquidations/health checks.

Mitigations:

  • Fallback oracle logic:

  • Emergency circuit breakers in vaults

4. Governance Control Risk

Risk: Malicious governance could set bad oracle to manipulate prices.

Mitigations:

  • Multi-sig governance

  • Timelock on oracle changes

  • Community monitoring

  • Immutable strategies (LPs can exit before oracle change)


Integration with Vaults

Health Check Flow

Liquidation Flow


Oracle Registry Deployment

Initial Setup

Adding New Assets


Best Practices

For Governance

  1. Vet oracle sources: Only use proven, secure oracle feeds

  2. Monitor staleness: Set reasonable staleness thresholds

  3. Implement fallbacks: Have backup oracles where possible

  4. Communicate changes: Announce oracle updates in advance

  5. Test thoroughly: Test new oracle adapters on testnet first

For Vault Creators

  1. Understand oracle risks: Know what oracles your allowed assets use

  2. Conservative parameters: Account for oracle volatility in liquidation buffers

  3. Monitor prices: Watch for unusual price movements

  4. Diversify sources: Prefer assets with multiple oracle options

  5. Emergency plans: Have plan for oracle failures

For Managers

  1. Trust the oracle: Position health based on oracle prices, not market prices

  2. Account for lag: Oracle prices may lag market prices

  3. Maintain buffer: Don't rely on exact oracle prices staying stable

  4. Monitor feeds: Watch for staleness or manipulation

  5. Diversify assets: Don't concentrate in assets with weak oracles


Comparison with Other Protocols

Feature
Flux Oracle Registry
Morpho Oracle
Aave Oracle

Architecture

Centralized registry

Per-market oracle

Centralized registry

Governance

Factory owner

Per-market (immutable)

Aave governance

Oracle Types

Multi-source adapters

Any IOracle implementation

Primarily Chainlink

Upgradeability

✓ Governance can update

✗ Immutable per market

✓ Governance can update

Shared Pricing

✓ All vaults use same registry

✗ Each market independent

✓ All pools use same oracle

Wrapper Integration

✓ Wrappers query registry

N/A

N/A


Advanced Topics

Custom Oracle Adapters

You can develop custom oracle adapters:

Requirements:

  • Implement IPriceOracle.getPrice()

  • Return 18-decimal USD price

  • Handle edge cases (asset not supported, feed failure, etc.)

  • Gas efficient (called frequently)

  • Security audited

Multi-Hop Oracles

For assets without direct USD feeds:

Last updated