How Does a Smart Contract Handle the Conversion of Collateral to Stablecoins upon Liquidation?
Upon liquidation, the smart contract automatically executes a swap function, selling the liquidated collateral asset (e.g. ETH) for stablecoins through an integrated decentralized exchange (DEX) liquidity pool.
The stablecoins are then used to repay the outstanding debt. This process is immediate and trustless, ensuring the debt is covered with a stable asset.