Function _repay()
in lendingPool
incorrectly computes userDebt
which further leads to an invalid value being assigned to actualRepayAmount
i.e. SOURCE
Notice that we fetch the userDebt
by directly querying balanceOf
on debtToken
.
However, we wrongly assume that the value that is returned is NOT scaled, when infact, this value has already been SCALED as these are directly MINTED using scaled amount when the user made a borrow.
Comparing such a value(which is scaled twice) against amount
variable is completely wrong, and would always lead to assigning userScaledDebt
to actualRepayAmount
Next, we assign this value to scaledAmount
variable, again, we perform scaling, which should not be the intended behaviour.
Manual
Consider using userDebt
directly when assigning actualRepayAmount
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.