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

Update balance twice in refinance() function on Lender.sol

Summary

Update balance twice in refinance() function on Lender.sol

Vulnerability Details

Update balance twice in refinance() function on Lender.sol

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L636
...
_updatePoolBalance(poolId, pools[poolId].poolBalance - debt);
...
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
...
pools[poolId].poolBalance -= debt;
...

Impact

It will make Lender.sol contract confusing in balance and new pool owner will be in danger pretty much.

Tools Used

Manual

Recommendations

Need to remove line 698 in Lender.sol contract.

Support

FAQs

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