Oracles
Last updated
Last updated
For the to function properly, precise and up-to-date prices are essential. are critical for providing these prices during every interaction with the protocol.
The USDN protocol uses two types of oracles to obtain reliable prices:
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 .
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 .
In the future, the will be able to modify which oracles are used to make full use of new technologies or discard problematic solutions.
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:
This mechanism allows the protocol to select an accurate price while protecting against risks associated with market volatility.
This redundancy mechanism ensures the protocol can continue operating seamlessly, even if one oracle fails.
For USDN tokens or closing a , the price used will be adjusted to $996 ($1,000 - $4).
For USDN tokens or opening a long position, the price will be adjusted to $1,004 ($1,000 + $4).
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 section for more information).