Hello,
I am refactoring a contract to make it UUPS upgradeable, when I try to pass the argument of an inherited contract's constructor, I get this error:
TypeError: Explicit type conversion not allowed from "literal_string "AW 2"" to "contract ERC721Permit".
Refactored code:
function initialize(address _template, address _whitelist) initializer public {
__ERC721_init_unchained("AW 2", "AW-V2");
ERC721Permit("AW 2");
__AccessControl_init_unchained();
__UUPSUpgradeable_init_unchained();
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
Use _init rather than _init_unchained for all of the contracts that you inherit. The _init functions will include linearized calls to their parent initializers.
For ERC721Permit, you should also use an initializer rather than a constructor (otherwise, your proxy storage may not be properly initialized when you deploy it). All of the rules for upgradeable contracts would apply.
Try changing the order of your inherited contracts in the contract MyContract is ... section of your logic contract. You can also remove some dependencies from your ERC721Permit if they are not needed, e.g. you probably don't need UUPSUpgradeable in both of ERC721Permit and your logic contract.