40,000 USDC
View results
Submission Details
Severity: gas

Stack variable cost less while used in emiting event

Summary

Stack variable cost less while used in emiting event

Vulnerability Details

Even if the variable is going to be used only one time, caching a state variable and use its cache in an emit would help you reduce the cost by at least 9 gas

File: /src/Escrow.sol
// @audit `i_seller` is a state variable
96: emit Confirmed(i_seller);
// @audit `i_buyer` is a state variable
117: emit Resolved(i_buyer, i_seller);
// @audit `i_seller` is a state variable
117: emit Resolved(i_buyer, i_seller);

Impact

Save gas

Tools Used

Manual

Recommendations

cache state variable

Support

FAQs

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