This document will guide you through testing the ITS (Interchain Token Service) flow on Sui. The process includes setting up the environment, sending tokens between chains, and deploying tokens.
Deploy the contracts with the following commands:
node sui/faucet
node sui/deploy-contract deploy Utils
node sui/deploy-contract deploy VersionControl
node sui/deploy-contract deploy AxelarGateway --signers wallet
node sui/deploy-contract deploy GasService
node sui/deploy-contract deploy Abi
node sui/deploy-contract deploy RelayerDiscovery
node sui/deploy-contract deploy ITS
node sui/deploy-contract deploy Example
To simplify the process of obtaining necessary parameters, run the following script:
sourceChain=Ethereum
transferMessageId=0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-01
deployMessageId=0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-02
sourceAddress=0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5
fee=0.1
amount=1
symbol=IMD
decimals=9
name=interchain-moo-deng
emptyTokenSymbol=ETY
emptyTokenName=Empty
emptyTokenDecimals=6
env=$(grep ENV= .env | cut -d '=' -f2 | tr -d '\n')
config=$(cat "axelar-chains-config/info/${env}.json")
channelId=$(echo $config | jq -r '.sui.contracts.ITS.objects.ChannelId')
destinationContractAddress=$(echo $config | jq -r '.sui.contracts.Example.objects.ItsChannelId')
node sui/its-example deploy-token --origin $symbol $name $decimals
node sui/its-example deploy-token $emptyTokenSymbol $emptyTokenName $emptyTokenDecimals
This command modifies the token template in the interchain_token.move
file with the given name, symbol, and decimals. It then deploys the modified token contract and stores the Metadata, TreasuryCap, and TokenId in the config. Finally, it registers the coin on the ITS contract.
After the token deployment, continue to run the following scripts to prepare additional parameters for the example:
transferInfo=$(node sui/its-example.js print-receive-transfer $symbol $sourceAddress $amount)
transferPayload=$(echo $transferInfo | jq -r .payload)
transferPayloadHash=$(echo $transferInfo | jq -r .payloadHash)
deploymentInfo=$(node sui/its-example.js print-receive-deployment $emptyTokenName $emptyTokenSymbol $emptyTokenDecimals)
deployPayload=$(echo $deploymentInfo | jq -r .payload)
deployPayloadHash=$(echo $deploymentInfo | jq -r .payloadHash)
The trusted address is used to verify the message both incoming and outgoing directions.
node sui/its.js setup-trusted-address $sourceChain $sourceAddress
node sui/its-example send-token $symbol $sourceChain $sourceAddress $fee $amount
- Approve the gateway to execute the transfer:
node sui/gateway.js approve --proof wallet $sourceChain $transferMessageId $sourceAddress $channelId $transferPayloadHash
- Receive the token:
node sui/its-example receive-token $sourceChain $transferMessageId $sourceAddress $symbol $transferPayload
node sui/its-example send-deployment $symbol $sourceChain $fee
In this example, we'll use the empty token to receive the deployment because the token must have zero supply.
- Approve the gateway to execute the deployment:
node sui/gateway.js approve --proof wallet $sourceChain $deployMessageId $sourceAddress $channelId $deployPayloadHash
- Receive the token deployment:
node sui/its-example receive-deployment $sourceChain $deployMessageId $sourceAddress $emptyTokenSymbol $deployPayload