Lido wstETH Oracle
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
Chainlink Compatibility
Implements the AggregatorV3Interface
Provides standardized price feed data structure
Maintains consistent decimal precision (18 decimals)
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
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 roundlatestRoundData()
: Returns the most recent price data
Returns:
roundId
: The latest round ID (always 1)answer
: The current wstETH/ETH pricestartedAt
: Current block timestampupdatedAt
: Current block timestampansweredInRound
: The round ID (always 1)
State Variables
WST_ETH_CONTRACT
: Immutable address of the Lido wstETH contractPRICE_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
Immutable Contract Address
The wstETH contract address is set during construction and cannot be changed
Prevents potential manipulation of the price source
Decimal Validation
Validates the wstETH contract's decimals during construction
Ensures consistent decimal precision across the system
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
Chainlink Compatibility
Can be used as a drop-in replacement for Chainlink price feeds
Compatible with any system expecting AggregatorV3Interface implementation
Price Data Usage
The answer returned represents the wstETH/stETH exchange rate based on the
stEthPerToken()
functionAll price data is returned with 18 decimal precision
Timestamps are based on block.timestamp for real-time accuracy
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
Last updated
Was this helpful?