ERC1155SupplyUpgradeable not calling parent init

Hi all,

The ERC1155SupplyUpgradeable is not calling __ERC1155_init(string memory uri_) from its own __ERC1155Supply_init(). If I understood the use of init and init_unchained correctly, I'd say this is a bug, isn't it?

Thanks!

In general, please report bugs in the GitHub repositories.

In this case, however, this is not a bug. If you look at the vanilla version of ERC1155Supply it is not invoking the constructor of its parent ERC1155. In particular, it wouldn't know what uri parameter to use! The contract that inherits ERC1155Supply and ERC1155 will need to call the constructor and pass in the parameters. You can see how this is similar in both vanilla and upgradeable contracts in the Contracts Wizard.

1 Like

Hi frangio,

I appreciate the quick response. I see. Can you confirm that this pattern (not calling the parent's constructor) is only possible when using abstract contracts?

Thanks!

Yes it is only possible with abstract contracts.

1 Like