I have an ERC20 contract which is UUPS upgradeable, and I would like to add ERC20Votes.sol to this contract. Is it possible to add a new base class to a contract during upgrade, without messing up the contract's storage? Here is what my contract looks like now:
contract myToken is ERC20BurnableUpgradeable, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable {
struct TotalAllocation {
uint256 firstAllocation;
uint256 monthlyAllocation;
}
mapping(address => uint256) public totalSpent;
mapping(address => TotalAllocation) public allocations;
mapping(address => bool) public isWhitelisted;
uint256 whitelistAddEnd; //time when you can no longer update the whitelist
uint256 public deploymentTime;
address public veTokenMigrator;
// Reserved storage space to allow for layout changes in the future from upgrading.
uint256[50] __gap;
event AddToWhitelist(address[] accounts, TotalAllocation[] allocation);
event RemoveFromWhitelist(address[] accounts);
event VeTokenMigratorSet(address veTokenMigrator);
constructor(){}
I want to change my contract to also inherit ERC20Votes.sol
contract myToken is ERC20BurnableUpgradeable, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable, ERC20Votes {
... rest of code