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

Lender.refinance()::pool balance will be incorrectly updated when calling refinance()

Summary

pool balance will be incorrectly update when calling refinance().

Vulnerability Details

refinance() is callable by borrower and refinance a loan to new offer. However, when borrower call refinance() function. it updates the pool balance twice, and this is incorrect. For example, pool A has pool.balance of 500, and borrower want to refinance this loan to pool A. When borrower calls the refinance(), the pool balance will update twice and become 300.

Impact

Since it cannot update balance correctly again, lender will loss funds

Tools Used

vscode

Recommendations

delete line 698

pools[poolId].poolBalance -= debt;

Support

FAQs

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