In liquidateBorrower() , the call to getUserDebt(), returns *scaled * userDebt.
However, the function incorrectly scales it again, which doubles the userDebt, and eventually gives a wrong approval of token to the lendingPool
In order to liquidate borrowers in lendingPool, we need to call liquidateBorrower() in StabilityPool contract.
To cover the debt, the stability pool gives an approval to lendingPool for transferring an equal amount of userDebt to the rToken contract in crvUSD token.
However, the approval given to lendingPool is WRONG.
Function liquidateBorrower()
Notice the call to getUserDebt(), we are incorrectly assuming that the debt returned has not been SCALED, when infact, it is scaled User Debt that is returned.
So, the computation of scaledUserDebt almost doubles the amount, hence, a wrong approval is given to the lendingPool
This results in a much larger approval than normally intended, which goes beyond the intended behaviour.
Large approval for crvUSDToken will be given to the lendingPool
Manual
Consider using the userDebt directly because it has already been SCALED:
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.