Code to reproduce
ERC2771ContextUpgradeable has an constructor, if I inherit it, I cannot use upgrades to deploy it.
contract MyNFT is
ERC2771ContextUpgradeable,
UUPSUpgradeable,
ERC721URIStorageUpgradeable,
{
constructor(address forwarder) ERC2771ContextUpgradeable(forwarder) {
}
}
then, when I try to deploy it, error occurs:
Error: Contract `MyNFT` is not upgrade safe
Contract `MyNFT` has a constructor
Environment
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^1.0.2",
"@nomicfoundation/hardhat-network-helpers": "^1.0.3",
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
"@nomiclabs/hardhat-ethers": "^2.1.0",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@openzeppelin/contracts": "^4.7.1",
"@openzeppelin/contracts-upgradeable": "^4.7.1",
"@openzeppelin/hardhat-upgrades": "^1.19.0",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"chai": "^4.3.6",
"decimal.js": "^10.3.1",
"dotenv": "^16.0.1",
"ethers": "^5.6.9",
"hardhat": "^2.10.1",
"hardhat-gas-reporter": "^1.0.8",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "^1.0.0-dev.23",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.21",
"ts-generator": "^0.1.1",
"ts-node": "^10.9.1",
"typechain": "^8.1.0",
"typescript": "^4.7.4"
}
node: 18.6.0