๐ Math behind Liquidations
Last updated
Last updated
We have made our own liquidation formula to allow users to choose their preferred liquidation target. Some might want to be liquidated close to the maximum, and some close to the minimum. As the price goes down, every user gets liquidated to the same position, as there is a limit on how far stepped liquidations go, as we don't want the liquidation fees to be less than gas and swap fees.
e
1 ETH, aka 10ยนโธ wei
1 ETH
debt
User's debt value in dollars
0 - โ
collateral
User's real collateral value in dollars (not adjusted to the maximum collateral ratio)
0 - โ
health
Target health ratio
0 - 1 ETH
mcr
Maximum collateral ratio
0 - 1 ETH
fee
Liquidation fee added onto collateral
0 - 1 ETH
Code we use to calculate the debt and collateral change for a user.