Upgrading token togic
To upgrade/change the underlying token logic contract a token proxy is using, simply run the upgradeTo(address logic, bytes memory data)
function in the token proxy.
The address
provided will be the new logic contract that will be used, and the data
provided will be passed to the logic contract’s _onInitialize
function.
const upgradeInitData = "0x";
const newLogic = "0x9FE61B546b4bBCdf28fAe9588d18aD7233fFa4b9";
await token.upgradeTo(newLogic, upgradeInitData)
Upgrading extensions¶
Upgrading extensions is also possible.
Extension upgrades keep the storage of the extension while changing the logic code. To upgrade an extension, simply run the upgradeExtension(address extension, address newExtension) external
function.
The extension
address must be the address of the extension you want to upgrade, and the newExtension
address must be the address you want to replace it with.
The replacement extension address must have the following same values as the original extension:
- The
deployer()
must be the same on both extensions. - The
version()
must be different. - The
packageHash()
must be the same. - The new extension must support the current token standard.
If all these requirements are met, then the extension can be upgraded to the provided newExtension
address.