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

Use memory instead of state variable

Summary

Vulnerability Details

There are many instances in the code where direct access to state variables is done which costs a lot of gas (SSTORE/SLOAD = 100 gas each) compared to using memory variables (MSTORE/MLOAD = 3 gas each).

Impact

Consumes more gas during code execution in runtime.

Tools Used

Manual Review

Recommendations

Cache state variables to memory variable and access the memory variable.

Pool memory tempPool = pools[poolId];
if (tempPool.lender != msg.sender) revert Unauthorized();

Support

FAQs

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