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
  • Key Features
  • Functions Description
  • Security Considerations

Was this helpful?

  1. Smart Contracts
  2. Utility Contracts
  3. ETH0

Lido wstETH Oracle

The contract operates under the assumption that stETH maintains a 1:1 peg with ETH, as stETH represents staked ETH in the Lido protocol.

High-Level Overview

The LidoProxyWstETHPriceFeed contract is a specialized oracle implementation that serves as a proxy for the Lido wstETH/ETH price feed. It implements the Chainlink AggregatorV3Interface to provide standardized price feed data for wstETH in terms of ETH, making it compatible with the broader Chainlink oracle ecosystem.

Contract Summary

This contract acts as a wrapper around the Lido wstETH contract, converting the stETH per token ratio into a standardized price feed format. It maintains compatibility with the Chainlink AggregatorV3Interface while providing real-time wstETH/ETH price data.

Key Features

  1. Chainlink Compatibility

  • Implements the AggregatorV3Interface

  • Provides standardized price feed data structure

  • Maintains consistent decimal precision (18 decimals)

  1. Real-time Price Data

  • Fetches live wstETH/ETH conversion rates from the Lido contract

  • Updates price data on every query

  • Provides both round-specific and latest price data

  1. Standardized Interface

  • Returns price data in a format compatible with Chainlink consumers

  • Includes round information, timestamps, and price values

  • Maintains consistent decimal precision across all operations

Functions Description

Public/External Functions

  • decimals(): Returns the number of decimals used in the price feed (18)

  • description(): Returns the description of the price feed ("wstETH / ETH")

  • version(): Returns the version of the price feed implementation (1)

  • getRoundData(uint80 roundId_): Returns historical price data for a specific round

  • latestRoundData(): Returns the most recent price data

Returns:

  • roundId: The latest round ID (always 1)

  • answer: The current wstETH/ETH price

  • startedAt: Current block timestamp

  • updatedAt: Current block timestamp

  • answeredInRound: The round ID (always 1)

State Variables

  • WST_ETH_CONTRACT: Immutable address of the Lido wstETH contract

  • PRICE_FEED_DECIMALS: Constant value of 18, representing the number of decimals used in price feed output

Error Handling

InvalidDecimalsNumber(): Thrown when the wstETH contract's decimals don't match the expected PRICE_FEED_DECIMALS (18)

Security Considerations

  1. Immutable Contract Address

  • The wstETH contract address is set during construction and cannot be changed

  • Prevents potential manipulation of the price source

  1. Decimal Validation

  • Validates the wstETH contract's decimals during construction

  • Ensures consistent decimal precision across the system

  1. Real-time Price Updates

  • Price data is fetched directly from the Lido contract on each query

  • No stale price data is stored or returned

Integration Notes

  1. Chainlink Compatibility

  • Can be used as a drop-in replacement for Chainlink price feeds

  • Compatible with any system expecting AggregatorV3Interface implementation

  1. Price Data Usage

  • The answer returned represents the wstETH/stETH exchange rate based on the stEthPerToken() function

  • All price data is returned with 18 decimal precision

  • Timestamps are based on block.timestamp for real-time accuracy

  1. Round Data

  • While the contract implements the round-based interface, it doesn't maintain historical round data

  • All round queries return current price data with appropriate round identifiers

PreviousETH0 Abstract OracleNextUSUAL

Last updated 6 days ago

Was this helpful?

⛓️