NFT Dealers

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

Unused variable

Author Revealed upon completion

Unused variable leads to wastage of gas

Description

The variable metadataFrozen is a boolean declared in the NFTDealers.sol file but is never used anywhere in the contract. it is never initialized, checked or updated anywhere in the contract logic.

bool public metadataFrozen;

Risk

Likelihood:

Probably medium since every state variable takes up storage space (typically a 32-byte slot)

Impact:

The presence of the unused variable indicates a missing functionality or error .

The presence of the unused variable also leads to wastage of gas in storage during deployment or contract interaction.

Proof of Concept

None

Recommended Mitigation

1. The protocol could add a new functionality that uses the variable or they could remove the line of code to save on gas storage
2. Use 'constant' or 'immuntable' since they are embedded directly in the bytecode and avoid taking up expensive storage slots
3. Group the variable with other related variables into a struct

Support

FAQs

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

Give us feedback!