Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Gas Saving Tips: Declare 's_owner' as 'immutable'

Summary:

Declare s_ownervariable as immutable.

Vulnerability Details:

Currently, s_owner (which is the owner's address) is stored in storage.

Impact:

Gas is used to retrieve s_owner from storage every time this contract is called.

Tools Used:

Replit IDE, Foundry, Remix, PhindAI

Recommendations:

The s_owner variable is declared as immutable. This means that its value can only be set once during the contract's construction and cannot be changed afterwards. This saves gas because the contract doesn't need to store the owner's address in storage, it can just use the msg.sender value from the constructor.

address private immutable s_owner;
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 2 years ago
inallhonesty Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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