Hi I'm trying to make a ordinary contract upgradable. In the examples usualy there is an ERC20 token. I have a slightly more complex setup and am wondering should I call all initializers from all parent contracts and if so when should I use unchained versions. This is my first time working with the Upgradable library so forgive me if this is a too simple question.
Contract KarmaCertificateV1 is
ERC721Upgradeable,
ERC721EnumerableUpgradeable,
PausableUpgradeable,
AccessControlUpgradeable,
ERC721BurnableUpgradeable
{
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
function initialize() initializer public {
__ERC721_init("Karma Certificate", "KMC");
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(PAUSER_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
}
function pause() public {
require(hasRole(PAUSER_ROLE, msg.sender));
_pause();
}
function unpause() public {
require(hasRole(PAUSER_ROLE, msg.sender));
_unpause();
}
function safeMint(address to, uint256 tokenId) public {
require(hasRole(MINTER_ROLE, msg.sender));
_safeMint(to, tokenId);
}
function _baseURI() internal pure override returns (string memory) {
return "https://karmacertificate.com/kmc/";
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable) whenNotPaused {
super._beforeTokenTransfer(from, to, tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, ERC721EnumerableUpgradeable, AccessControlUpgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}
Environment
I'm using the truffle utilities an they are publishing without error to ganache.