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

## [G-25] Use assembly to emit events

Summary

[G-25] Use assembly to emit events

We can use assembly to emit events efficiently by utilizing scratch space and the free memory pointer. This will allow us to potentially avoid memory expansion costs. Note: In order to do this optimization safely, we will need to cache and restore the free memory pointer.

file: /src/Lender.sol
165 emit PoolBalanceUpdated(poolId, p.poolBalance);

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L165

file: /src/Lender.sol
214 emit PoolMaxLoanRatioUpdated(poolId, maxLoanRatio);

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L214

Support

FAQs

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