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

debt is being decreased twice in `refinance` function

Summary

We are removing the debt from the new pool lender twice which causes a loss of funds

Vulnerability Details

This bug causes extra debt tokens from the lender to be taken and lost. It would cause a revert or less pool balance for the lender.

_updatePoolBalance(poolId, pools[poolId].poolBalance - debt);
pools[poolId].outstandingLoans += debt;
//@audit skipped the rest to show impact and see how we remove poolBalance twice well that should not happen since there is only // one loan being accounted for in this function
// update pool balance
pools[poolId].poolBalance -= debt;

Impact

A borrower can try to refinance the loan and decrease poolBalance for the lender

Tools Used

Recommendations

remove the last poolBalance decrease

Support

FAQs

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