Skip to content

Commit

Permalink
chore: added InterchainTokenIdClaimed event (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy authored Sep 26, 2024
1 parent 874287f commit b680103
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ contract InterchainTokenService is

tokenId = interchainTokenId(deployer, salt);

emit InterchainTokenIdClaimed(tokenId, deployer, salt);

if (bytes(destinationChain).length == 0) {
address tokenAddress = _deployInterchainToken(tokenId, minter, name, symbol, decimals);

Expand Down
8 changes: 8 additions & 0 deletions test/InterchainTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ describe('Interchain Token Service', () => {
'Call deployInterchainToken on source chain',
),
)
.to.emit(service, 'InterchainTokenIdClaimed')
.withArgs(tokenId, wallet.address, salt)
.to.emit(service, 'InterchainTokenDeployed')
.withArgs(tokenId, tokenAddress, wallet.address, tokenName, tokenSymbol, tokenDecimals)
.to.emit(service, 'TokenManagerDeployed')
Expand Down Expand Up @@ -697,6 +699,8 @@ describe('Interchain Token Service', () => {
'Send deployInterchainToken to remote chain',
),
)
.to.emit(service, 'InterchainTokenIdClaimed')
.withArgs(tokenId, wallet.address, salt)
.to.emit(service, 'InterchainTokenDeploymentStarted')
.withArgs(tokenId, tokenName, tokenSymbol, tokenDecimals, minter, destinationChain)
.and.to.emit(gasService, 'NativeGasPaidForContractCall')
Expand Down Expand Up @@ -846,6 +850,8 @@ describe('Interchain Token Service', () => {
const params = defaultAbiCoder.encode(['bytes', 'address'], [wallet.address, token.address]);

await expect(reportGas(service.deployTokenManager(salt, '', LOCK_UNLOCK, params, 0), 'Call deployTokenManager on source chain'))
.to.emit(service, 'InterchainTokenIdClaimed')
.withArgs(tokenId, wallet.address, salt)
.to.emit(service, 'TokenManagerDeployed')
.withArgs(tokenId, tokenManagerAddress, LOCK_UNLOCK, params);

Expand Down Expand Up @@ -1085,6 +1091,8 @@ describe('Interchain Token Service', () => {
'Send deployTokenManager to remote chain',
),
)
.to.emit(service, 'InterchainTokenIdClaimed')
.withArgs(tokenId, wallet.address, salt)
.to.emit(service, 'TokenManagerDeploymentStarted')
.withArgs(tokenId, destinationChain, type, params)
.and.to.emit(gasService, 'NativeGasPaidForContractCall')
Expand Down

0 comments on commit b680103

Please sign in to comment.