I couldn't find anywhere the meaning of the use of the _disableInitializers();
for the upgradeability
aspect of an ERC-20
token creation...
what does it mean ?
Also, why does the OpenZeppelin
Documentation says to do the following instead ? :
I am confused on what is meant to be done to get the upgradability working
Environment
wizard
OpenZeppelin Interfac
1 Like
Hi @migbash,
_disableInitializers()
was added in Contracts v4.6.0 as part of the reinitializers support. The Caution note in Initializer
provides more details on why this is needed.
By putting it in the constructor, this prevents initialization of the implementation contract itself, as extra protection to prevent an attacker from initializing it.
Thank you for mentioning the difference with the upgrades documentation. The contructor() initializer {}
usage was recommended for previous version of Contracts. I've opened an issue to update the upgrades documentation to refer to _disableInitializers()
.
2 Likes