diff --git a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts index b97383489a..29eb32e118 100644 --- a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts @@ -1,6 +1,6 @@ -import assert from 'assert/strict'; import assertBn from '@synthetixio/core-utils/src/utils/assertions/assert-bignumber'; import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; +import assert from 'assert/strict'; import { ethers } from 'ethers'; import { bn, bootstrapWithStakedPool } from '../../bootstrap'; diff --git a/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol b/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol index 0106e765e9..162525f576 100644 --- a/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol +++ b/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol @@ -126,7 +126,10 @@ contract AssociatedSystemsModule is IAssociatedSystemsModule { AssociatedSystem.Data storage store = AssociatedSystem.load(id); if (store.proxy != address(0)) { - _upgradeToken(id, impl); + if (store.impl != impl) { + _upgradeToken(id, impl); + } + ITokenModule(store.proxy).initialize(name, symbol, decimals); } else { // create a new proxy and own it address proxy = address(new UUPSProxyWithOwner(impl, address(this))); diff --git a/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts b/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts index a9a602250d..3b11491527 100644 --- a/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts +++ b/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts @@ -156,6 +156,23 @@ describe('AssociatedSystemsModule', function () { assert.equal(await TokenModule.isInitialized(), false); }); + it('upgrade token with new name and symbol', async () => { + await AssociatedSystemsModule.initOrUpgradeToken( + registeredName, + 'A Token 2', + 'TOK2', + 18, + TokenModule.address + ); + }); + + it('the token has been successfully reinitlized', async function () { + assert.equal(await TokenModuleAssociated.isInitialized(), true); + assert.equal(await TokenModuleAssociated.name(), 'A Token 2'); + assert.equal(await TokenModuleAssociated.symbol(), 'TOK2'); + assert.equal(await TokenModuleAssociated.decimals(), 18); + }); + describe('when attempting to register a different kind', function () { before('prepare modules', async function () { await AssociatedSystemsModule.initOrUpgradeNft(