> For the complete documentation index, see [llms.txt](https://docs.affluent.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.affluent.org/liquidation.md).

# Liquidation

### Liquitable Account

An account becomes eligible for liquidation whenever **either** of the following metrics breaches the market’s **liquidation threshold**.

$$
Risk Ratio = \frac{\sum\_{i}{f\_i\cdot abs(S\_i -B\_i)}}{S -B}
$$

$$
Leverage = \frac{S}{S -B}
$$

> Liquidation thresholds : `LiquidationRiskRatio` and `LiquidationLeverage` are set at the market level.

To reduce **Risk Ratio**, a user can lower exposure to higher-risk assets.

To reduce **Leverage**, repaying a portion of the debt is most effective.

At high leverage, both metrics become more sensitive to price swings, so proactive management is critical.

### Liquidation Process

1. **Continuous Monitoring**

   Constantly tracks each account’s Risk Ratio and Leverage, flagging any position that approaches liquidation thresholds
2. **Action Preparation**

   When a liquitable account is detected, liquidators (or automated bots) prepare to intervene, selecting the debt portion to be repaid and the collateral asset to seize
3. **Execution**

   The liquidator submits a transaction to repay part of the borrower’s outstanding debt. The repayment amount is capped by `liquidationCloseRatio`, ensuring only a limited slice of the position can be liquidated in a single event
4. **Collateral Seizure**

   In return, the liquidator claims the chosen collateral, receiving an extra incentive defined by `liquidationBonus`

### Key Parameters

<table><thead><tr><th width="216">Parameter</th><th width="101">Scope</th><th>Purpose</th></tr></thead><tbody><tr><td><strong>Liquidation Close Ratio</strong></td><td>Market</td><td>Caps how much of a position can be liquidated in a single transaction, protecting borrowers from full liquidation at once.</td></tr><tr><td><strong>Liquidation Bonus</strong></td><td>Asset</td><td>Percentage premium awarded to liquidators, incentivizing fast action and maintaining market health.</td></tr></tbody></table>
