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

Gas Optimizations

Gas

[G-01] State variables only set in the constructor should be declared immutable

Summary

Variables that are assigned values only during the construction phase and remain unchanged thereafter should be designated as immutable. This adjustment bypasses the costly storage-writing activity during the constructor execution, which consumes about 20,000 gas per variable. Additionally, it replaces the high-priced storage-reading operations, costing around 2,100 gas per read, with a far more economical value reading operation that only expends 3 gas.

Before:

address private s_owner;

After:

address private immutable s_owner;
Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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