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
  1. THE USDN Protocol

Inside the Protocol

What really happens inside the USDN protocol? This is what we will detail in this section, so you can gain a clear understanding of its operation.

PreviousLiquidations and Minimum PositionNextProtocol vs Market Fluctuations

Last updated 2 months ago

When you perform one of the four main actions ( or the , opening or closing a , several steps take place behind the scenes. The first of these steps is to obtain a price, as the , operating on the blockchain, does not inherently know market prices. This is why, for every action, the user must provide a price.

Once the price is submitted, the protocol can carry out the necessary calculations to update each position. Here is an overview of the steps the protocol executes:

  1. Calculate long PnLs: The protocol begins by calculating the profit or loss (PnL) of long positions. The of these positions are adjusted accordingly: if a long bet succeeds, its collateral increases.

  2. Apply fundings: The protocol calculates the amount owed based on the and transfers assets between the long side and the , determining who owes and who receives.

  3. Liquidate positions: The protocol checks if there are any positions to . Insolvent positions are automatically liquidated to ensure the system's stability and security.

  4. Trigger the dip accumulator: If the protocol is heavily imbalanced, the will be triggered to safeguard the protocol. Learn more about it .

  5. Rebasing the USDN token: If all of the above pushed the price of the USDN token higher than necessary, it will inflate the holders' balance to compensate. Learn more about it .

In the following sections, we will detail each of these steps to give you a deeper understanding of the protocol's inner workings.

To avoid duplicating information, only the first 3 steps will be explained in the following sections.

here
here
minting
redeeming
USDN token
long position)
protocol
collaterals
funding rate
vault side
liquidate
dip accumulator