Usual Tech Docs
Usual WebsiteGeneral DocsContract DeploymentsAuditsAccess dApp
  • 🚀GM GM
    • Usual Tech Hub
  • 🔭Overview
    • Usual Protocol Primer
    • Features
      • USD0
      • USD0++
      • USD0 Mint & Redeem Engine
      • ETH0
      • USUAL
      • USUAL*
      • USUALx (USUAL staking)
      • USUAL distribution
      • USUAL Airdrop
      • Usual USD0++ Investment Vault
    • Architecture
      • Role Management
      • USUAL Distribution Model
  • ⛓️Smart Contracts
    • Protocol Contracts
      • USD0
        • USD0 DaoCollateral
        • Swapper Engine
      • ETH0
        • ETH0 DaoCollateral
      • USUAL
        • USUAL staking
        • USUAL* Vested Allocation Staking
        • USUAL Distribution
          • Distribution Module
          • Yield Module
        • Airdrop Module
    • Token Contracts
      • USD0
      • USD0++
      • ETH0
      • USUAL
      • USUAL*
      • USUALx
      • Usual USD0++ Investment Vault
        • VaultRouter
    • Utility Contracts
      • USD0
        • USD0 ClassicalOracle
        • USD0 Abstract Oracle
        • Chainlink Oracles
        • Pyth Oracles
      • ETH0
        • ETH0 Classical Oracle
        • ETH0 Abstract Oracle
        • Lido wstETH Oracle
      • USUAL
        • RedStone Oracle
    • RWA Collateral
      • USYC by Hashnote
      • M by M0
        • UsualM
      • USDtb by Ethena
    • ETH0 Collateral
      • wstETH by Lido
    • Contract Deployments
  • 🛡️Security & Audits
    • Security Practices
    • Testing Framework
    • Monitoring Framework
    • Audits
    • Bug Bounty
  • 🧩Integrations
    • Integrate USD0++
      • Reward redistribution by integration partner
      • Claim Address Redirect
  • 📚Resources
    • Community & Support
    • References
  • 📖Support
    • FAQ
    • Glossary
  • ⚖️Legal
    • Terms of Services
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • High-Level Overview
  • Contract Summary
  • Inherited Contracts
  • Functionality Breakdown
  • Functions Description

Was this helpful?

  1. Smart Contracts
  2. Utility Contracts
  3. ETH0

ETH0 Classical Oracle

PreviousETH0NextETH0 Abstract Oracle

Last updated 6 days ago

Was this helpful?

High-Level Overview

The ClassicalOracle contract is used by DaoCollateral to fetch the price of external tokens. The price of tokens is used for minting and redeeming the right amount of ETH0. It is an upgradable contract.

Contract Summary

Most of the contract’s logic is inherited from AbstractOracle. Two responsibilities remain in ClassicalOracle itself:

  • Initializing tokenToOracleInfo for each supported token with a ChainlinkV3Aggregator-compatible price feed

  • Interacting with the aggregator to fetch the latest price and its number of decimals

Inherited Contracts

  • IOracle: Common interface used by other contracts and external service (e.g. the dApp) to interact with the ClassicalOracle. Ensures function signatures are the ones expected by these external actors.

  • AbstractOracle: Encapsulates most of the logic and the implementation of public/external functions from IOracle.

Functionality Breakdown

After deploying the contract, the administrator should initialize the price feed for all supported collateral.

When another contract or external service calls getPrice or getQuote, the inherited AbstractOracle contract calls the virtual function _latestRoundData passing the desired token as parameter. This function is implemented in ClassicalOracle and retrieves the associated price aggregator for this token, then calls decimals and latestRoundData which are returned to AbstractOracle.

Flow Diagram

Functions Description

Public/External Functions

  • initializeTokenOracle(address token, address dataSource, uint64 timeout, bool isStablecoin): Registers a new supported token or updates the data source (price aggregator) for an existing token. The new price feed must have been last updated within the last timeout seconds. This check is only performed once. If isStablecoin is true, the depeg check will be enabled and getPrice/getQuote will revert if the price is not around $1.

Also see AbstractOracle for the other public/external functions.

⛓️