# Dynamic Liquidation

The liquidation mechanism around current lending and borrowing solutions is unfair towards the borrowers. This is mostly due to the fixed closing factor and liquidation incentives. For example, in Aave, when a debt position becomes unhealthy, up to 50% of their collateral is allowed to be liquidated, without consideration of amount required to take the position back to a healthy posi- tion. If a user’s position is unhealthy by an amount of $10 and the collateral is $5000, then $2500 of the user’s collateral is forced to be liquidated. This, com- bined with a fixed liquidation bonus, is what causes a toxic liquidation spiral as demonstrated by Chaudhary et. al. This increases the amount of bad debt incurred by the protocol as we witnessed with Avi Eisenberg’s attack on Aave on November 2022. To mitigate this and make the model fair to borrowers, we will improve upon Aave’s model and develop a dynamic liquidation system.

## Dynamic Liquidation Incentives

$$
L.I. = max (0, min(L.I.\_{base} \* \frac{1}{LTV} - 1 -e)
$$

Where L.I.*base* is the maximum discount provided for the liquidation. The discount is L.I.*base* under normal circumstances, whenever LTV approaches 1, the discount starts decreasing to avoid liquidation spiral.

## Dynamic Closing Factor

$$
c = min(c\_0 \* \frac{1-LTV}{1-LTV\_{liq}} + \frac{LTV-LTV\_{liq}}{1-LTV\_{liq}},1)
$$

LTVliq is the liquidation threshold of an asset and c0 is the minimum closing factor which is a protocol set parameter. Closing factor is c0 when LTV = LTVliq and keeps increasing until LTV = 1, where closing factor is also 1. This model prevents a toxic liquidation spiral, and hence reduces the probability of Cedro incurring a huge amount of bad debt.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cedro.finance/features/dynamic-liquidation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
