20,000 USDC
View results
Submission Details
Severity: low
Valid

Refinancing in the same pool requires it to have a higher balance than needed because of a flawed check

Summary

Refinancing a loan into the same pool it is in requires the pool to have the original loan amount +- the difference because it doesn't check whether the pool already has the original amount as outstanding debt.

Vulnerability Details

Lender.sol's refinance() has a check, which makes sure the pool we are refinancing into has enough liquidity to cover the new debt of the loan.

if (pool.poolBalance < debt) revert LoanTooLarge();

The issue arises when the loan is getting refinanced in the same pool it is already in. Then it will require the pool to have the amount of the loan again instead of just the difference between the old debt and the new debt. This makes it harder for a loan to be refinanced in the same pool as the pool may not have enough liquidity to pass this check.

Impact

Some loans will not be able to be properly refinanced.

Tools Used

Manual Review

Recommendations

Consider checking whether the loan's old pool is the new pool as well first and doing additional checks accordingly.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.