Liquidation Example

Diane has created an Algo vault by depositing 1200 Algos. Her collateral is worth $120 at the time of the vault creation and while creating her CDP she borrows the minimum $100 worth of xUSD. In this example, her ICR is 120%. She goes about her day.

As time passes, the value of her Algo decreases from $0.10 to $0.097 and she accrues 0.1 xUSD in interest. At any point she could choose to manage her vault to avoid liquidation. She could either add additional collateral to her balance, or pay back a portion of her debt to improve her CR. She likes the yields on her xUSD so she wants to keep her vault open, rolling the dice that her vault will remain healthy. If not, she's fine selling her collateral for a small loss. She now has a credit ratio of:

($0.097*1200)/($100+$.01) = $116.4/$100.1 =1.164= 116.4\%

The Algo vault has a liquidation threshold of 115%, so she is getting close to liquidation. Working backwards we know that her liquidation price is:

115\%=1.15=(X*1200)/($100+$0.1)

Solving for x, it can be shown that her liquidation price is $.09593. The the price of Algo continues to drop unfortunately. It passes her LT, her vault may now be liquidated

Jack is watching the vault list for liquidation opportunities and see's Diane's vault is sitting below it's LT. By the time he has noticed, her account has dropped a bit further below the threshold due to Algos price continuing to fall (the struggle is real). Her current CR is:

($0.094*1200)/($100+$.01) = $112.8/$100.1 =1.127= 112.7\%

The maximum that Jack can liquidate her is back up to a CR of 115%. The protocol will allow him to liquidate the maximum amount, but how is that amount decided?

For simplicity, refer to the collateral ratio vs. debt repaid curve below. This curve is generated from a hypothetical spectrum of xUSD liquidation amounts and Diane's resulting collateral ratio. The more xUSD that is repaid, the higher Diane's resulting CR will be. Finding the maximum xUSD payment allowed by the protocol involves finding the point where the CR curve crosses 115%, or 1.15.

Based on this curve, it's simple to identify that 1.15 is achieved by a repayment of ~23.5 xUSD. To check our work lets plug that 23.5xUSD back into the CR calculation and see what results.

In this final calculation:

  • $0.094 is the price of Algo

  • $23.5 is the approximate xUSD that is re-payed for Diane

  • 1.05 is Jacks liquidator discount for the Algo vault

  • $100 was Diane's initial deposit

  • $.1 was the accrued interest on Diane's deposit

As you've no doubt noted 1.149=/=1.15, but this deviation is due to approximations that were made when generating the curve above. The x-axis uses discreet half unit xUSD increments. Calculations on chain aren't limited because they use continuous functions rather than discreet datasets to perform their calculations.

Having established how much Jack can liquidate, the protocol allows him to put the necessary xUSD into the contract, re-paying Diane's debt. He is rewarded for this service with 262.5 Algos. Jack has now taken a small profit, and Diane has effectively sold her Algos at a 5% below market rate to maintain her position in xUSD. Protocol stability is maintained.

Last updated