Mellow Protocol
  • 💡Overview
  • 🎛️MELLOW LRT (LST) PRIMITIVE
    • Overview
    • Simple-LRT
    • LRT Contracts
      • 🏦Vault
      • 🔧VaultConfigurator
      • ⚖️Validators
        • ManagedValidator
        • ERC20SwapValidator
        • DefaultBondValidator
        • AllowAllValidator
      • 🧬Strategies
        • DefaultBondStrategy
        • SimpleDVTStakingStrategy
      • 🔎Oracles
        • ChainlinkOracle
        • ManagedRatiosOracle
      • 🧱Modules
        • DelegateModules
          • ERC20SwapModule
          • DefaultBondModule
          • StakingModule
        • ExternalModules
        • TvlModules
          • DefaultBondTvlModule
          • ERC20TvlModule
          • ManagedTvlModule
      • 🪛Utils
        • DepositWrapper
        • DefaultAccessControl
      • 🔐Security
        • AdminProxy
    • DVstETH vault overview
    • Interoperable vaults
    • Contract deployments
    • Security
    • Loyalty Points
      • Points in Symbiotic pre-deposit contracts
      • DeFi points integration instructions
    • User Tutorials
      • Deposit guide
      • Withdrawal guide
      • Emergency withdrawal guide (advanced)
    • API
  • 🤖MELLOW ALM
    • Mellow ALM Toolkit
      • Overview
      • 📘Domain objects
      • 🧩Components
      • 🍜Processes
      • 💎Core
      • 🔮Oracles
        • VeloOracle
      • 🎯Strategy
        • PulseStrategyModule
      • 🔌AMM Adapters
        • VeloAmmModule
      • 🚙Utility contracts
        • AmmDepositWithdrawModule
        • Counter
        • LpWrapper
        • VeloDeployFactory
    • Mellow permissionless vaults
      • Overview
      • Core
      • Contracts API
      • Strategies
        • Fearless Gearbox strategy
        • LStrategy
        • Uni V3 Boosted strategy
        • Pulse strategy
        • Pulse strategy V2
        • Tamper strategy
      • Governance parameters
      • Contracts specs
      • Tutorials
        • Contracts deployments
        • Deploy your own strategy
        • wstETH strategies deposit guide
      • Mellow contracts addresses
        • Mellow Protocol Addresses (Polygon)
        • Mellow Protocol Addresses (Mainnet)
        • Gearbox Fearless Strategy
        • Tamper Strategy
        • UniV3 Pulse wstETH-USDC
        • UniV3 Pulse V2 wstETH-USDC
        • Velodrome CL strategies
        • Aerodrome CL strategies
      • Glossary
      • FAQ
    • Mellow Backtesting SDK
  • 🗄️Resources
    • Media kit
    • Twitter
    • Discord
Powered by GitBook
On this page
  • Overview
  • Key Features
  • Error Definitions
  • Constants
  • Core Methods
  • Events
  1. MELLOW LRT (LST) PRIMITIVE
  2. LRT Contracts
  3. Oracles

ChainlinkOracle

ChainlinkOracle is a PriceOracle

Overview

ChainlinkOracle contract integrates with Chainlink to provide accurate and real-time pricing data for various tokens. It manages base tokens and their associated Chainlink oracles (aggregators), ensuring reliable price conversions.

Key Features

  • Chainlink Integration: Utilizes Chainlink Aggregators to fetch accurate pricing data.

  • Base Token Management: Supports setting and managing base tokens for price calculations.

  • Error Reporting: Raises specific errors for unsupported or stale data scenarios.

Error Definitions

  • InvalidLength: Raised when the input arrays for tokens and oracles are not of equal length.

  • AddressZero: Raised when an address is expected but not provided.

  • StaleOracle: The data from the Chainlink oracle is older than the maximum allowable age (MAX_ORACLE_AGE).

Constants

  • MAX_ORACLE_AGE: The maximum allowable age for Chainlink oracle data, set to 2 days.

  • Q96: A fixed-point scaling constant (2^96), used for ratio calculations.

Core Methods

  1. Base Token Management

    • setBaseToken(address, address): Sets the base token for a specific vault.

      • vault: The address of the vault.

      • baseToken: The address of the base token.

  2. Chainlink Oracle Management

    • setChainlinkOracles(address, address[], address[]): Associates tokens with their Chainlink oracles for a given vault.

      • vault: The address of the vault.

      • tokens: An array of token addresses.

      • oracles: An array of oracle addresses matching the tokens.

  3. Pricing

    • getPrice(address, address): Retrieves the price and decimals of a token from its associated Chainlink oracle.

      • vault: The address of the vault.

      • token: The address of the token.

    • priceX96(address, address): Computes the price of a token in base token terms, using a 96-bit fixed-point representation.

      • vault: The address of the vault.

      • token: The address of the token.

Events

  1. Base Token Events:

    • ChainlinkOracleSetBaseToken(address, address, uint256): Emitted when a base token is set for a specific vault.

      • vault: The address of the vault.

      • baseToken: The address of the base token.

      • timestamp: The timestamp when the base token was set.

  2. Oracle Setup Events:

    • ChainlinkOracleSetChainlinkOracles(address, address[], address[], uint256): Emitted when Chainlink oracles are set for tokens in a vault.

      • vault: The address of the vault.

      • tokens: Array of token addresses.

      • oracles: Array of oracle addresses.

      • timestamp: The timestamp when the oracles were set.

PreviousOraclesNextManagedRatiosOracle
🎛️
🔎