Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sip-323 #1729

Merged
merged 10 commits into from
Aug 16, 2023
Merged
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading