DebtUSDC Oracle
High-Level Overview
The DebtUSDCOracle contract is a simple wrapper around the USDC/USD Chainlink price feed that implements a price cap mechanism. The contract ensures that the DebtUSDC token price never exceeds $1 USD, maintaining price stability and preventing oracle manipulation from affecting the protocol's debt token pricing.
Contract Summary
The contract provides a Chainlink-compatible aggregator interface that:
Wraps the underlying USDC/USD price feed
Caps the maximum price at $1 USD (1e8 with 8 decimals)
Returns price data in the standard Chainlink AggregatorV3Interface format
Key Functionality
latestRoundData
Returns the latest price data from the USDC/USD feed with a price cap applied:
If the USDC/USD feed price is at or below $1, returns the actual price
If the USDC/USD feed price exceeds 1,returns1,returns1 as the maximum price
This ensures that DebtUSDC tokens maintain a stable price ceiling, preventing oracle anomalies or manipulation from causing the debt token price to exceed its intended value.
getRoundData
Not supported - reverts with NotSupported error. Only latestRoundData is available.
Constants
PRICE_FEED_DECIMALS: 8 (standard Chainlink decimals)
MAX_USDC_ORACLE_PRICE: 1e8 (represents $1.00 with 8 decimals)
Immutable Variables
USDC_USD_FEED: The underlying USDC/USD Chainlink price feed aggregator
Use Case
The DebtUSDCOracle is used by the protocol to price DebtUSDC tokens. By capping the price at $1, the protocol ensures that debt tokens maintain their intended value relationship with USDC, preventing any oracle manipulation or price anomalies from affecting the protocol's accounting.
Last updated
Was this helpful?