NFT Dealers

First Flight #58
Beginner FriendlyFoundry
100 EXP
Submission Details
Impact: low
Likelihood: high

[G-1] The `InvalidAddress` error will never be triggered and can be removed

Author Revealed upon completion

The InvalidAddress error will never be triggered and can be removed

Description

The mintNft function is checking if the msg.sender is the zero address, and reverts in this case. However, a transaction can only be sent by an EOA or a contract account. For this reason, the assertion msg.sender == address(0) will never be true. The requirement is consuming gas on every mint for no reason.

@> error InvalidAddress();

Recommended Mitigation

Remove the InvalidAddress error:

- error InvalidAddress();
...
function mintNft() external payable onlyWhenRevealed onlyWhitelisted {
- if (msg.sender == address(0)) revert InvalidAddress();

Support

FAQs

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

Give us feedback!