Themis V2 Documentation
Search…
⌃K

# Loan Liquidation

To prohibit borrowers from defaulting on their loans, Themis incentivizes liquidators to observe and liquidate loans with a borrowing amount above the allowed Loan Risk.

## Work Flow

The core of the liquidation logic of Themis 2.0 is very simple and can be roughly divided into the following steps.
• Discovering the liquidation order
• Calling the liquidation interface Initiate Liquidation (M0 can initiate 50% liquidation)
• Pay the corresponding Token
• Obtain collateral
Anyone can call the liquidation through the interface. Usually, the liquidator will get collateral of higher value than the substitute debt, so the liquidator needs to dispose of the collateral by itself after getting it.

## M0 Liquidation

When the Loan Risk of a position is greater than 100% (Loan Risk=1/health factor), the liquidator repays part or all of the outstanding loan amount on behalf of the borrower, while the liquidator receives a discounted amount of collateral in return (also known as Liquidation Bonus). In M0, the liquidator can decide whether it wants to receive the relevant amount of tToken instead of the underlying asset. When the liquidation is successfully completed, the Loan Risk of the position is reduced, bringing the Loan Risk below 100%.
Liquidators can only close a certain amount of collateral defined by a close factor. Currently the close factor is 0.5. In other words, liquidators can only liquidate a maximum of 50% of the amount pending to be repaid in a position. The liquidation discount applies to this amount.
Liquidators must approve() the Pool contract to use debtToCover of the underlying ERC20 of theasset used for the liquidation.
NOTES
• In most scenarios, profitable liquidators will choose to liquidate as much as they can (50% of the user position).
• debtToCover parameter can be set to uint(-1) and the protocol will proceed with the highest possible liquidation allowed by the close factor.
• To check a user's health factor, use getUserAccountData()

## M1 Liquidation

When the Loan Risk of a debit order in M1 is greater than 100%
{(loan risk in M1=Outstandingdebtvalue/(assetValue*liquidationThreshold)} .
${LR} =\frac{V_{debt}}{V_{collateral}} Liq.Threshold$
The liquidator repays the entire outstanding amount on behalf of the borrower. At the same time the liquidator gets a discount on the collateral as a return. In M1, there is no LiquidationBonus set, and the liquidator is expected to receive a reward of approximately (1 - liquidationThreshold)*CollateralValue. When the liquidation is completed. The order will be settled.
Available only for M1 Pool calls

#### NOTES

• The discounted collateral which is given to the liquidator is usually LP assets or other types of Yield Bearing Tokens that need to be redeemed on their own.
• Earnings from past time in the collateral（fees, yield, reward etc. ) are not calculated into the collateral value, so liquidation may result is a higher than expected award.

## Liquidation Bonus

Due to the message-driven nature of smart contracts, liquidation can only occur when triggered by an external entity (liquidator). % of the liquidated value is set aside as incentives for liquidators to actively monitor risky loans and trigger liquidations.