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

Avoid accessing state when the same variable is available in memory

Summary

Within the borrow function from Lender.sol, _updatePoolBalance is called using the following arguments: poolId, pools[poolId].poolBalance - debt. There is no need to access the state through pools[poolId].poolBalance given that on line 238 we cache the pools[poolId] inside the pool variable.
The _updatePoolBalance should be called with the following arguments: poolId, pool.poolBalance - debt.

This is especially important given that this happens within a for loop.

Support

FAQs

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

Give us feedback!