Unused variable in ERC721PresetMinterPauserAutoIdUpgradeable.sol

I’m not sure why the name and symbol are not used in the ERC721PresetMinterPauserAutoIdUpgradeable 4.1.0 Lib.

This is the warning I’m getting;

Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol:62:62:
|
62 | … tMinterPauserAutoId_init_unchained(string memory name, string memory symbol, string memo …
| ^^^^^^^^^^^^^^^^^^

Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol:62:82:
|
62 | … init_unchained(string memory name, string memory symbol, string memory baseTokenURI) inter …
| ^^^^^^^^^^^^^^^^^^^^

:1234: Code to reproduce

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol";

contract LoopCompNFT is Initializable, ERC721PresetMinterPauserAutoIdUpgradeable {

    function initialize(

      string memory name,

      string memory symbol,

      string memory uri

    ) public virtual override initializer {

        __ERC721PresetMinterPauserAutoId_init(name, symbol, uri);

    }

}

:computer: Environment

@openzeppelin/contracts-upgradeable”: “^4.1.0”,
“hardhat-deploy”: “^0.8.8”,
“hardhat-deploy-ethers”: “*”

1 Like

Made a PR to fix this!

1 Like

The upgradeable contracts are generated through an automated process that is currently not smart enough to remove unused variables. This also means we can’t accept the PR as it will get overwritten on the next run of this process.

Thanks for the PR regardless.

We plan to remove these variables automatically but I can’t share a timeline for that. Sorry for the inconvenience!

1 Like