Blog

Liquidation Mechanism

Yesterday we covered the Lending and Borrowing 101 - today we will cover the liquidation flow in depth

What is Liquidation?

Liquidation in lending and borrowing protocols is a process where a borrower's collateral is seized and the debt is repaid by a third party. This usually happens when the value of the collateral falls below a certain threshold compared to the borrowed amount, marking the position as unhealthy to allow bots or individual users to liquidate the position.

Why is Liquidation important?

Liquidation is a critical mechanism for maintaining the health and stability of a lending and borrowing protocol. It ensures that the protocol remains solvent. By allowing for the seizure of collateral and repayment of debt in a fast and fashionable manner, a protocol prevents bad debt.

When does a Liquidation occur?

A liquidation occurs when a user's Loan-to-Value (LTV) ratio crosses a predetermined threshold. The LTV ratio is a measure of borrowed funds to the value of the collateral. If this ratio exceeds the limit set by the protocol (often around 80%), it indicates potential risk, triggering liquidation.

Liquidation Explained with an Example

Let's consider an example involving two characters, Alice and Bob:

1. Alice deposits 1,000 USDT as collateral.

2. Alice borrows 0.3 ETH, which is worth 660 USD at the time (ETH price = 2,200 USD). This sets her LTV ratio at 66%.

Change in ETH Price:

The price of ETH rises to 2,700 USD. Consequently, the value of Alice's borrowed amount increases, pushing her LTV to 81% and crossing the 80% liquidation threshold.

Bob's Intervention:

Bob, another user, notices Alice's position is now vulnerable and eligible for liquidation.

Liquidation Process:

Bob calls the liquidation function, specifying Alice's address and the desired liquidation value.

Most protocols have safeguards to prevent excessive loss for borrowers. For example, only 50% of the debt may be liquidated at a time.

Execution of Liquidation:

Bob liquidates 50% of Alice's debt, which means he is repaying 0.15 ETH (405 USD) on behalf of Alice, which decreases Alice’s LTV.

In return, Bob receives Alice's collateral, typically with a penalty added (e.g., 5%). Thus, Bob pays 405 USD but receives 425.25 USDT from Alice's collateral, which then increases Alice’s LTV again.

Post-Liquidation Position:

Alice's position is adjusted to reflect the liquidation: Alice's collateral is now 574.75 USDT, and her debt is 0.15 ETH (405 USD). This results in a healthier LTV of 70.46%, marking the position as healthy again.

Protocol-Specific Conditions and Scenarios

Different protocols might have unique conditions, like maximum liquidation values relative to position size, to minimize the borrower's loss.

Special Scenarios:

Certain situations might exacerbate the borrower's position, such as a large penalty leading to a more unhealthy LTV ratio.

Extreme Cases: In rare cases, the liquidation plus penalty might exceed the provided collateral, which often results in issues like a revert of the liquidation attempt. Protocols should implement a safeguard which then only pays the provided collateral.

Key Takeaways for Borrowers

Liquidation Penalty: Choosing a protocol with a reasonable liquidation penalty is crucial.

Speed of Liquidation: Quick liquidation helps in maintaining protocol health and reducing borrower loss.

Token Volatility: For tokens with higher volatility, protocols often set lower LTV limits to mitigate risks.

Would love to hear the most interesting issue you have found in a liquidation process audit.