In the function refinance
in Lender.sol the new pool has its balance updated twice. This results in the new pool being reduced by 2 * debt
, while the loan being given out is only debt
. The end result of this ends up being that the lender of that new pool won't be able to withdraw all of their funds since the pool balance will be lower than what it is supposed to be. Those lost funds will stay stuck in the smart contract.
below are the two lines of code seen within the refinance function that causes the problem.
Below is a test illustrating the issue. This is coded within the test suite of the protocol.
as expected that extra assert will fail since debt is being subtracted twice.
That lender will then not be able to withdraw all of his funds since the pool balance is lower than it's supposed to be (removeFromPool()
reverts if amount requested out is bigger than pool balance).
Lenders will have part of their funds stuck in the Lender.sol smart contract every time their pool is used as the destination of a refinance.
Foundry & Manual Review.
Only subtract the debt from the new pool's balance once.
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.