Interchain Token Service Executable

You can use the Axelar Interchain Token Service (ITS) to create a new Interchain Token or integrate an existing ERC-20 token to ITS to give your token bridging functionality.

ITS also allows you to send GMP messages when making a cross-chain transfer for an ITS token.

If you are looking to have an ITS compatible token that can send GMP messages, the token must inherit from the InterchainExecutable contract.

Once the token has been deployed and integrated with ITS you can use the executable functionality to send messages along with your cross-chain token transfer.

Send Token + Message from Source Chain

Send a message alongside a token using the callContractWithInterchainToken() function from the Interchain Token Service. You should provide the tokenId, destinationChain, destinationAddress, amount, message, and gasValue as parameters.

/**
* @notice Initiates an interchain call contract with interchain token to a destination chain.
* @param tokenId The unique identifier of the token to be transferred.
* @param destinationChain The destination chain to send the tokens to.
* @param destinationAddress The address on the destination chain to send the tokens to.
* @param amount The amount of tokens to be transferred.
* @param data Additional data to be passed along with the transfer.
*/
function callContractWithInterchainToken(
bytes32 tokenId,
string calldata destinationChain,
bytes calldata destinationAddress,
uint256 amount,
bytes memory data,
uint256 gasValue
) external payable {}

🚨

The destinationAddress should be an address encoded as bytes. Use the toBytes() method to quickly accomplish this on-chain.

Execute on Destination Chain

The InterchainTokenExecutable contains an _executeWithInterchainToken() function that is triggered on the destination chain after the callContractWithInterchainToken() function is executed on the source chain. The purpose of this function is to validate the contract call and then invoke your _executeWithInterchainToken() method. You can write any custom logic inside this method.

/**
* @notice Internal function containing the logic to be executed with interchain token transfer.
* derived contracts must implement @dev Logic.
* @param commandId The unique message id.
* @param sourceChain The source chain of the token transfer.
* @param sourceAddress The source address of the token transfer.
* @param data The data associated with the token transfer.
* @param tokenId The token ID.
* @param token The token address.
* @param amount The amount of tokens being transferred.
*/
function _executeWithInterchainToken(
bytes32 commandId,
string calldata sourceChain,
bytes calldata sourceAddress,
bytes calldata data,
bytes32 tokenId,
address token,
uint256 amount
) internal virtual;

What’s next

To find more examples of how to utilize the Interchain Token Service and test the Interchain Token Service Executable, please refer to the axelar-examples repository on GitHub.

Edit on GitHub