Skip to content

Variable Shadowing#

Informational

Variable shadowing occurs when a local variable has the same name as a state variable. This is discouraged as it reduces the readability of the code and is prone to errors. Best practice is to avoid shadowing not only in a given contract, but also in its inheriting contracts.

The name and symbol constructor arguments shadow inherited state variables from CommunityToken in the following contracts:

  • ERC721Wrapper
  • ERC721WrapperVotes
  • PVFDWrapperVotes

This was not found to cause any bugs, but does inhibit the readability of the contract.

Recommendation#

Rename the constructor arguments and their usages to name_ and symbol_ in the above contracts to eliminate variable shadowing.