diff --git a/contracts/InterchainTokenFactory.sol b/contracts/InterchainTokenFactory.sol index ef936708..ebbad527 100644 --- a/contracts/InterchainTokenFactory.sol +++ b/contracts/InterchainTokenFactory.sol @@ -155,22 +155,21 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M /** * @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 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. + * @param remoteMinter The calldata representing the minter's address on the remote chain. Must be empty if no minter is specified. + * Reverts if the msg.sender does not have mint permission for 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, - address minter, + bytes memory remoteMinter, string memory destinationChain, uint256 gasValue ) public payable returns (bytes32 tokenId) { string memory tokenName; string memory tokenSymbol; uint8 tokenDecimals; - bytes memory minter_ = new bytes(0); salt = interchainTokenSalt(chainNameHash, msg.sender, salt); tokenId = interchainTokenService.interchainTokenId(TOKEN_FACTORY_DEPLOYER, salt); @@ -181,14 +180,12 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M tokenSymbol = token.symbol(); tokenDecimals = token.decimals(); - if (minter != address(0)) { - if (!token.isMinter(minter)) revert NotMinter(minter); - if (minter == address(interchainTokenService)) revert InvalidMinter(minter); - - minter_ = minter.toBytes(); + if (remoteMinter.length != 0) { + if (!token.isMinter(msg.sender)) revert NotMinter(msg.sender); + if (msg.sender == address(interchainTokenService)) revert InvalidMinter(msg.sender); } - tokenId = _deployInterchainToken(salt, destinationChain, tokenName, tokenSymbol, tokenDecimals, minter_, gasValue); + tokenId = _deployInterchainToken(salt, destinationChain, tokenName, tokenSymbol, tokenDecimals, remoteMinter, gasValue); } /** @@ -198,7 +195,7 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M * 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 receive the minter and operator role of the token, in addition to ITS. If the address is `address(0)`, + * @dev minter 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. * @param destinationChain The name of the destination chain. * @param gasValue The amount of gas to send for the deployment. @@ -207,13 +204,14 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M function deployRemoteInterchainToken( string calldata originalChainName, bytes32 salt, - address minter, + address /*minter*/, string memory destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId) { if (bytes(originalChainName).length != 0) revert NotSupported(); + bytes memory minter_ = new bytes(0); - tokenId = deployRemoteInterchainToken(salt, minter, destinationChain, gasValue); + tokenId = deployRemoteInterchainToken(salt, minter_, destinationChain, gasValue); } /** diff --git a/contracts/interfaces/IInterchainTokenFactory.sol b/contracts/interfaces/IInterchainTokenFactory.sol index 0dbdb311..3bfef386 100644 --- a/contracts/interfaces/IInterchainTokenFactory.sol +++ b/contracts/interfaces/IInterchainTokenFactory.sol @@ -79,25 +79,28 @@ interface IInterchainTokenFactory is IUpgradable, IMulticall { /** * @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 remoteMinter The calldata representing the minter's address on the remote chain. Must be empty if no minter is specified. + * Reverts if the msg.sender does not have mint permission for 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, - address minter, + bytes calldata remoteMinter, string memory destinationChain, uint256 gasValue ) external payable returns (bytes32 tokenId); /** * @notice 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. * @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. + * @dev minter 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. * @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.