Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Nov 3, 2023
1 parent 4b8dad9 commit 650cc31
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
4 changes: 2 additions & 2 deletions contracts/token-registrars/TokenRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ contract TokenRegistrar is ITokenRegistrar, ITokenManagerType, Multicall, Upgrad
uint256 amount,
uint256 gasValue
) external payable {
if(bytes(destinationChain).length == 0) {
if (bytes(destinationChain).length == 0) {
address tokenAddress = service.interchainTokenAddress(tokenId);
IStandardizedToken token = IStandardizedToken(tokenAddress);
token.safeTransfer(destinationAddress.toAddress(), amount);
} else {
service.interchainTransfer{value: gasValue}(tokenId, destinationChain, destinationAddress, amount, gasValue);
service.interchainTransfer{ value: gasValue }(tokenId, destinationChain, destinationAddress, amount, gasValue);
}
}
}
44 changes: 34 additions & 10 deletions test/TokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,15 @@ describe('Interchain Token Service', () => {
});

it('Should initialize a remote standardized token deployment', async () => {
await (await service.deployTokenManager(salt, '', LOCK_UNLOCK, defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]), 0)).wait();
await (
await service.deployTokenManager(
salt,
'',
LOCK_UNLOCK,
defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]),
0,
)
).wait();

const tokenId = await service.tokenId(wallet.address, salt);
const payload = defaultAbiCoder.encode(
Expand Down Expand Up @@ -826,8 +834,16 @@ describe('Interchain Token Service', () => {

it('Should initialize a remote custom token manager deployment', async () => {
const salt = getRandomBytes32();

await (await service.deployTokenManager(salt, '', LOCK_UNLOCK, defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]), 0)).wait();

await (
await service.deployTokenManager(
salt,
'',
LOCK_UNLOCK,
defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]),
0,
)
).wait();

const tokenId = await service.tokenId(wallet.address, salt);
const gasValue = 1e6;
Expand All @@ -854,8 +870,9 @@ describe('Interchain Token Service', () => {
const params = '0x1234';
const type = LOCK_UNLOCK;

await expect(service.deployTokenManager(salt, destinationChain, type, params, gasValue, { value: gasValue }))
.to.be.revertedWithCustomError(service, 'TokenManagerDoesNotExist', [tokenId])
await expect(
service.deployTokenManager(salt, destinationChain, type, params, gasValue, { value: gasValue }),
).to.be.revertedWithCustomError(service, 'TokenManagerDoesNotExist', [tokenId]);
});

it('Should revert on remote custom token manager deployment if paused', async () => {
Expand Down Expand Up @@ -892,7 +909,15 @@ describe('Interchain Token Service', () => {
it('Should initialize a remote custom token manager deployment', async () => {
const salt = getRandomBytes32();

await (await service.deployTokenManager(salt, '', LOCK_UNLOCK, defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]), 0)).wait();
await (
await service.deployTokenManager(
salt,
'',
LOCK_UNLOCK,
defaultAbiCoder.encode(['bytes', 'address'], ['0x', wallet.address]),
0,
)
).wait();

const tokenId = await service.tokenId(wallet.address, salt);
const gasValue = 1e6;
Expand All @@ -919,8 +944,9 @@ describe('Interchain Token Service', () => {
const params = '0x1234';
const type = LOCK_UNLOCK;

await expect(service.deployTokenManager(salt, destinationChain, type, params, gasValue, { value: gasValue }))
.to.be.revertedWithCustomError(service, 'TokenManagerDoesNotExist', [tokenId]);
await expect(
service.deployTokenManager(salt, destinationChain, type, params, gasValue, { value: gasValue }),
).to.be.revertedWithCustomError(service, 'TokenManagerDoesNotExist', [tokenId]);
});

it('Should revert on remote custom token manager deployment if paused', async () => {
Expand All @@ -944,8 +970,6 @@ describe('Interchain Token Service', () => {
tx = await service.setPaused(false);
await tx.wait();
});


});

describe('Receive Remote Token Manager Deployment', () => {
Expand Down

0 comments on commit 650cc31

Please sign in to comment.