// Source: contracts/interfaces/IInterchainTokenFactory.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol@v6.0.4 /** * @title IAxelarGateway * @dev Interface for the Axelar Gateway that supports general message passing and contract call execution. */ interface IAxelarGateway { /** * @notice Emitted when a contract call is made through the gateway. * @dev Logs the attempt to call a contract on another chain. * @param sender The address of the sender who initiated the contract call. * @param destinationChain The name of the destination chain. * @param destinationContractAddress The address of the contract on the destination chain. * @param payloadHash The keccak256 hash of the sent payload data. * @param payload The payload data used for the contract call. */ event ContractCall( address indexed sender, string destinationChain, string destinationContractAddress, bytes32 indexed payloadHash, bytes payload ); /** * @notice Sends a contract call to another chain. * @dev Initiates a cross-chain contract call through the gateway to the specified destination chain and contract. * @param destinationChain The name of the destination chain. * @param contractAddress The address of the contract on the destination chain. * @param payload The payload data to be used in the contract call. */ function callContract(string calldata destinationChain, string calldata contractAddress, bytes calldata payload) external; /** * @notice Checks if a contract call is approved. * @dev Determines whether a given contract call, identified by the commandId and payloadHash, is approved. * @param commandId The identifier of the command to check. * @param sourceChain The name of the source chain. * @param sourceAddress The address of the sender on the source chain. * @param contractAddress The address of the contract where the call will be executed. * @param payloadHash The keccak256 hash of the payload data. * @return True if the contract call is approved, false otherwise. */ function isContractCallApproved( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, address contractAddress, bytes32 payloadHash ) external view returns (bool); /** * @notice Validates and approves a contract call. * @dev Validates the given contract call information and marks it as approved if valid. * @param commandId The identifier of the command to validate. * @param sourceChain The name of the source chain. * @param sourceAddress The address of the sender on the source chain. * @param payloadHash The keccak256 hash of the payload data. * @return True if the contract call is validated and approved, false otherwise. */ function validateContractCall( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes32 payloadHash ) external returns (bool); /** * @notice Checks if a command has been executed. * @dev Determines whether a command, identified by the commandId, has been executed. * @param commandId The identifier of the command to check. * @return True if the command has been executed, false otherwise. */ function isCommandExecuted(bytes32 commandId) external view returns (bool); } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarExecutable.sol@v6.0.4 /** * @title IAxelarExecutable * @dev Interface for a contract that is executable by Axelar Gateway's cross-chain message passing. * It defines a standard interface to execute commands sent from another chain. */ interface IAxelarExecutable { /** * @dev Thrown when a function is called with an invalid address. */ error InvalidAddress(); /** * @dev Thrown when the call is not approved by the Axelar Gateway. */ error NotApprovedByGateway(); /** * @notice Returns the address of the AxelarGateway contract. * @return The Axelar Gateway contract associated with this executable contract. */ function gateway() external view returns (IAxelarGateway); /** * @notice Executes the specified command sent from another chain. * @dev This function is called by the Axelar Gateway to carry out cross-chain commands. * Reverts if the call is not approved by the gateway or other checks fail. * @param commandId The identifier of the command to execute. * @param sourceChain The name of the source chain from where the command originated. * @param sourceAddress The address on the source chain that sent the command. * @param payload The payload of the command to be executed. This typically includes the function selector and encoded arguments. */ function execute(bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes calldata payload) external; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarExpressExecutable.sol@v6.0.4 /** * @title IAxelarExpressExecutable * @notice Interface for the Axelar Express Executable contract. */ interface IAxelarExpressExecutable is IAxelarExecutable { // Custom errors error AlreadyExecuted(); error InsufficientValue(); /** * @notice Emitted when an express execution is successfully performed. * @param commandId The unique identifier for the command. * @param sourceChain The source chain. * @param sourceAddress The source address. * @param payloadHash The hash of the payload. * @param expressExecutor The address of the express executor. */ event ExpressExecuted( bytes32 indexed commandId, string sourceChain, string sourceAddress, bytes32 payloadHash, address indexed expressExecutor ); /** * @notice Emitted when an express execution is fulfilled. * @param commandId The commandId for the contractCall. * @param sourceChain The source chain. * @param sourceAddress The source address. * @param payloadHash The hash of the payload. * @param expressExecutor The address of the express executor. */ event ExpressExecutionFulfilled( bytes32 indexed commandId, string sourceChain, string sourceAddress, bytes32 payloadHash, address indexed expressExecutor ); /** * @notice Returns the express executor for a given command. * @param commandId The commandId for the contractCall. * @param sourceChain The source chain. * @param sourceAddress The source address. * @param payloadHash The hash of the payload. * @return expressExecutor The address of the express executor. */ function getExpressExecutor( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes32 payloadHash ) external view returns (address expressExecutor); /** * @notice Express executes a contract call. * @param commandId The commandId for the contractCall. * @param sourceChain The source chain. * @param sourceAddress The source address. * @param payload The payload data. */ function expressExecute( bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes calldata payload ) external payable; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarValuedExpressExecutable.sol@v6.0.4 /** * @title IAxelarValuedExpressExecutable * @dev Interface for the Axelar Valued Express Executable contract. */ interface IAxelarValuedExpressExecutable is IAxelarExpressExecutable { /** * @dev Returns the value (token address and amount) associated with a contract call * @param sourceChain The source chain. * @param sourceAddress The source address. * @param payload The payload data. * @return tokenAddress The address of the token used. * @return value The value associated with the contract call. */ function contractCallValue( string calldata sourceChain, string calldata sourceAddress, bytes calldata payload ) external view returns (address tokenAddress, uint256 value); } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IContractIdentifier.sol@v6.0.4 // General interface for upgradable contracts interface IContractIdentifier { /** * @notice Returns the contract ID. It can be used as a check during upgrades. * @dev Meant to be overridden in derived contracts. * @return bytes32 The contract ID */ function contractId() external pure returns (bytes32); } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol@v6.0.4 interface IImplementation is IContractIdentifier { error NotProxy(); function setup(bytes calldata data) external; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IOwnable.sol@v6.0.4 /** * @title IOwnable Interface * @notice IOwnable is an interface that abstracts the implementation of a * contract with ownership control features. It's commonly used in upgradable * contracts and includes the functionality to get current owner, transfer * ownership, and propose and accept ownership. */ interface IOwnable { error NotOwner(); error InvalidOwner(); error InvalidOwnerAddress(); event OwnershipTransferStarted(address indexed newOwner); event OwnershipTransferred(address indexed newOwner); /** * @notice Returns the current owner of the contract. * @return address The address of the current owner */ function owner() external view returns (address); /** * @notice Returns the address of the pending owner of the contract. * @return address The address of the pending owner */ function pendingOwner() external view returns (address); /** * @notice Transfers ownership of the contract to a new address * @param newOwner The address to transfer ownership to */ function transferOwnership(address newOwner) external; /** * @notice Proposes to transfer the contract's ownership to a new address. * The new owner needs to accept the ownership explicitly. * @param newOwner The address to transfer ownership to */ function proposeOwnership(address newOwner) external; /** * @notice Transfers ownership to the pending owner. * @dev Can only be called by the pending owner */ function acceptOwnership() external; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IUpgradable.sol@v6.0.4 // General interface for upgradable contracts interface IUpgradable is IOwnable, IImplementation { error InvalidCodeHash(); error InvalidImplementation(); error SetupFailed(); event Upgraded(address indexed newImplementation); function implementation() external view returns (address); function upgrade(address newImplementation, bytes32 newImplementationCodeHash, bytes calldata params) external; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IInterchainAddressTracker.sol@v6.0.4 /** * @title IInterchainAddressTracker * @dev Manages trusted addresses by chain, keeps track of addresses supported by the Axelar gateway contract */ interface IInterchainAddressTracker { error ZeroAddress(); error LengthMismatch(); error ZeroStringLength(); error UntrustedChain(); event TrustedAddressSet(string chain, string address_); event TrustedAddressRemoved(string chain); /** * @dev Gets the name of the chain this is deployed at */ function chainName() external view returns (string memory); /** * @dev Gets the trusted address at a remote chain * @param chain Chain name of the remote chain * @return trustedAddress_ The trusted address for the chain. Returns '' if the chain is untrusted */ function trustedAddress(string memory chain) external view returns (string memory trustedAddress_); /** * @dev Gets the trusted address hash for a chain * @param chain Chain name * @return trustedAddressHash_ the hash of the trusted address for that chain */ function trustedAddressHash(string memory chain) external view returns (bytes32 trustedAddressHash_); /** * @dev Checks whether the interchain sender is a trusted address * @param chain Chain name of the sender * @param address_ Address of the sender * @return bool true if the sender chain/address are trusted, false otherwise */ function isTrustedAddress(string calldata chain, string calldata address_) external view returns (bool); } // File contracts/interfaces/IAddressTracker.sol /** * @title IAddressTracker Interface * @notice This interface allows setting and removing a trusted address for a specific chain. * @dev Extends the IInterchainAddressTracker interface. */ interface IAddressTracker is IInterchainAddressTracker { /** * @notice Sets the trusted address for the specified chain. * @param chain Chain name to be trusted. * @param address_ Trusted address to be added for the chain. */ function setTrustedAddress(string memory chain, string memory address_) external; /** * @notice Remove the trusted address of the chain. * @param chain Chain name to remove the trusted address for. */ function removeTrustedAddress(string calldata chain) external; } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IMulticall.sol@v6.0.4 /** * @title IMulticall * @notice This contract is a multi-functional smart contract which allows for multiple * contract calls in a single transaction. */ interface IMulticall { error MulticallFailed(); /** * @notice Performs multiple delegate calls and returns the results of all calls as an array * @dev This function requires that the contract has sufficient balance for the delegate calls. * If any of the calls fail, the function will revert with the failure message. * @param data An array of encoded function calls * @return results An bytes array with the return data of each function call */ function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IPausable.sol@v6.0.4 /** * @title Pausable * @notice This contract provides a mechanism to halt the execution of specific functions * if a pause condition is activated. */ interface IPausable { event Paused(address indexed account); event Unpaused(address indexed account); error Pause(); error NotPaused(); /** * @notice Check if the contract is paused * @return paused A boolean representing the pause status. True if paused, false otherwise. */ function paused() external view returns (bool); } // File @axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IRolesBase.sol@v6.0.4 /** * @title IRolesBase Interface * @notice IRolesBase is an interface that abstracts the implementation of a * contract with role control internal functions. */ interface IRolesBase { error MissingRole(address account, uint8 role); error MissingAllRoles(address account, uint256 accountRoles); error MissingAnyOfRoles(address account, uint256 accountRoles); error InvalidProposedRoles(address fromAccount, address toAccount, uint256 accountRoles); event RolesProposed(address indexed fromAccount, address indexed toAccount, uint256 accountRoles); event RolesAdded(address indexed account, uint256 accountRoles); event RolesRemoved(address indexed account, uint256 accountRoles); /** * @notice Checks if an account has a role. * @param account The address to check * @param role The role to check * @return True if the account has the role, false otherwise */ function hasRole(address account, uint8 role) external view returns (bool); } // File contracts/interfaces/IOperator.sol /** * @title IOperator Interface * @notice An interface for a contract module which provides a basic access control mechanism, where * there is an account (a operator) that can be granted exclusive access to specific functions. */ interface IOperator is IRolesBase { /** * @notice Change the operator of the contract. * @dev Can only be called by the current operator. * @param operator_ The address of the new operator. */ function transferOperatorship(address operator_) external; /** * @notice Proposed a change of the operator of the contract. * @dev Can only be called by the current operator. * @param operator_ The address of the new operator. */ function proposeOperatorship(address operator_) external; /** * @notice Accept a proposed change of operatorship. * @dev Can only be called by the proposed operator. * @param fromOperator The previous operator of the contract. */ function acceptOperatorship(address fromOperator) external; /** * @notice Query if an address is a operator. * @param addr The address to query for. * @return bool Boolean value representing whether or not the address is an operator. */ function isOperator(address addr) external view returns (bool); } // File contracts/interfaces/IBaseTokenManager.sol /** * @title IBaseTokenManager * @notice This contract is defines the base token manager interface implemented by all token managers. */ interface IBaseTokenManager { /** * @notice A function that returns the token id. */ function interchainTokenId() external view returns (bytes32); /** * @notice A function that should return the address of the token. * Must be overridden in the inheriting contract. * @return address address of the token. */ function tokenAddress() external view returns (address); /** * @notice A function that should return the token address from the init params. */ function getTokenAddressFromParams(bytes calldata params) external pure returns (address); } // File contracts/interfaces/IFlowLimit.sol /** * @title FlowLimit Interface * @notice Interface for flow limit logic for interchain token transfers. */ interface IFlowLimit { error FlowLimitExceeded(uint256 limit, uint256 flowAmount, address tokenManager); error FlowAdditionOverflow(uint256 flowAmount, uint256 flowToAdd, address tokenManager); error FlowLimitOverflow(uint256 flowLimit, uint256 flowToCompare, address tokenManager); event FlowLimitSet(bytes32 indexed tokenId, address operator, uint256 flowLimit_); /** * @notice Returns the current flow limit. * @return flowLimit_ The current flow limit value. */ function flowLimit() external view returns (uint256 flowLimit_); /** * @notice Returns the current flow out amount. * @return flowOutAmount_ The current flow out amount. */ function flowOutAmount() external view returns (uint256 flowOutAmount_); /** * @notice Returns the current flow in amount. * @return flowInAmount_ The current flow in amount. */ function flowInAmount() external view returns (uint256 flowInAmount_); } // File contracts/interfaces/ITokenManager.sol /** * @title ITokenManager Interface * @notice This contract is responsible for managing tokens, such as setting locking token balances, or setting flow limits, for interchain transfers. */ interface ITokenManager is IBaseTokenManager, IOperator, IFlowLimit, IImplementation { error TokenLinkerZeroAddress(); error NotService(address caller); error TakeTokenFailed(); error GiveTokenFailed(); error NotToken(address caller); error ZeroAddress(); error AlreadyFlowLimiter(address flowLimiter); error NotFlowLimiter(address flowLimiter); error NotSupported(); /** * @notice Returns implementation type of this token manager. * @return uint256 The implementation type of this token manager. */ function implementationType() external view returns (uint256); function addFlowIn(uint256 amount) external; function addFlowOut(uint256 amount) external; /** * @notice This function adds a flow limiter for this TokenManager. * @dev Can only be called by the operator. * @param flowLimiter the address of the new flow limiter. */ function addFlowLimiter(address flowLimiter) external; /** * @notice This function removes a flow limiter for this TokenManager. * @dev Can only be called by the operator. * @param flowLimiter the address of an existing flow limiter. */ function removeFlowLimiter(address flowLimiter) external; /** * @notice Query if an address is a flow limiter. * @param addr The address to query for. * @return bool Boolean value representing whether or not the address is a flow limiter. */ function isFlowLimiter(address addr) external view returns (bool); /** * @notice This function sets the flow limit for this TokenManager. * @dev Can only be called by the flow limiters. * @param flowLimit_ The maximum difference between the tokens flowing in and/or out at any given interval of time (6h). */ function setFlowLimit(uint256 flowLimit_) external; /** * @notice A function to renew approval to the service if we need to. */ function approveService() external; /** * @notice Getter function for the parameters of a lock/unlock TokenManager. * @dev This function will be mainly used by frontends. * @param operator_ The operator of the TokenManager. * @param tokenAddress_ The token to be managed. * @return params_ The resulting params to be passed to custom TokenManager deployments. */ function params(bytes calldata operator_, address tokenAddress_) external pure returns (bytes memory params_); /** * @notice External function to allow the service to mint tokens through the tokenManager * @dev This function should revert if called by anyone but the service. * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager. * @param to The recipient. * @param amount The amount to mint. */ function mintToken(address tokenAddress_, address to, uint256 amount) external; /** * @notice External function to allow the service to burn tokens through the tokenManager * @dev This function should revert if called by anyone but the service. * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager. * @param from The address to burn the token from. * @param amount The amount to burn. */ function burnToken(address tokenAddress_, address from, uint256 amount) external; } // File contracts/interfaces/ITokenManagerImplementation.sol /** * @title ITokenManagerImplementation Interface * @notice Interface for returning the token manager implementation type. */ interface ITokenManagerImplementation { /** * @notice Returns the implementation address for a given token manager type. * @param tokenManagerType The type of token manager. * @return tokenManagerAddress_ The address of the token manager implementation. */ function tokenManagerImplementation(uint256 tokenManagerType) external view returns (address tokenManagerAddress_); } // File contracts/interfaces/ITokenManagerType.sol /** * @title ITokenManagerType Interface * @notice A simple interface that defines all the token manager types. */ interface ITokenManagerType { enum TokenManagerType { NATIVE_INTERCHAIN_TOKEN, // This type is reserved for interchain tokens deployed by ITS, and can't be used by custom token managers. MINT_BURN_FROM, // The token will be minted/burned on transfers. The token needs to give mint permission to the token manager, but burning happens via an approval. LOCK_UNLOCK, // The token will be locked/unlocked at the token manager. LOCK_UNLOCK_FEE, // The token will be locked/unlocked at the token manager, which will account for any fee-on-transfer behaviour. MINT_BURN // The token will be minted/burned on transfers. The token needs to give mint and burn permission to the token manager. } } // File contracts/interfaces/ITransmitInterchainToken.sol /** * @title ITransmitInterchainToken Interface * @notice Interface for transmiting interchain tokens via the interchain token service */ interface ITransmitInterchainToken { /** * @notice Transmit an interchain transfer for the given tokenId. * @dev Only callable by a token registered under a tokenId. * @param tokenId The tokenId of the token (which must be the msg.sender). * @param sourceAddress The address where the token is coming from. * @param destinationChain The name of the chain to send tokens to. * @param destinationAddress The destinationAddress for the interchainTransfer. * @param amount The amount of token to give. * @param metadata Optional metadata for the call for additional effects (such as calling a destination contract). */ function transmitInterchainTransfer( bytes32 tokenId, address sourceAddress, string calldata destinationChain, bytes memory destinationAddress, uint256 amount, bytes calldata metadata ) external payable; } // File contracts/interfaces/IInterchainTokenService.sol /** * @title IInterchainTokenService Interface * @notice Interface for the Interchain Token Service */ interface IInterchainTokenService is ITransmitInterchainToken, ITokenManagerType, ITokenManagerImplementation, IAxelarValuedExpressExecutable, IOperator, IPausable, IMulticall, IAddressTracker, IUpgradable { error InvalidChainName(); error NotRemoteService(); error TokenManagerDoesNotExist(bytes32 tokenId); error ExecuteWithInterchainTokenFailed(address contractAddress); error ExpressExecuteWithInterchainTokenFailed(address contractAddress); error TokenManagerDeploymentFailed(bytes error); error InterchainTokenDeploymentFailed(bytes error); error InvalidMessageType(uint256 messageType); error InvalidMetadataVersion(uint32 version); error InvalidExpressMessageType(uint256 messageType); error TakeTokenFailed(bytes data); error GiveTokenFailed(bytes data); error TokenHandlerFailed(bytes data); error EmptyData(); error PostDeployFailed(bytes data); error ZeroAmount(); error CannotDeploy(TokenManagerType); error CannotDeployRemotelyToSelf(); error InvalidPayload(); error GatewayCallFailed(bytes data); error EmptyTokenName(); error EmptyTokenSymbol(); error EmptyParams(); error EmptyDestinationAddress(); error EmptyTokenAddress(); error NotSupported(); error NotInterchainTokenFactory(address sender); event InterchainTransfer( bytes32 indexed tokenId, address indexed sourceAddress, string destinationChain, bytes destinationAddress, uint256 amount, bytes32 indexed dataHash ); event InterchainTransferReceived( bytes32 indexed commandId, bytes32 indexed tokenId, string sourceChain, bytes sourceAddress, address indexed destinationAddress, uint256 amount, bytes32 dataHash ); event TokenMetadataRegistered(address indexed tokenAddress, uint8 decimals); event LinkTokenStarted( bytes32 indexed tokenId, string destinationChain, bytes sourceTokenAddress, bytes destinationTokenAddress, TokenManagerType indexed tokenManagerType, bytes params ); event InterchainTokenDeploymentStarted( bytes32 indexed tokenId, string tokenName, string tokenSymbol, uint8 tokenDecimals, bytes minter, string destinationChain ); event TokenManagerDeployed(bytes32 indexed tokenId, address tokenManager, TokenManagerType indexed tokenManagerType, bytes params); event InterchainTokenDeployed( bytes32 indexed tokenId, address tokenAddress, address indexed minter, string name, string symbol, uint8 decimals ); event InterchainTokenIdClaimed(bytes32 indexed tokenId, address indexed deployer, bytes32 indexed salt); /** * @notice Returns the address of the token manager deployer contract. * @return tokenManagerDeployerAddress The address of the token manager deployer contract. */ function tokenManagerDeployer() external view returns (address tokenManagerDeployerAddress); /** * @notice Returns the address of the interchain token deployer contract. * @return interchainTokenDeployerAddress The address of the interchain token deployer contract. */ function interchainTokenDeployer() external view returns (address interchainTokenDeployerAddress); /** * @notice Returns the address of TokenManager implementation. * @return tokenManagerAddress_ The address of the token manager contract. */ function tokenManager() external view returns (address tokenManagerAddress_); /** * @notice Returns the address of TokenHandler implementation. * @return tokenHandlerAddress The address of the token handler contract. */ function tokenHandler() external view returns (address tokenHandlerAddress); /** * @notice Returns the address of the interchain token factory. * @return address The address of the interchain token factory. */ function interchainTokenFactory() external view returns (address); /** * @notice Returns the hash of the chain name. * @return bytes32 The hash of the chain name. */ function chainNameHash() external view returns (bytes32); /** * @notice Returns the address of the token manager associated with the given tokenId. * @param tokenId The tokenId of the token manager. * @return tokenManagerAddress_ The address of the token manager. */ function tokenManagerAddress(bytes32 tokenId) external view returns (address tokenManagerAddress_); /** * @notice Returns the instance of ITokenManager from a specific tokenId. * @param tokenId The tokenId of the deployed token manager. * @return tokenManager_ The instance of ITokenManager associated with the specified tokenId. */ function deployedTokenManager(bytes32 tokenId) external view returns (ITokenManager tokenManager_); /** * @notice Returns the address of the token that an existing tokenManager points to. * @param tokenId The tokenId of the registered token. * @return tokenAddress The address of the token. */ function registeredTokenAddress(bytes32 tokenId) external view returns (address tokenAddress); /** * @notice Returns the address of the interchain token associated with the given tokenId. * @param tokenId The tokenId of the interchain token. * @return tokenAddress The address of the interchain token. */ function interchainTokenAddress(bytes32 tokenId) external view returns (address tokenAddress); /** * @notice Returns the custom tokenId associated with the given operator and salt. * @param operator_ The operator address. * @param salt The salt used for token id calculation. * @return tokenId The custom tokenId associated with the operator and salt. */ function interchainTokenId(address operator_, bytes32 salt) external view returns (bytes32 tokenId); /** * @notice Registers metadata for a token on the ITS Hub. This metadata is used for scaling linked tokens. * The token metadata must be registered before linkToken can be called for the corresponding token. * @param tokenAddress The address of the token. * @param gasValue The cross-chain gas value for sending the registration message to ITS Hub. */ function registerTokenMetadata(address tokenAddress, uint256 gasValue) external payable; /** * @notice Only to be used by the InterchainTokenFactory to register custom tokens to this chain. Then link token can be used to register those tokens to other chains. * @param salt A unique salt to derive tokenId from. * @param tokenManagerType The type of the token manager to use for the token registration. * @param linkParams The operator for the token. */ function registerCustomToken( bytes32 salt, address tokenAddress, TokenManagerType tokenManagerType, bytes calldata linkParams ) external payable returns (bytes32 tokenId); /** * @notice If `destinationChain` is an empty string, this function will register the token address on the current chain. * Otherwise, it will link the token address on the destination chain with the token corresponding to the tokenId on the current chain. * A token manager is deployed on EVM chains that's responsible for managing the linked token. * @dev This function replaces the prior `deployTokenManager` function. * @param salt A unique identifier to allow for multiple tokens registered per deployer. * @param destinationChain The chain to link the token to. Pass an empty string for this chain. * @param destinationTokenAddress The token address to link, as bytes. * @param tokenManagerType The type of the token manager to use to send and receive tokens. * @param linkParams Additional parameteres to use to link the token. Fow not it is just the address of the operator. * @param gasValue Pass a non-zero value only for remote linking, which should be the gas to use to pay for the contract call. * @return tokenId The tokenId associated with the token manager. */ function linkToken( bytes32 salt, string calldata destinationChain, bytes memory destinationTokenAddress, TokenManagerType tokenManagerType, bytes memory linkParams, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Deploys and registers an interchain token on a remote chain. * @param salt The salt used for token deployment. * @param destinationChain The name of the destination chain. Use '' for this chain. * @param name The name of the interchain tokens. * @param symbol The symbol of the interchain tokens. * @param decimals The number of decimals for the interchain tokens. * @param minter The minter data for mint/burn operations. * @param gasValue The gas value for deployment. * @return tokenId The tokenId corresponding to the deployed InterchainToken. */ function deployInterchainToken( bytes32 salt, string calldata destinationChain, string memory name, string memory symbol, uint8 decimals, bytes memory minter, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Initiates an interchain transfer of a specified 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 metadata Optional metadata for the call for additional effects (such as calling a destination contract). */ function interchainTransfer( bytes32 tokenId, string calldata destinationChain, bytes calldata destinationAddress, uint256 amount, bytes calldata metadata, uint256 gasValue ) external payable; /** * @notice Sets the flow limits for multiple tokens. * @param tokenIds An array of tokenIds. * @param flowLimits An array of flow limits corresponding to the tokenIds. */ function setFlowLimits(bytes32[] calldata tokenIds, uint256[] calldata flowLimits) external; /** * @notice Allows the owner to pause/unpause the token service. * @param paused whether to pause or unpause. */ function setPauseStatus(bool paused) external; /** * @notice Allows the owner to migrate legacy tokens that cannot be migrated automatically. * @param tokenId the tokenId of the registered token. */ function migrateInterchainToken(bytes32 tokenId) external; } // File contracts/interfaces/IInterchainTokenFactory.sol /** * @title IInterchainTokenFactory Interface * @notice This interface defines functions for deploying new interchain tokens and managing their token managers. */ interface IInterchainTokenFactory is ITokenManagerType, IUpgradable, IMulticall { error ZeroAddress(); error InvalidChainName(); error InvalidMinter(address minter); error NotMinter(address minter); error NotSupported(); error RemoteDeploymentNotApproved(); error InvalidTokenId(bytes32 tokenId, bytes32 expectedTokenId); error ZeroSupplyToken(); error NotToken(address tokenAddress); /// @notice Emitted when a minter approves a deployer for a remote interchain token deployment that uses a custom destinationMinter address. event DeployRemoteInterchainTokenApproval( address indexed minter, address indexed deployer, bytes32 indexed tokenId, string destinationChain, bytes destinationMinter ); /// @notice Emitted when a minter revokes a deployer's approval for a remote interchain token deployment that uses a custom destinationMinter address. event RevokedDeployRemoteInterchainTokenApproval( address indexed minter, address indexed deployer, bytes32 indexed tokenId, string destinationChain ); /** * @notice Returns the address of the interchain token service. * @return IInterchainTokenService The address of the interchain token service. */ function interchainTokenService() external view returns (IInterchainTokenService); /** * @notice Returns the hash of the chain name. * @return bytes32 The hash of the chain name. */ function chainNameHash() external view returns (bytes32); /** * @notice Computes the deploy salt for an interchain token. * @param deployer The address of the deployer. * @param salt A unique identifier to generate the salt. * @return deploySalt The deploy salt for the interchain token. */ function interchainTokenDeploySalt(address deployer, bytes32 salt) external view returns (bytes32 deploySalt); /** * @notice Computes the ID for an interchain token based on the deployer and a salt. * @param deployer The address that deployed the interchain token. * @param salt A unique identifier used in the deployment process. * @return tokenId The ID of the interchain token. */ function interchainTokenId(address deployer, bytes32 salt) external view returns (bytes32 tokenId); /** * @notice Deploys a new interchain token with specified parameters. * @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), allocated to the msg.sender. * @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); /** * @notice 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. * @param deployer The address of the deployer. * @param salt The unique salt for deploying the token. * @param destinationChain The name of the destination chain. * @param destinationMinter 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. */ function approveDeployRemoteInterchainToken( address deployer, bytes32 salt, string calldata destinationChain, bytes calldata destinationMinter ) external; /** * @notice Allows the minter to revoke a deployer's approval for a remote interchain token deployment that uses a custom destinationMinter address. * @param deployer The address of the deployer. * @param salt The unique salt for deploying the token. * @param destinationChain The name of the destination chain. */ function revokeDeployRemoteInterchainToken(address deployer, bytes32 salt, string calldata destinationChain) external; /** * @notice Deploys a remote interchain token on a specified destination chain. No additional minter is set on the deployed token. * Use the `deployRemoteInterchainTokenWithMinter` method to do so. * @param salt The unique salt for deploying the token. * @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( bytes32 salt, string calldata destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Deploys a remote interchain token on a specified destination chain. * @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 destinationMinter 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. * @param gasValue The amount of gas to send for the deployment. * @return tokenId The tokenId corresponding to the deployed InterchainToken. */ function deployRemoteInterchainTokenWithMinter( bytes32 salt, address minter, string calldata destinationChain, bytes memory destinationMinter, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Deprecated: Use `deployRemoteInterchainToken` or `deployRemoteInterchainTokenWithMinter` instead. * Deploys a remote interchain token on a specified destination chain. * @dev originalChainName is only allowed to be '', i.e the current chain. * Other source chains are not supported anymore to simplify ITS token deployment behaviour. * @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 calldata destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Computes the deploy salt for a canonical interchain token. * @param tokenAddress The address of the token. * @return deploySalt The deploy salt for the interchain token. */ function canonicalInterchainTokenDeploySalt(address tokenAddress) external view returns (bytes32 deploySalt); /** * @notice Computes the ID for a canonical interchain token based on its address. * @param tokenAddress The address of the canonical interchain token. * @return tokenId The ID of the canonical interchain token. */ function canonicalInterchainTokenId(address tokenAddress) external view returns (bytes32 tokenId); /** * @notice Registers a canonical token as an interchain token and deploys its token manager. * @param tokenAddress The address of the canonical token. * @return tokenId The tokenId corresponding to the registered canonical token. */ function registerCanonicalInterchainToken(address tokenAddress) external payable returns (bytes32 tokenId); /** * @notice Deploys a canonical interchain token on a remote chain. * @param originalTokenAddress The address of the original token on the original chain. * @param destinationChain The name of the chain where the token will be deployed. * @param gasValue The gas amount to be sent for deployment. * @return tokenId The tokenId corresponding to the deployed canonical InterchainToken. */ function deployRemoteCanonicalInterchainToken( address originalTokenAddress, string calldata destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice 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. * @dev originalChain is only allowed to be '', i.e the current chain. * Other source chains are not supported anymore to simplify ITS token deployment behaviour. * @param originalChain The name of the chain where the token originally exists. * @param originalTokenAddress The address of the original token on the original chain. * @param destinationChain The name of the chain where the token will be deployed. * @param gasValue The gas amount to be sent for deployment. * @return tokenId The tokenId corresponding to the deployed InterchainToken. */ function deployRemoteCanonicalInterchainToken( string calldata originalChain, address originalTokenAddress, string calldata destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice Computes the deploy salt for a linked interchain token. * @param deployer The address of the deployer. * @param salt The unique salt for deploying the token. * @return deploySalt The deploy salt for the interchain token. */ function linkedTokenDeploySalt(address deployer, bytes32 salt) external view returns (bytes32 deploySalt); /** * @notice Computes the ID for a linked token based on its address. * @param deployer The address of the deployer. * @param salt The unique salt for deploying the token. * @return tokenId The ID of the linked token. */ function linkedTokenId(address deployer, bytes32 salt) external view returns (bytes32 tokenId); /** * @notice Register an existing ERC20 token under a `tokenId` computed from the provided `salt`. * The token metadata must have been registered for tokens on each chain via `InterchainTokenService.registerTokenMetadata`. * This token can then be linked to remote tokens on different chains by submitting the `linkToken` function from the same `msg.sender` and using the same `salt`. * @dev This function is marked as payable since it can be called within a multicall with other payable methods. * @param salt The salt used to derive the tokenId for the custom token registration. The same salt must be used when linking this token on other chains under the same tokenId. * @param tokenAddress The token address of the token being registered. * @param tokenManagerType The token manager type used for the token link. * @param operator The operator of the token manager. */ function registerCustomToken( bytes32 salt, address tokenAddress, TokenManagerType tokenManagerType, address operator ) external payable returns (bytes32 tokenId); /** * @notice Links a remote token on `destinationChain` to a local token corresponding to the `tokenId` computed from the provided `salt`. * A local token must have been registered first using the `registerCustomToken` function. * @param salt The salt used to derive the tokenId for the custom token registration. The same salt must be used when linking this token on other chains under the same tokenId. * @param destinationChain The name of the destination chain. * @param destinationTokenAddress The token address of the token being linked. * @param tokenManagerType The token manager type used for the token link. * @param linkParams Additional parameters for the token link depending on the destination chain. For EVM destination chains, this is an optional custom operator address. * @param gasValue The cross-chain gas value used to link the token on the destination chain. * @return tokenId The tokenId corresponding to the linked token. */ function linkToken( bytes32 salt, string calldata destinationChain, bytes calldata destinationTokenAddress, TokenManagerType tokenManagerType, bytes calldata linkParams, uint256 gasValue ) external payable returns (bytes32 tokenId); }