I am trying to upgrade an NFT contract. The original one (https://github.com/ndujaLabs/everdragons2-core/blob/main/contracts/Everdragons2Genesis.sol#L28) has the variables:
bool private _mintEnded; bool private _baseTokenURIFrozen; string private _baseTokenURI; address public manager;
bool private _mintEnded; bool private _baseTokenURIFrozen; string private _baseTokenURI; address public manager; mapping(address => bool) public pools; mapping(uint256 => address) public staked;
staked are added after
manager, the storage should be compatible.
In fact, all tests pass.
But, trying to upgrade the contract on Mumbai, I get an error:
$ bin/deploy.sh upgradeE2Mumbai mumbai Deploying contracts with the account: 0x34923658675B99B2DB634cB2BC0cA8d25EdEC743 to mumbai Account balance: 7585303523419268809 Error: New storage layout is incompatible Everdragons2Genesis: Deleted `manager` > Keep the variable even if unused contracts/mocks/Everdragons2GenesisV2Mumbai.sol:30: Inserted `manager` > New variables should be placed after all existing inherited variables
This error does not make sense.
In fact, it suggest to keep the variable
manager (which has not been deleted) and later says that
manager has been inserted.