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.
Last updated
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.
Last updated
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:
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.
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.
Liquidate positions: The protocol checks if there are any positions to . Insolvent positions are automatically liquidated to ensure the system's stability and security.
Trigger the dip accumulator: If the protocol is heavily imbalanced, the will be triggered to safeguard the protocol. Learn more about it .
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.