How Do Smart Contracts Manage the Collateral for a Leveraged Derivative Position on a DEX?
The smart contract acts as a non-custodial escrow, locking the user's collateral in a pool upon opening the position. It constantly monitors the position's margin ratio using oracle price feeds.
If the ratio falls below a maintenance threshold, the contract automatically makes the collateral available for liquidation. This process is transparent and ensures the debt is covered without a centralized clearinghouse.