DebtUSCC Oracle

High-Level Overview

The DebtUSCCOracle contract is a proxy oracle that provides Chainlink-compatible price data for DebtUSCC tokens. Unlike a standard oracle wrapper, this contract returns the USCC/USD price from the time of the last deposit in the ReverseGateway contract, ensuring price consistency for all outstanding DebtUSCC tokens.

Contract Summary

The contract provides a Chainlink-compatible aggregator interface that:

  • Integrates with the ReverseGateway to track deposit timing

  • Returns the USCC/USD price from the oracle round captured during the last deposit

  • Maintains price consistency for all outstanding DebtUSCC tokens

Key Functionality

latestRoundData

Returns the USCC/USD price data based on the last ReverseGateway deposit:

  • If no deposits exist (nextOrderId == 1): Returns the latest price from the USCC/USD feed

  • If deposits exist: Returns the price from the USCC/USD feed at the roundId captured during the last deposit

This design ensures that all outstanding DebtUSCC tokens are priced consistently at the same price point (the price when they were minted), maintaining accounting integrity and preventing price inconsistencies.

getRoundData

Not supported - reverts with NotSupported error. Only latestRoundData is available.

Integration with ReverseGateway

The contract queries the ReverseGateway contract to:

  1. Get the next order ID to determine if any deposits have occurred

  2. Retrieve the roundId from the last order (if deposits exist)

  3. Use that roundId to fetch the historical USCC/USD price from the oracle

This integration ensures that the DebtUSCC oracle price reflects the price at which the debt tokens were minted, maintaining consistency with the single deposit constraint in ReverseGateway.

Constants

  • PRICE_FEED_DECIMALS: 8 (standard Chainlink decimals)

Immutable Variables

  • USCC_USD_FEED: The underlying USCC/USD Chainlink price feed aggregator

  • REVERSE_GATEWAY: The ReverseGateway contract address

Use Case

The DebtUSCCOracle is used by the protocol to price DebtUSCC tokens. By returning the price from the time of the last deposit, the oracle ensures that all outstanding DebtUSCC tokens maintain a consistent price point, which is critical for:

  • Maintaining accounting accuracy

  • Ensuring USD0a price stability

  • Aligning with the single deposit constraint in ReverseGateway

Last updated

Was this helpful?