An error in the computation of a user’s debt in the liquidateBorrower function of the StabilityPool can cause the call to fail, even if the protocol has sufficient balance to liquidate the user.
During a liquidation, the liquidateBorrower function in the StabilityPool contract performs a check to ensure that the StabilityPool has enough crvUSD. As we can see, the function multiplies the user’s debt by the usage index to compute the actual debt:
The issue is that the view function getUserDebt, which is used in this computation, is already applied in a previous step, causing the protocol to overestimate the necessary balance.
As seen here:
The scaledUserDebt = debt.mul( usageIndex ).mul(usageIndex)
The protocol multiplies the debt twice by the usage index, leading to an overestimation of the required balance.
The call will revert even if the protocol have enough balance.
Manual review
The protocol should directly the user debt to compute the necessary balance.
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.