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

Gas optimization in collectPresent

Optimization Details

This is a GAS.
If we assume that Santa will not change his mind after he decided an address state we can remove the check on s_theListCheckedOnce from the collectPresent() function

Recommendations

Change this: if (s_theListCheckedOnce[msg.sender] == Status.NICE && s_theListCheckedTwice[msg.sender] == Status.NICE)
in: if (s_theListCheckedTwice[msg.sender] == Status.NICE)

And change this:

} else if (
s_theListCheckedOnce[msg.sender] == Status.EXTRA_NICE
&& s_theListCheckedTwice[msg.sender] == Status.EXTRA_NICE
) {

in
} else if (s_theListCheckedTwice[msg.sender] == Status.EXTRA_NICE) {

Updates

Lead Judging Commences

inallhonesty Lead Judge almost 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.