The i_weth variable in Snow.sol is declared as a regular state variable despite following the i_ naming convention for immutable variables and being set only in the constructor.
The i_weth variable should be declared as immutable since it's only set once in the constructor and never modified, allowing the compiler to optimize gas usage by embedding the value directly in the bytecode.
Likelihood:
Occurs on every function call that accesses the i_weth variable
Affects buySnow() and collectFee() functions which are core protocol operations
Impact:
Increased gas costs for users calling buySnow() (extra SLOAD operation ~2100 gas)
Increased gas costs for collector calling collectFee()
Unnecessary storage slot usage increasing deployment costs
This shows the implementation costing more gas:
declare it immutable, this would help optimize gas and save money
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.