Interchain Token Service Executable

You can use the Quantum Portal Interchain Token Service (ITS) to create a new Interchain Token or upgrade existing ERC-20 tokens to an Interchain Token. ITS also allows you to send messages along with Interchain Tokens across different blockchain networks.

The Interchain Token Service is deployed to 0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C while the Interchain Token Factory is deployed to 0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66.

Deploy a new Interchain Token

To deploy a new Interchain Token on Chain A, use the deployInterchainToken() method in the Interchain Token Factory contract.

/**
 * @notice Deploys a new interchain token with specified parameters.
 * @dev Creates a new token and optionally mints an initial amount to a specified minter.
 * @param salt The unique salt for deploying the token.
 * @param name The name of the token.
 * @param symbol The symbol of the token.
 * @param decimals The number of decimals for the token.
 * @param initialSupply The amount of tokens to mint initially (can be zero).
 * @param minter The address to receive the initially minted tokens.
 * @return tokenId The tokenId corresponding to the deployed InterchainToken.
 */
function deployInterchainToken(
    bytes32 salt,
    string calldata name,
    string calldata symbol,
    uint8 decimals,
    uint256 initialSupply,
    address minter
) external payable returns (bytes32 tokenId) {}

Remotely deploy an Interchain Token

Deploy an Interchain Token remotely from chain A to chain B using the deployRemoteInterchainToken() function in the Interchain Token Factory contract.

/**
 * @notice Deploys a remote interchain token on a specified destination chain.
 * @param originalChainName The name of the chain where the token originally exists.
 * @param salt The unique salt for deploying the token.
 * @param minter The address to distribute the token on the destination chain.
 * @param destinationChain The name of the destination chain.
 * @param gasValue The amount of gas to send for the deployment.
 * @return tokenId The tokenId corresponding to the deployed InterchainToken.
 */
function deployRemoteInterchainToken(
    string calldata originalChainName,
    bytes32 salt,
    address minter,
    string memory destinationChain,
    uint256 gasValue
) external payable returns (bytes32 tokenId) {}

Send a message with a token

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 with Interchain Token

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 QP-examples repository on GitHub.

Edit this page