Bagels Finance
Liquidation Mechanism


Debt Value: Value of borrowed tokens
Position Value: Collateral + Debt Value + Rewards Value
Debt Ratio: Debt Value/Position Value
Equity Value: Position Value - Debt Value

Reason of Liquidation:

When the Equity Value continues to decline and may result in failure to repay the loan, liquidation is a necessary way to protect the lender.When the Debt Value is higher than the "KillFactor" function standard of the user's position value, the liquidator will liquidate these positions.

Liquidation Rules:

After liquidated, the position will first be used to repay the debt of the Bagels Finance deposit fund pool, and the remaining value after deducting the liquidation fee will be returned to users.
Formula: Expected refund= Position Value - Debt Value (including interest)-liquidation fee.
Liquidation Fee = Position Value ×2%

Liquidation threshold:

Liquidation will occur if the Debt Ratio exceeds 85%, which means when the Risk Ratio reaches 100%.
Risk Ratio = Debt Ratio/KillFactor, KillFactor = 85%

Liquidation example:

A yield farmer leverages 2.5x by borrowing 150ETH with her initial 100ETH in the ETH/BUSD pool, with the total position of 250 ETH at present.
Since the collateral deposited by users and the borrowing token are both ETH, Bagels need to swap these ETH into LP according to the ratio of 50:50: 125ETH + 400000BUSD, with the total position of 250 ETH. The position direction is short 125 ETH. Debt Ratio(Debt Value/Position Value) is 60% at present(150ETH/250ETH).
When the price of ETH increases, the position value of ETH drops from 250 ETH to 175 ETH, leaving his debt ratio at 85% (150ETH/175ETH), which is greater than the "KillFactor" of the ETH/BUSD pool. In this case, the liquidator can come in to liquidate.
During the liquidation process, the position value will first be used to pay the debt (in this case 150 ETH). Then 2% of the position value of the total position value(250ETH) is paid to liquidator.Hence, liquidator will earn 5ETH in this case. Finally, the remaining 20 ETH (175ETH-150ETH-5ETH) will be returned to the yield farmer.