UNPKG

@axelar-network/interchain-token-service

Version:

Interchain token service for EVM chains to faciliate interchain token transfers and contract calls

1,812 lines (1,205 loc) 162 kB
# Solidity API ## InterchainTokenFactory This contract is responsible for deploying new interchain tokens and managing their token managers. ### INTERCHAIN_TOKEN_FACTORY_SLOT ```solidity bytes32 INTERCHAIN_TOKEN_FACTORY_SLOT ``` _This slot contains the storage for this contract in an upgrade-compatible manner keccak256('InterchainTokenFactory.Slot') - 1;_ ### PREFIX_CANONICAL_TOKEN_SALT ```solidity bytes32 PREFIX_CANONICAL_TOKEN_SALT ``` ### PREFIX_INTERCHAIN_TOKEN_SALT ```solidity bytes32 PREFIX_INTERCHAIN_TOKEN_SALT ``` ### PREFIX_DEPLOY_APPROVAL ```solidity bytes32 PREFIX_DEPLOY_APPROVAL ``` ### interchainTokenService ```solidity contract IInterchainTokenService interchainTokenService ``` Returns the address of the interchain token service. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | ### chainNameHash ```solidity bytes32 chainNameHash ``` Returns the hash of the chain name. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | ### DeployApproval ```solidity struct DeployApproval { address minter; bytes32 tokenId; string destinationChain; } ``` ### InterchainTokenFactoryStorage _Storage for this contract_ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct InterchainTokenFactoryStorage { mapping(bytes32 => bytes32) approvedDestinationMinters; } ``` ### constructor ```solidity constructor(address interchainTokenService_) public ``` Constructs the InterchainTokenFactory contract. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | interchainTokenService_ | address | The address of the interchain token service. | ### _setup ```solidity function _setup(bytes data) internal ``` Internal function to set up the contract with initial data _This function should be implemented in derived contracts._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | data | bytes | Initialization data for the contract | ### contractId ```solidity function contractId() external pure returns (bytes32) ``` Getter for the contract id. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | bytes32 | bytes32 The contract id of this contract. | ### interchainTokenDeploySalt ```solidity function interchainTokenDeploySalt(address deployer, bytes32 salt) public view returns (bytes32 deploySalt) ``` Computes the deploy salt for an interchain token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deployer | address | The address of the deployer. | | salt | bytes32 | A unique identifier to generate the salt. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The deploy salt for the interchain token. | ### canonicalInterchainTokenDeploySalt ```solidity function canonicalInterchainTokenDeploySalt(address tokenAddress) public view returns (bytes32 deploySalt) ``` Computes the deploy salt for a canonical interchain token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The deploy salt for the interchain token. | ### interchainTokenId ```solidity function interchainTokenId(address deployer, bytes32 salt) public view returns (bytes32 tokenId) ``` Computes the ID for an interchain token based on the deployer and a salt. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deployer | address | The address that deployed the interchain token. | | salt | bytes32 | A unique identifier used in the deployment process. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The ID of the interchain token. | ### canonicalInterchainTokenId ```solidity function canonicalInterchainTokenId(address tokenAddress) public view returns (bytes32 tokenId) ``` Computes the ID for a canonical interchain token based on its address. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the canonical interchain token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The ID of the canonical interchain token. | ### _interchainTokenId ```solidity function _interchainTokenId(bytes32 deploySalt) internal view returns (bytes32 tokenId) ``` Computes the tokenId for an interchain token based on the deploySalt. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The salt used for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the interchain token. | ### deployInterchainToken ```solidity function deployInterchainToken(bytes32 salt, string name, string symbol, uint8 decimals, uint256 initialSupply, address minter) external payable returns (bytes32 tokenId) ``` Deploys a new interchain token with specified parameters. _Creates a new token and optionally mints an initial amount to a specified minter. This function is `payable` because non-payable functions cannot be called in a multicall that calls other `payable` functions._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | name | string | The name of the token. | | symbol | string | The symbol of the token. | | decimals | uint8 | The number of decimals for the token. | | initialSupply | uint256 | The amount of tokens to mint initially (can be zero), allocated to the msg.sender. | | minter | address | The address to receive the minter and operator role of the token, in addition to ITS. If it is set to `address(0)`, the additional minter isn't set, and can't be added later. This allows creating tokens that are managed only by ITS, reducing trust assumptions. Reverts if the minter is the ITS address since it's already added as a minter. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### approveDeployRemoteInterchainToken ```solidity function approveDeployRemoteInterchainToken(address deployer, bytes32 salt, string destinationChain, bytes destinationMinter) external ``` Allow the minter to approve the deployer for a remote interchain token deployment that uses a custom destinationMinter address. This ensures that a token deployer can't choose the destinationMinter itself, and requires the approval of the minter to reduce trust assumptions on the deployer. ### revokeDeployRemoteInterchainToken ```solidity function revokeDeployRemoteInterchainToken(address deployer, bytes32 salt, string destinationChain) external ``` Allows the minter to revoke a deployer's approval for a remote interchain token deployment that uses a custom destinationMinter address. ### _deployApprovalKey ```solidity function _deployApprovalKey(struct InterchainTokenFactory.DeployApproval approval) internal pure returns (bytes32 key) ``` ### _useDeployApproval ```solidity function _useDeployApproval(struct InterchainTokenFactory.DeployApproval approval, bytes destinationMinter) internal ``` ### deployRemoteInterchainToken ```solidity function deployRemoteInterchainToken(bytes32 salt, address minter, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to use as the minter of the deployed token on the destination chain. If the destination chain is not EVM, then use the more generic `deployRemoteInterchainToken` function below that allows setting an arbitrary destination minter that was approved by the current minter. | | destinationChain | string | The name of the destination chain. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### deployRemoteInterchainTokenWithMinter ```solidity function deployRemoteInterchainTokenWithMinter(bytes32 salt, address minter, string destinationChain, bytes destinationMinter, uint256 gasValue) public payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to receive the minter and operator role of the token, in addition to ITS. If the address is `address(0)`, no additional minter is set on the token. Reverts if the minter does not have mint permission for the token. | | destinationChain | string | The name of the destination chain. | | destinationMinter | bytes | The minter address to set on the deployed token on the destination chain. This can be arbitrary bytes since the encoding of the account is dependent on the destination chain. If this is empty, then the `minter` of the token on the current chain is used as the destination minter, which makes it convenient when deploying to other EVM chains. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### deployRemoteInterchainToken ```solidity function deployRemoteInterchainToken(string originalChainName, bytes32 salt, address minter, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. This method is deprecated and will be removed in the future. Please use the above method instead. _originalChainName is only allowed to be '', i.e the current chain. Other source chains are not supported anymore to simplify ITS token deployment behaviour._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalChainName | string | The name of the chain where the token originally exists. | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to receive the minter and operator role of the token, in addition to ITS. If the address is `address(0)`, no additional minter is set on the token. Reverts if the minter does not have mint permission for the token. | | destinationChain | string | The name of the destination chain. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### _deployInterchainToken ```solidity function _deployInterchainToken(bytes32 salt, string destinationChain, string tokenName, string tokenSymbol, uint8 tokenDecimals, bytes minter, uint256 gasValue) internal returns (bytes32 tokenId) ``` Deploys a new interchain token with specified parameters. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | destinationChain | string | The name of the destination chain. | | tokenName | string | The name of the token. | | tokenSymbol | string | The symbol of the token. | | tokenDecimals | uint8 | The number of decimals for the token. | | minter | bytes | The address to receive the initially minted tokens. | | gasValue | uint256 | The amount of gas to send for the transfer. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### _deployRemoteInterchainToken ```solidity function _deployRemoteInterchainToken(bytes32 deploySalt, string destinationChain, bytes minter, uint256 gasValue) internal returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The salt used for the deployment. | | destinationChain | string | The name of the destination chain. | | minter | bytes | The address to receive the minter and operator role of the token, in addition to ITS. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### registerCanonicalInterchainToken ```solidity function registerCanonicalInterchainToken(address tokenAddress) external payable returns (bytes32 tokenId) ``` Registers a canonical token as an interchain token and deploys its token manager. _This function is `payable` because non-payable functions cannot be called in a multicall that calls other `payable` functions._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the canonical token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the registered canonical token. | ### deployRemoteCanonicalInterchainToken ```solidity function deployRemoteCanonicalInterchainToken(address originalTokenAddress, string destinationChain, uint256 gasValue) public payable returns (bytes32 tokenId) ``` Deploys a canonical interchain token on a remote chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalTokenAddress | address | The address of the original token on the original chain. | | destinationChain | string | The name of the chain where the token will be deployed. | | gasValue | uint256 | The gas amount to be sent for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### deployRemoteCanonicalInterchainToken ```solidity function deployRemoteCanonicalInterchainToken(string originalChain, address originalTokenAddress, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a canonical interchain token on a remote chain. This method is deprecated and will be removed in the future. Please use the above method instead. _originalChain is only allowed to be '', i.e the current chain. Other source chains are not supported anymore to simplify ITS token deployment behaviour._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalChain | string | The name of the chain where the token originally exists. | | originalTokenAddress | address | The address of the original token on the original chain. | | destinationChain | string | The name of the chain where the token will be deployed. | | gasValue | uint256 | The gas amount to be sent for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ## IAddressTracker This interface allows setting and removing a trusted address for a specific chain. _Extends the IInterchainAddressTracker interface._ ### setTrustedAddress ```solidity function setTrustedAddress(string chain, string address_) external ``` Sets the trusted address for the specified chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | chain | string | Chain name to be trusted. | | address_ | string | Trusted address to be added for the chain. | ### removeTrustedAddress ```solidity function removeTrustedAddress(string chain) external ``` Remove the trusted address of the chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | chain | string | Chain name to remove the trusted address for. | ## IBaseTokenManager This contract is defines the base token manager interface implemented by all token managers. ### interchainTokenId ```solidity function interchainTokenId() external view returns (bytes32) ``` A function that returns the token id. ### tokenAddress ```solidity function tokenAddress() external view returns (address) ``` A function that should return the address of the token. Must be overridden in the inheriting contract. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | address | address address of the token. | ### getTokenAddressFromParams ```solidity function getTokenAddressFromParams(bytes params) external pure returns (address) ``` A function that should return the token address from the init params. ## IERC20MintableBurnable _Interface of the ERC20 standard as defined in the EIP._ ### mint ```solidity function mint(address to, uint256 amount) external ``` Function to mint new tokens. _Can only be called by the minter address._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | to | address | The address that will receive the minted tokens. | | amount | uint256 | The amount of tokens to mint. | ### burn ```solidity function burn(address from, uint256 amount) external ``` Function to burn tokens. _Can only be called by the minter address._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | from | address | The address that will have its tokens burnt. | | amount | uint256 | The amount of tokens to burn. | ## IERC20Named _Interface of the ERC20 standard as defined in the EIP._ ### name ```solidity function name() external view returns (string) ``` Getter for the name of the token. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | string | string Name of the token. | ### symbol ```solidity function symbol() external view returns (string) ``` Getter for the symbol of the token. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | string | string The symbol of the token. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Getter for the decimals of the token. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | uint8 | uint8 The decimals of the token. | ## IFlowLimit Interface for flow limit logic for interchain token transfers. ### FlowLimitExceeded ```solidity error FlowLimitExceeded(uint256 limit, uint256 flowAmount, address tokenManager) ``` ### FlowAdditionOverflow ```solidity error FlowAdditionOverflow(uint256 flowAmount, uint256 flowToAdd, address tokenManager) ``` ### FlowLimitOverflow ```solidity error FlowLimitOverflow(uint256 flowLimit, uint256 flowToCompare, address tokenManager) ``` ### FlowLimitSet ```solidity event FlowLimitSet(bytes32 tokenId, address operator, uint256 flowLimit_) ``` ### flowLimit ```solidity function flowLimit() external view returns (uint256 flowLimit_) ``` Returns the current flow limit. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowLimit_ | uint256 | The current flow limit value. | ### flowOutAmount ```solidity function flowOutAmount() external view returns (uint256 flowOutAmount_) ``` Returns the current flow out amount. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowOutAmount_ | uint256 | The current flow out amount. | ### flowInAmount ```solidity function flowInAmount() external view returns (uint256 flowInAmount_) ``` Returns the current flow in amount. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowInAmount_ | uint256 | The current flow in amount. | ## IInterchainToken _Extends IInterchainTokenStandard and IMinter._ ### InterchainTokenServiceAddressZero ```solidity error InterchainTokenServiceAddressZero() ``` ### TokenIdZero ```solidity error TokenIdZero() ``` ### TokenNameEmpty ```solidity error TokenNameEmpty() ``` ### TokenSymbolEmpty ```solidity error TokenSymbolEmpty() ``` ### AlreadyInitialized ```solidity error AlreadyInitialized() ``` ### interchainTokenService ```solidity function interchainTokenService() external view returns (address interchainTokenServiceAddress) ``` Getter for the interchain token service contract. _Needs to be overwitten._ #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | interchainTokenServiceAddress | address | The interchain token service address. | ### interchainTokenId ```solidity function interchainTokenId() external view returns (bytes32 tokenId_) ``` Getter for the tokenId used for this token. _Needs to be overwitten._ #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId_ | bytes32 | The tokenId for this token. | ### init ```solidity function init(bytes32 tokenId_, address minter, string tokenName, string tokenSymbol, uint8 tokenDecimals) external ``` Setup function to initialize contract parameters. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId_ | bytes32 | The tokenId of the token. | | minter | address | The address of the token minter. | | tokenName | string | The name of the token. | | tokenSymbol | string | The symbopl of the token. | | tokenDecimals | uint8 | The decimals of the token. | ## IInterchainTokenFactory This interface defines functions for deploying new interchain tokens and managing their token managers. ### ZeroAddress ```solidity error ZeroAddress() ``` ### InvalidChainName ```solidity error InvalidChainName() ``` ### InvalidMinter ```solidity error InvalidMinter(address minter) ``` ### NotMinter ```solidity error NotMinter(address minter) ``` ### NotOperator ```solidity error NotOperator(address operator) ``` ### NotServiceOwner ```solidity error NotServiceOwner(address sender) ``` ### NotSupported ```solidity error NotSupported() ``` ### RemoteDeploymentNotApproved ```solidity error RemoteDeploymentNotApproved() ``` ### InvalidTokenId ```solidity error InvalidTokenId(bytes32 tokenId, bytes32 expectedTokenId) ``` ### DeployRemoteInterchainTokenApproval ```solidity event DeployRemoteInterchainTokenApproval(address minter, address deployer, bytes32 tokenId, string destinationChain, bytes destinationMinter) ``` Emitted when a minter approves a deployer for a remote interchain token deployment that uses a custom destinationMinter address. ### RevokedDeployRemoteInterchainTokenApproval ```solidity event RevokedDeployRemoteInterchainTokenApproval(address minter, address deployer, bytes32 tokenId, string destinationChain) ``` Emitted when a minter revokes a deployer's approval for a remote interchain token deployment that uses a custom destinationMinter address. ### interchainTokenService ```solidity function interchainTokenService() external view returns (contract IInterchainTokenService) ``` Returns the address of the interchain token service. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | contract IInterchainTokenService | IInterchainTokenService The address of the interchain token service. | ### chainNameHash ```solidity function chainNameHash() external view returns (bytes32) ``` Returns the hash of the chain name. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | bytes32 | bytes32 The hash of the chain name. | ### interchainTokenDeploySalt ```solidity function interchainTokenDeploySalt(address deployer, bytes32 salt) external view returns (bytes32 deploySalt) ``` Computes the deploy salt for an interchain token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deployer | address | The address of the deployer. | | salt | bytes32 | A unique identifier to generate the salt. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The deploy salt for the interchain token. | ### interchainTokenId ```solidity function interchainTokenId(address deployer, bytes32 salt) external view returns (bytes32 tokenId) ``` Computes the ID for an interchain token based on the deployer and a salt. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | deployer | address | The address that deployed the interchain token. | | salt | bytes32 | A unique identifier used in the deployment process. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The ID of the interchain token. | ### deployInterchainToken ```solidity function deployInterchainToken(bytes32 salt, string name, string symbol, uint8 decimals, uint256 initialSupply, address minter) external payable returns (bytes32 tokenId) ``` Deploys a new interchain token with specified parameters. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | name | string | The name of the token. | | symbol | string | The symbol of the token. | | decimals | uint8 | The number of decimals for the token. | | initialSupply | uint256 | The amount of tokens to mint initially (can be zero), allocated to the msg.sender. | | minter | address | The address to receive the initially minted tokens. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### approveDeployRemoteInterchainToken ```solidity function approveDeployRemoteInterchainToken(address deployer, bytes32 salt, string destinationChain, bytes destinationMinter) external ``` Allows the minter to approve a deployer for a remote interchain token deployment that uses a custom destinationMinter address. This ensures that a token deployer can't choose the destinationMinter itself, and requires the approval of the minter to reduce trust assumptions on the deployer. ### revokeDeployRemoteInterchainToken ```solidity function revokeDeployRemoteInterchainToken(address deployer, bytes32 salt, string destinationChain) external ``` Allows the minter to revoke a deployer's approval for a remote interchain token deployment that uses a custom destinationMinter address. ### deployRemoteInterchainToken ```solidity function deployRemoteInterchainToken(bytes32 salt, address minter, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to use as the minter of the deployed token on the destination chain. If the destination chain is not EVM, then use the more generic `deployRemoteInterchainToken` function below that allows setting an arbitrary destination minter that was approved by the current minter. | | destinationChain | string | The name of the destination chain. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### deployRemoteInterchainTokenWithMinter ```solidity function deployRemoteInterchainTokenWithMinter(bytes32 salt, address minter, string destinationChain, bytes destinationMinter, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to distribute the token on the destination chain. | | destinationChain | string | The name of the destination chain. | | destinationMinter | bytes | The minter address to set on the deployed token on the destination chain. This can be arbitrary bytes since the encoding of the account is dependent on the destination chain. If this is empty, then the `minter` of the token on the current chain is used as the destination minter, which makes it convenient when deploying to other EVM chains. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### deployRemoteInterchainToken ```solidity function deployRemoteInterchainToken(string originalChainName, bytes32 salt, address minter, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a remote interchain token on a specified destination chain. _originalChainName is only allowed to be '', i.e the current chain. Other source chains are not supported anymore to simplify ITS token deployment behaviour._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalChainName | string | The name of the chain where the token originally exists. | | salt | bytes32 | The unique salt for deploying the token. | | minter | address | The address to distribute the token on the destination chain. | | destinationChain | string | The name of the destination chain. | | gasValue | uint256 | The amount of gas to send for the deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### canonicalInterchainTokenDeploySalt ```solidity function canonicalInterchainTokenDeploySalt(address tokenAddress) external view returns (bytes32 deploySalt) ``` Computes the deploy salt for a canonical interchain token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | deploySalt | bytes32 | The deploy salt for the interchain token. | ### canonicalInterchainTokenId ```solidity function canonicalInterchainTokenId(address tokenAddress) external view returns (bytes32 tokenId) ``` Computes the ID for a canonical interchain token based on its address. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the canonical interchain token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The ID of the canonical interchain token. | ### registerCanonicalInterchainToken ```solidity function registerCanonicalInterchainToken(address tokenAddress) external payable returns (bytes32 tokenId) ``` Registers a canonical token as an interchain token and deploys its token manager. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the canonical token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the registered canonical token. | ### deployRemoteCanonicalInterchainToken ```solidity function deployRemoteCanonicalInterchainToken(address originalTokenAddress, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a canonical interchain token on a remote chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalTokenAddress | address | The address of the original token on the original chain. | | destinationChain | string | The name of the chain where the token will be deployed. | | gasValue | uint256 | The gas amount to be sent for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed canonical InterchainToken. | ### deployRemoteCanonicalInterchainToken ```solidity function deployRemoteCanonicalInterchainToken(string originalChain, address originalTokenAddress, string destinationChain, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a canonical interchain token on a remote chain. This method is deprecated and will be removed in the future. Please use the above method instead. _originalChain is only allowed to be '', i.e the current chain. Other source chains are not supported anymore to simplify ITS token deployment behaviour._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | originalChain | string | The name of the chain where the token originally exists. | | originalTokenAddress | address | The address of the original token on the original chain. | | destinationChain | string | The name of the chain where the token will be deployed. | | gasValue | uint256 | The gas amount to be sent for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ## IInterchainTokenService Interface for the Interchain Token Service ### InvalidTokenManagerImplementationType ```solidity error InvalidTokenManagerImplementationType(address implementation) ``` ### InvalidChainName ```solidity error InvalidChainName() ``` ### NotRemoteService ```solidity error NotRemoteService() ``` ### TokenManagerDoesNotExist ```solidity error TokenManagerDoesNotExist(bytes32 tokenId) ``` ### ExecuteWithInterchainTokenFailed ```solidity error ExecuteWithInterchainTokenFailed(address contractAddress) ``` ### ExpressExecuteWithInterchainTokenFailed ```solidity error ExpressExecuteWithInterchainTokenFailed(address contractAddress) ``` ### TokenManagerDeploymentFailed ```solidity error TokenManagerDeploymentFailed(bytes error) ``` ### InterchainTokenDeploymentFailed ```solidity error InterchainTokenDeploymentFailed(bytes error) ``` ### InvalidMessageType ```solidity error InvalidMessageType(uint256 messageType) ``` ### InvalidMetadataVersion ```solidity error InvalidMetadataVersion(uint32 version) ``` ### InvalidExpressMessageType ```solidity error InvalidExpressMessageType(uint256 messageType) ``` ### TakeTokenFailed ```solidity error TakeTokenFailed(bytes data) ``` ### GiveTokenFailed ```solidity error GiveTokenFailed(bytes data) ``` ### TokenHandlerFailed ```solidity error TokenHandlerFailed(bytes data) ``` ### EmptyData ```solidity error EmptyData() ``` ### PostDeployFailed ```solidity error PostDeployFailed(bytes data) ``` ### ZeroAmount ```solidity error ZeroAmount() ``` ### CannotDeploy ```solidity error CannotDeploy(enum ITokenManagerType.TokenManagerType) ``` ### CannotDeployRemotelyToSelf ```solidity error CannotDeployRemotelyToSelf() ``` ### InvalidPayload ```solidity error InvalidPayload() ``` ### GatewayCallFailed ```solidity error GatewayCallFailed(bytes data) ``` ### EmptyTokenName ```solidity error EmptyTokenName() ``` ### EmptyTokenSymbol ```solidity error EmptyTokenSymbol() ``` ### EmptyParams ```solidity error EmptyParams() ``` ### EmptyDestinationAddress ```solidity error EmptyDestinationAddress() ``` ### NotSupported ```solidity error NotSupported() ``` ### InterchainTransfer ```solidity event InterchainTransfer(bytes32 tokenId, address sourceAddress, string destinationChain, bytes destinationAddress, uint256 amount, bytes32 dataHash) ``` ### InterchainTransferReceived ```solidity event InterchainTransferReceived(bytes32 commandId, bytes32 tokenId, string sourceChain, bytes sourceAddress, address destinationAddress, uint256 amount, bytes32 dataHash) ``` ### TokenManagerDeploymentStarted ```solidity event TokenManagerDeploymentStarted(bytes32 tokenId, string destinationChain, enum ITokenManagerType.TokenManagerType tokenManagerType, bytes params) ``` ### InterchainTokenDeploymentStarted ```solidity event InterchainTokenDeploymentStarted(bytes32 tokenId, string tokenName, string tokenSymbol, uint8 tokenDecimals, bytes minter, string destinationChain) ``` ### TokenManagerDeployed ```solidity event TokenManagerDeployed(bytes32 tokenId, address tokenManager, enum ITokenManagerType.TokenManagerType tokenManagerType, bytes params) ``` ### InterchainTokenDeployed ```solidity event InterchainTokenDeployed(bytes32 tokenId, address tokenAddress, address minter, string name, string symbol, uint8 decimals) ``` ### InterchainTokenIdClaimed ```solidity event InterchainTokenIdClaimed(bytes32 tokenId, address deployer, bytes32 salt) ``` ### tokenManagerDeployer ```solidity function tokenManagerDeployer() external view returns (address tokenManagerDeployerAddress) ``` Returns the address of the token manager deployer contract. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenManagerDeployerAddress | address | The address of the token manager deployer contract. | ### interchainTokenDeployer ```solidity function interchainTokenDeployer() external view returns (address interchainTokenDeployerAddress) ``` Returns the address of the interchain token deployer contract. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | interchainTokenDeployerAddress | address | The address of the interchain token deployer contract. | ### tokenManager ```solidity function tokenManager() external view returns (address tokenManagerAddress_) ``` Returns the address of TokenManager implementation. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenManagerAddress_ | address | The address of the token manager contract. | ### tokenHandler ```solidity function tokenHandler() external view returns (address tokenHandlerAddress) ``` Returns the address of TokenHandler implementation. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenHandlerAddress | address | The address of the token handler contract. | ### interchainTokenFactory ```solidity function interchainTokenFactory() external view returns (address) ``` Returns the address of the interchain token factory. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | address | address The address of the interchain token factory. | ### chainNameHash ```solidity function chainNameHash() external view returns (bytes32) ``` Returns the hash of the chain name. #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | [0] | bytes32 | bytes32 The hash of the chain name. | ### tokenManagerAddress ```solidity function tokenManagerAddress(bytes32 tokenId) external view returns (address tokenManagerAddress_) ``` Returns the address of the token manager associated with the given tokenId. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the token manager. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenManagerAddress_ | address | The address of the token manager. | ### deployedTokenManager ```solidity function deployedTokenManager(bytes32 tokenId) external view returns (contract ITokenManager tokenManager_) ``` Returns the instance of ITokenManager from a specific tokenId. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the deployed token manager. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenManager_ | contract ITokenManager | The instance of ITokenManager associated with the specified tokenId. | ### registeredTokenAddress ```solidity function registeredTokenAddress(bytes32 tokenId) external view returns (address tokenAddress) ``` Returns the address of the token that an existing tokenManager points to. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the registered token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the token. | ### interchainTokenAddress ```solidity function interchainTokenAddress(bytes32 tokenId) external view returns (address tokenAddress) ``` Returns the address of the interchain token associated with the given tokenId. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the interchain token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenAddress | address | The address of the interchain token. | ### interchainTokenId ```solidity function interchainTokenId(address operator_, bytes32 salt) external view returns (bytes32 tokenId) ``` Returns the custom tokenId associated with the given operator and salt. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | operator_ | address | The operator address. | | salt | bytes32 | The salt used for token id calculation. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The custom tokenId associated with the operator and salt. | ### deployTokenManager ```solidity function deployTokenManager(bytes32 salt, string destinationChain, enum ITokenManagerType.TokenManagerType tokenManagerType, bytes params, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys a custom token manager contract on a remote chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The salt used for token manager deployment. | | destinationChain | string | The name of the destination chain. | | tokenManagerType | enum ITokenManagerType.TokenManagerType | The type of token manager. Cannot be NATIVE_INTERCHAIN_TOKEN. | | params | bytes | The deployment parameters. | | gasValue | uint256 | The gas value for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId associated with the token manager. | ### deployInterchainToken ```solidity function deployInterchainToken(bytes32 salt, string destinationChain, string name, string symbol, uint8 decimals, bytes minter, uint256 gasValue) external payable returns (bytes32 tokenId) ``` Deploys and registers an interchain token on a remote chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | salt | bytes32 | The salt used for token deployment. | | destinationChain | string | The name of the destination chain. Use '' for this chain. | | name | string | The name of the interchain tokens. | | symbol | string | The symbol of the interchain tokens. | | decimals | uint8 | The number of decimals for the interchain tokens. | | minter | bytes | The minter data for mint/burn operations. | | gasValue | uint256 | The gas value for deployment. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId corresponding to the deployed InterchainToken. | ### interchainTransfer ```solidity function interchainTransfer(bytes32 tokenId, string destinationChain, bytes destinationAddress, uint256 amount, bytes metadata, uint256 gasValue) external payable ``` Initiates an interchain transfer of a specified token to a destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The unique identifier of the token to be transferred. | | destinationChain | string | The destination chain to send the tokens to. | | destinationAddress | bytes | The address on the destination chain to send the tokens to. | | amount | uint256 | The amount of tokens to be transferred. | | metadata | bytes | Optional metadata for the call for additional effects (such as calling a destination contract). | | gasValue | uint256 | | ### callContractWithInterchainToken ```solidity function callContractWithInterchainToken(bytes32 tokenId, string destinationChain, bytes destinationAddress, uint256 amount, bytes data, uint256 gasValue) external payable ``` Initiates an interchain call contract with interchain token to a destination chain. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The unique identifier of the token to be transferred. | | destinationChain | string | The destination chain to send the tokens to. | | destinationAddress | bytes | The address on the destination chain to send the tokens to. | | amount | uint256 | The amount of tokens to be transferred. | | data | bytes | Additional data to be passed along with the transfer. | | gasValue | uint256 | | ### setFlowLimits ```solidity function setFlowLimits(bytes32[] tokenIds, uint256[] flowLimits) external ``` Sets the flow limits for multiple tokens. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenIds | bytes32[] | An array of tokenIds. | | flowLimits | uint256[] | An array of flow limits corresponding to the tokenIds. | ### flowLimit ```solidity function flowLimit(bytes32 tokenId) external view returns (uint256 flowLimit_) ``` Returns the flow limit for a specific token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowLimit_ | uint256 | The flow limit for the token. | ### flowOutAmount ```solidity function flowOutAmount(bytes32 tokenId) external view returns (uint256 flowOutAmount_) ``` Returns the total amount of outgoing flow for a specific token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowOutAmount_ | uint256 | The total amount of outgoing flow for the token. | ### flowInAmount ```solidity function flowInAmount(bytes32 tokenId) external view returns (uint256 flowInAmount_) ``` Returns the total amount of incoming flow for a specific token. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | tokenId | bytes32 | The tokenId of the token. | #### Return Values | Name | Type | Description | | ---- | ---- | ----------- | | flowInAmount_ | uint256 | The total amount of incoming flow for the token. | ### setPauseStatus ```solidity function setPauseStatus(bool paused) external ``` Allows the owner to pause/unpause the token service. #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | paused | bool | whether to pause or unpause. | ## IInterchainTokenStandard _Interface of the ERC20 standard as defined in the EIP._ ### interchainTransfer ```solidity function interchainTransfer(string destinationChain, bytes recipient, uint256 amount, bytes metadata) external payable ``` Implementation of the interchainTransfer method. _We chose to either pass `metadata` as raw data on a remote contract call, or if no data is passed, just do a transfer. A different implementation could use metadata to specify a function to invoke, or for other purposes as well._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | destinationChain | string | The destination chain identifier. | | recipient | bytes | The bytes representation of the address of the recipient. | | amount | uint256 | The amount of token to be transferred. | | metadata | bytes | Optional metadata for the call for additional effects (such as calling a destination contract). | ### interchainTransferFrom ```solidity function interchainTransferFrom(address sender, string destinationChain, bytes recipient, uint256 amount, bytes metadata) external payable ``` Implementation of the interchainTransferFrom method _We chose to either pass `metadata` as raw data on a remote contract call, or, if no data is passed, just do a transfer. A different implementation could use metadata to specify a function to invoke, or for other purposes as well._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | sender | address | The sender of the tokens. They need to have approved `msg.sender` before this is called. | | destinationChain | string | The string representation of the destination chain. | | recipient | bytes | The bytes representation of the address of the recipient. | | amount | uint256 | The amount of token to be transferred. | | metadata | bytes | Optional metadata for the call for additional effects (such as calling a destination contract.) | ## IMinter An interface for a contract module which provides a basic access control mechanism, where there is an account (a minter) that can be granted exclusive access to specific functions. ### transferMintership ```solidity function transferMintership(address minter_) external ``` Change the minter of the contract. _Can only be called by the current minter._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | minter_ | address | The address of the new minter. | ### proposeMintership ```solidity function proposeMintership(address minter_) external ``` Proposed a change of the minter of the contract. _Can only be called by the current minter._ #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | | minter_ | address | The address of the new minter. | ### acceptMintership ```solidity function acceptMintership(address fromMinter) external ``` Accept a change of the minter of