Oracles

For the USDN Protocol to function properly, precise and up-to-date prices are essential. Oracles are critical for providing these prices during every interaction with the Protocol.

Types of Oracles Used

The USDN Protocol uses two types of oracles to obtain reliable prices:

  1. Pyth (Pull-Based): Pyth is the primary oracle used by the Protocol. It provides a neutral price accompanied by a confidence interval that varies based on market volatility and data quality. This interval indicates the uncertainty around the average price. The Protocol uses this information to select a conservative price, taking 40% of the confidence interval magnitude into account.

    Pyth offers very frequent updates, with price aggregations every 400 milliseconds, ensuring near-instantaneous data. For more information, refer to the Pyth Documentation.

  2. Chainlink (Push-Based): Chainlink provides an average price that is used as-is by the Protocol when Pyth data is unavailable. Chainlink prices are pushed on-chain regularly, and updates are triggered either when the price change exceeds a certain threshold (generally 0.5% to 1% on mainnet) or after a predefined interval known as the "heartbeat." The heartbeat duration varies by data feed but is generally 1 hour on mainnet.

    This ensures regular updates even during periods of low volatility, keeping Chainlink data reliable and current regardless of market conditions. For more information, refer to the Chainlink Documentation.

In the future, the Governance will be able to modify which oracles are used to make full use of new technologies or discard problematic solutions.


How the Protocol Chooses Prices with Pyth

Pyth provides a neutral (average) price with a variable confidence interval. For example, suppose the neutral price of the asset is $1,000 with a confidence interval of ± $10 (ranging from $990 to $1,010). This interval is provided as an example to explain the mechanism and does not necessarily reflect the actual values from Pyth, as the confidence interval varies based on market volatility.

The USDN Protocol uses 40% of this interval to adjust the price as a protective measure:

  • Neutral Price: $1,000

  • Confidence Interval: $10 (from $990 to $1,010)

  • Adjustment: The Protocol takes 40% of this difference (40% of $10 = $4).

Based on the type of transaction, the final price is adjusted as follows:

  • For minting USDN or closing a Long position, the price used will be adjusted to $996 ($1,000 - $4).

  • For redeeming USDN or opening a Long position, the price will be adjusted to $1,004 ($1,000 + $4).

This mechanism allows the Protocol to select an accurate price while protecting against risks associated with market volatility.


Redundancy Mechanism

In principle, Pyth is the oracle that should always be used. However, due to its pull-based nature, there may be instances where Pyth’s API is unavailable or other issues arise beyond our control. In such cases, to avoid disrupting the Protocol or blocking user transactions, the Protocol will fall back to using Chainlink prices under certain conditions (see the Providing a Price section for more information).

This redundancy mechanism ensures the Protocol can continue operating seamlessly, even if one oracle fails.

Last updated