SmarDex Ecosystem
Github
USDN Protocol
USDN Protocol
  • Introduction
    • Quick Overview
  • THE USDN Protocol
    • Protocol USDN Overview
      • Simplified Examples
    • Protocol Balance
      • Imbalance Protections
      • Equilibrium: The Role of the Funding Rate
    • Vault Side
      • Vault Overview
      • Rebase Mechanism
      • Yields
        • Funding Rates
        • Yield-bearing asset
    • Long Side
      • Long Perpetual
      • Long Overview
      • Dip Accumulator
      • wstETH Collateralization
      • Liquidations and Minimum Position
    • Inside the Protocol
      • Protocol vs Market Fluctuations
      • 1. Providing a Price
      • 2. Calculating Long PnLs
      • 3. Applying the Funding Rate
      • 4. Liquidating Positions
    • Integration
      • WUSDN
    • Fees
      • Protocol Fees
      • Liquidation Fee
    • Protocol parameters
    • Oracles
    • Governance
    • Risks
    • SDEX
    • Addresses
    • FAQ
    • Glossary
  • PERIPHERY
    • Long farming
  • Whitepaper
  • Github
  • Audits
Powered by GitBook
On this page
  • Types of Oracles Used
  • How the Protocol Chooses Prices with Pyth
  • Redundancy Mechanism
  1. THE USDN Protocol

Oracles

PreviousProtocol parametersNextGovernance

Last updated 2 months ago

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.

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 .

  1. 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.


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:

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


Redundancy Mechanism

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).

Providing a Price
Pyth documentation
Chainlink documentation
governance
USDN Protocol
Oracles
minting
long position
redeeming