Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jan 9, 2025
1 parent 70a0796 commit b2b367b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions test/InterchainTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3245,12 +3245,14 @@ describe('Interchain Token Service', () => {
const tokenId = await service.interchainTokenId(wallet.address, salt);
const tokenManagerAddress = await service.tokenManagerAddress(tokenId);

await interchainTokenDeployer.deployInterchainToken(salt, tokenId, service.address, name, symbol, decimals).then((tx) => tx.wait);
await interchainTokenDeployer
.deployInterchainToken(salt, tokenId, service.address, name, symbol, decimals)
.then((tx) => tx.wait);
const tokenAddress = await interchainTokenDeployer.deployedAddress(salt);
const token = await getContractAt('InterchainToken', tokenAddress, wallet);

const params = defaultAbiCoder.encode(['bytes', 'address'], [wallet.address, tokenAddress]);

await service.deployTokenManager(salt, '', MINT_BURN, params, 0).then((tx) => tx.wait);

await expect(service.migrateInterchainToken(tokenId))
Expand All @@ -3268,12 +3270,14 @@ describe('Interchain Token Service', () => {
const tokenId = await service.interchainTokenId(wallet.address, salt);
const tokenManagerAddress = await service.tokenManagerAddress(tokenId);

await interchainTokenDeployer.deployInterchainToken(salt, tokenId, service.address, name, symbol, decimals).then((tx) => tx.wait);
await interchainTokenDeployer
.deployInterchainToken(salt, tokenId, service.address, name, symbol, decimals)
.then((tx) => tx.wait);
const tokenAddress = await interchainTokenDeployer.deployedAddress(salt);
const token = await getContractAt('InterchainToken', tokenAddress, wallet);

const params = defaultAbiCoder.encode(['bytes', 'address'], [wallet.address, tokenAddress]);

await service.deployTokenManager(salt, '', MINT_BURN, params, 0).then((tx) => tx.wait);

await expect(service.migrateInterchainToken(tokenId))
Expand All @@ -3282,7 +3286,10 @@ describe('Interchain Token Service', () => {
.to.emit(token, 'RolesAdded')
.withArgs(tokenManagerAddress, 1 << MINTER_ROLE);

await expectRevert((gasOptions) => service.migrateInterchainToken(tokenId, { gasOptions} ), token, 'MissingRole', [service.address, MINTER_ROLE]);
await expectRevert((gasOptions) => service.migrateInterchainToken(tokenId, { gasOptions }), token, 'MissingRole', [
service.address,
MINTER_ROLE,
]);
});

it('Should not be able to migrate a token deployed after this upgrade', async () => {
Expand All @@ -3291,16 +3298,17 @@ describe('Interchain Token Service', () => {
const symbol = 'MT';
const decimals = 53;
const tokenId = await service.interchainTokenId(wallet.address, salt);
const tokenManagerAddress = await service.tokenManagerAddress(tokenId);


await service.deployInterchainToken(salt, '', name, symbol, decimals, AddressZero, 0).then((tx) => tx.wait);
const tokenAddress = await service.interchainTokenAddress(tokenId);
const token = await getContractAt('InterchainToken', tokenAddress, wallet);

await expectRevert((gasOptions) => service.migrateInterchainToken(tokenId, { gasOptions} ), token, 'MissingRole', [service.address, MINTER_ROLE]);
await expectRevert((gasOptions) => service.migrateInterchainToken(tokenId, { gasOptions }), token, 'MissingRole', [
service.address,
MINTER_ROLE,
]);
});
})
});

describe('Bytecode checks [ @skip-on-coverage ]', () => {
it('Should preserve the same proxy bytecode for each EVM', async () => {
Expand Down

0 comments on commit b2b367b

Please sign in to comment.