Liquidations close unsafe positions when a borrower’s debt exceeds their borrowing power at the current oracle price. Anyone can repay part of an unsafe borrower’s debt in Coin and seize collateral with a variable incentive. This keeps solvency intact and prevents bad debt.
Accrue interest and update borrower’s internal accounting.
Read oracle price; require liquidations to be allowed.
Compute the maximum chunk that can be liquidated now:
If the position is healthy, liquidation is not allowed.
If unhealthy, the protocol allows liquidating up to 25% of the borrower’s debt, but at least a minimum chunk size (10,000 Coin) when applicable.
Reduce the borrower’s debt by repayAmount.
Compute the liquidator’s collateral reward at the current price with an incentive (see Incentives below).
Cap the reward by the borrower’s remaining collateral and enforce minCollateralOut (slippage protection for the liquidator).
Transfer collateral to the liquidator; pull repayAmount of Coin from the liquidator and burn it.
If the position is undercollateralized, the protocol attempts a write‑off: delete remaining debt, redistribute it across the system’s borrowers, and hand the borrower’s remaining collateral to the liquidator.
Chunked liquidations: At most ~25% of a borrower’s debt can be liquidated per call (subject to the 10,000 Coin minimum). This ensures that the liquidation incentive is sufficient to attract liquidators.
Oracle‑gated: If the oracle is stale/invalid, liquidations are temporarily disabled to avoid mispricing.
Write‑off path: If a position is effectively irrecoverable (debt > 100× collateral value), remaining debt can be redistributed among borrowers, and the liquidator receives the borrower’s remaining collateral (negligible).
Suppose a borrower has debt of 200,000 Coin, collateral value of 230,000 at the oracle price, and a collateral factor of 80% (borrowing power = 184,000). The position is undercollateralized (200,000 > 184,000).
Maximum liquidatable chunk is 25% of debt = 50,000 Coin (greater than the 10,000 minimum).
If the incentive computes to 8%, and the price implies 1 Coin buys $1 of collateral value, then the liquidator who repays 50,000 Coin receives collateral worth 54,000 in value (capped by what’s available), transferred at the oracle price.