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

use event PoolBalanceUpdated not correctly when there is no balance updated

Summary

use event PoolBalanceUpdated not correctly when there is no balance updated

Vulnerability Details

when p.poolBalance == currentBalance, the balance is not changed.
there is no need to send the event of PoolBalanceUpdated.

Impact

Tools Used

Recommendations

if (p.poolBalance > currentBalance) {
// if new balance > current balance then transfer the difference from the lender
IERC20(p.loanToken).transferFrom(
p.lender,
address(this),
p.poolBalance - currentBalance
);
emit PoolBalanceUpdated(poolId, p.poolBalance);
} else if (p.poolBalance < currentBalance) {
// if new balance < current balance then transfer the difference back to the lender
IERC20(p.loanToken).transfer(
p.lender,
currentBalance - p.poolBalance
);
emit PoolBalanceUpdated(poolId, p.poolBalance);
}

Support

FAQs

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

Give us feedback!