Hello, I'm trying to upgrade a simple ERC20Upgradeable adding EIP712Upgradeable to the inheritance chain
Code to reproduce
before
contract Token is ERC20Upgradeable { }
after
contract Token is ERC20Upgradeable, EIP712Upgradeable {}
and I'm receiving the following error when running
await upgrades.validateUpgrade(TokenV1, TokenV2, {});
Error: New storage layout is incompatible
@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol:30: Inserted `_HASHED_NAME`
> New variables should be placed after all existing inherited variables
Note: I also tried to add ERC2771ContextUpgradeable.sol to the inheritance chain, which gave similar issues, I'm trying to solve one at a time, but a general solution would be really useful (Final inheritance chain should be
contract Token is ERC20Upgradeable, EIP712Upgradeable, ERC2771ContextUpgradeable {}
Environment
Solidity version: "0.8.7"
"dependencies": {
"@openzeppelin/contracts-upgradeable": "^4.5.0",
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.0",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/hardhat-upgrades": "^1.21.0",
"ethers": "^5.7.1",
"hardhat": "^2.8.0",
"web3": "^1.7.0"
}