Protocol burns less amount of EURO tokens after liquidation and get a bad debt
When vault owner mints X EURO tokens, then he should provide collateral, that can collateralize that X amount.
In case if collateral price decreases, then it's possible that liquidation will occur. Liquidation is allowed, when collateral ratio is smaller than allowed.
This means that all collateral that exists in the vault will be sold to the LiquidationPool stake holder according to the current collateral price. And the all EURO tokens amount will be burnt to burn minted X tokens.
To calculate costInEuros
that holder should pay for the collateral portion the function uses collateral rate, the same that is used in the vault. Because of that, smaller amount of euro tokens will be burnt.
Let's look into example.
Suppose that i have borrowed 100 EURO tokens with collateral ratio 110%. This means that i have provided at least 110 euro in collateral.
Now liquidation is only allowed, when i have less than 110 euro as collateral. So suppose that i have 105 euro now and liquidation starts. Also for simplicity let's assume that only 1 person exists in LiquidationPool and it has more than 100 euro on balance. Now, when function calculates costInEuros
it will convert my collateral to 105 euro and divide by 110%, which will give 95.45 tokens that staker needs to pay and that will be burnt.
As result this is a good deal for the staker, but not good deal for a protocol as it now get a loss of 4.55 euro tokens.
Less EURO tokens are burnt than was minted by vault. Protocol received a bad debt.
VsCode
When you do liquidation, then provide amount that vault has minted and burn not less than this amount. This will change incentives for the liquidation pool during the time and will incentivize them to liquidate as soon as position becomes unhealthy.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.