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

feat(sui): update its to interchainTokenService #517

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

Foivos
Copy link
Contributor

@Foivos Foivos commented Jan 27, 2025

@Foivos Foivos requested a review from a team as a code owner January 27, 2025 16:24
@Foivos Foivos requested review from RiceAndMeet and npty January 27, 2025 16:24
@@ -136,8 +137,8 @@ async function postDeployExample(published, keypair, client, config, chain, opti
// GMP Example Params
const [gmpSingletonObjectId] = getObjectIdsByObjectTypes(published.publishTxn, [`${published.packageId}::gmp::Singleton`]);

// ITS Example Params
const itsObjectId = chain.contracts.ITS?.objects?.ITS;
Copy link
Member

Choose a reason for hiding this comment

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

Grep for all occurrences of .ITS. across the repo, there's a bunch of other references that need to be fixed

@@ -196,7 +196,7 @@ jobs:
echo "emptyTokenName=Empty" >> $GITHUB_ENV
echo "emptyTokenDecimals=6" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

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

set the hub chain and address as an env var to avoid duplication and for consistency

@@ -404,6 +423,8 @@ const GATEWAY_CMD_OPTIONS = [
new Option('--previousSigners <previousSigners>', 'number of previous signers to retain').default('15'),
];

const ITS_CMD_OPTIONS = [new Option('--itsHubAddress <itsHubAddress>', 'The address of the ITS HUB').env('ITS_HUB_ADDRESS')];
Copy link
Member

Choose a reason for hiding this comment

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

This should be read from the config config.axelar.contracts.InterchainTokenService.address instead of provided by the user, see how evm/its.js gets trusted addresses

sui/gateway.js Show resolved Hide resolved
sui/its-example.js Show resolved Hide resolved

const { OwnerCap, ITS } = itsConfig.objects;
const { OwnerCap, InterchainTokenService } = itsConfig.objects;

const txBuilder = new TxBuilder(client);

const trustedChains = parseTrustedChains(config, trustedChain);
Copy link
Member

Choose a reason for hiding this comment

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

This method is a bit weird. It has some specialized logic for all EVM chains, but doesn't really make sense. We have other non EVM chain ITS contracts as well that should be included

Copy link
Member

Choose a reason for hiding this comment

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

If all is provided, we should just include the full list of chain's axelarIds where chain.contracts?.InterchainTokenService.address is set. Makes the initial setup easy after deployment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

out of scope for this, maybe ask euro to make that change since he wrote this logic in the first place

await txBuilder.moveCall({
target: `${itsConfig.address}::its::set_trusted_addresses`,
arguments: [ITS, OwnerCap, trustedAddressesObject],
target: `${itsConfig.address}::interchain_token_service::add_trusted_chains`,
Copy link
Member

Choose a reason for hiding this comment

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

check if it's already a trusted chain and throw an error. Otherwise, the tx will fail on simulation and it won't be clear to the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, cannot, you specifically asked to remove all getters not used by our contracts in Sui.

sui/its.js Outdated Show resolved Hide resolved
sui/its.js Outdated Show resolved Hide resolved
sui/its.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants