use event PoolBalanceUpdated not correctly when there is no balance updated
when p.poolBalance == currentBalance, the balance is not changed.
there is no need to send the event of PoolBalanceUpdated.
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);
}
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.