The updated debt
of a loan is removed twice from the poolBalance
when a loan is refined by the refinance
function.
In the refinance
function the new debt
is substracted twice from the pools[poolId].poolBalance
. This leads to poolBalance
being underestimated and so the lender can not withdraw their tokens anymore, funds are locked in the contract.
https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L636
https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L698
Funds can be locked in the contract after a refinancing. In addition, borrower is not able to refinance
if they own more than the half of the pool because the second poolBalance
update will underflow.
Manual review
Remove the second poolBalance
update at line 698.
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.