Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[INFO] Two if statement branches can be merged into one

[INFO] Two if statement branches can be combined into one branch in SnowmanAirdrop.sol

Description

  • There are two if statement branches in SnowmanAirdrop::constructor() returning the same error and performing similar checks which can be merged into one.

constructor(bytes32 _merkleRoot, address _snow, address _snowman) EIP712("Snowman Airdrop", "1") {
@> if (_snow == address(0)) {
revert SA__ZeroAddress();
}
@> if (_snowman == address(0)) {
revert SA__ZeroAddress();
}

Risk

Likelihood:

  • When constructor is called for deployment

Impact:

  • More gas fees during deployment

Recommended Mitigation

The two if statements can be merged into one like this:

constructor(bytes32 _merkleRoot, address _snow, address _snowman) EIP712("Snowman Airdrop", "1") {
- if (_snow == address(0)) {
+ if (_snow == address(0) || _snowman == address(0)) {
revert SA__ZeroAddress();
}
- if (_snowman == address(0)) {
- revert SA__ZeroAddress();
- }
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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