Snowman Merkle Airdrop

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

[GAS] Public function which is unused inside code can be made external to save gas fees

[GAS] Snowman::tokenUri() is never called inside the contract even though it is a public function and consumes more gas

Description

  • Snowman::tokenUri() is a public function which allows it to be called from within the contract too. But since it has never been used in the contract, it should be made external to save gas fees

// >>> PUBLIC FUNCTIONS
@> function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (ownerOf(tokenId) == address(0)) {
revert ERC721Metadata__URI_QueryFor_NonExistentToken();
}

Risk

Likelihood:

  • Whenever tokenUri() is called

Impact:

  • Slightly higher gas fees

Recommended Mitigation

// >>> PUBLIC FUNCTIONS
- function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
+ function tokenURI(uint256 tokenId) external view virtual override returns (string memory) {
if (ownerOf(tokenId) == address(0)) {
revert ERC721Metadata__URI_QueryFor_NonExistentToken();
}
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.