Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/axelarnetwork/axelar-contract-deployments#readme",
"dependencies": {
"@axelar-network/axelar-cgp-solidity": "6.4.0",
"@axelar-network/axelar-cgp-sui": "1.1.3",
"@axelar-network/axelar-cgp-sui": "0.0.0-snapshot.a8990a0",
Comment thread
drewstaylor marked this conversation as resolved.
Outdated
"@axelar-network/axelar-gmp-sdk-solidity": "6.0.4",
"@axelar-network/interchain-token-service": "2.2.0",
"@axelar-network/interchain-token-service-v2.1.1": "npm:@axelar-network/interchain-token-service@2.1.1",
Expand Down
24 changes: 22 additions & 2 deletions sui/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,37 @@ const CONTRACT_INFO = {
singletonName: 'InterchainTokenService',
moduleName: 'interchain_token_service',
defaultFunctions: {
versions: [0, 0, 0, 0, 0, 0, 0, 0, 0],
versions: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
functionNames: [
'register_coin',
'register_coin_from_info',
'register_coin_from_metadata',
'register_custom_coin',
'link_coin',
'register_coin_metadata',
'deploy_remote_interchain_token',
'send_interchain_transfer',
'receive_interchain_transfer',
'receive_interchain_transfer_with_data',
'receive_deploy_interchain_token',
'receive_link_coin',
'give_unregistered_coin',
'give_unlinked_coin',
'remove_unlinked_coin',
'mint_as_distributor',
'mint_to_as_distributor',
'burn_as_distributor',
'add_trusted_chains',
'remove_trusted_chains',
'register_transaction',
'set_flow_limit',
'set_flow_limit_as_token_operator',
'transfer_distributorship',
'transfer_operatorship',
'remove_treasury_cap',
'restore_treasury_cap',
'allow_function',
'disallow_function',
'migrate_coin_metadata',
Comment thread
cursor[bot] marked this conversation as resolved.
],
},
},
Expand Down
5 changes: 5 additions & 0 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,18 @@ async function migrate(keypair, client, supportedPackage, config, chain, options
}
case 'InterchainTokenService': {
const InterchainTokenService = contractConfig.objects.InterchainTokenService;
const RelayerDiscovery = chain.contracts.RelayerDiscovery.objects.RelayerDiscovery;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Optional Chaining Needed for RelayerDiscovery

The code directly accesses chain.contracts.RelayerDiscovery.objects.RelayerDiscovery without optional chaining. This can cause a runtime error if the RelayerDiscovery contract isn't deployed or configured, which is inconsistent with how similar nested properties are handled elsewhere.

Fix in Cursor Fix in Web


if (typeof InterchainTokenService !== 'string') throw new Error(`Cannot find object of specified contract: ${packageName}`);

await builder.moveCall({
target: `${contractConfig.address}::interchain_token_service::migrate`,
arguments: [InterchainTokenService, ownerCap],
});
await builder.moveCall({
target: `${contractConfig.address}::discovery::register_transaction`,
arguments: [InterchainTokenService, RelayerDiscovery],
});
Comment on lines +475 to +478

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Should verify RelayerDiscovery exists before using it to prevent runtime errors

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Redundant Transaction Registration Causes Gas Waste

A duplicate moveCall to discovery::register_transaction with identical arguments (InterchainTokenService, RelayerDiscovery) is executed. This wastes gas and may cause transaction failures or unexpected behavior if the registration is not idempotent.

Fix in Cursor Fix in Web


break;
}
Expand Down
Loading