From 5fb0042ef7f4f198e8795b8e0433d53d7c23e54c Mon Sep 17 00:00:00 2001 From: ahramy Date: Thu, 7 Nov 2024 15:08:52 -0800 Subject: [PATCH] feat(its): prevent deploy token manager on its hub --- contracts/InterchainTokenService.sol | 3 +++ contracts/interfaces/IInterchainTokenService.sol | 1 + 2 files changed, 4 insertions(+) diff --git a/contracts/InterchainTokenService.sol b/contracts/InterchainTokenService.sol index efd337cf..e4bf73d8 100644 --- a/contracts/InterchainTokenService.sol +++ b/contracts/InterchainTokenService.sol @@ -787,6 +787,9 @@ contract InterchainTokenService is // Check whether the ITS call should be routed via ITS hub for this destination chain if (keccak256(abi.encodePacked(destinationAddress)) == ITS_HUB_ROUTING_IDENTIFIER_HASH) { + // Prevent deploy token manager to be usable on ITS hub + if (_getMessageType(payload) == MESSAGE_TYPE_DEPLOY_TOKEN_MANAGER) revert NotSupported(); + // Wrap ITS message in an ITS Hub message payload = abi.encode(MESSAGE_TYPE_SEND_TO_HUB, destinationChain, payload); destinationChain = ITS_HUB_CHAIN_NAME; diff --git a/contracts/interfaces/IInterchainTokenService.sol b/contracts/interfaces/IInterchainTokenService.sol index 54dadff1..1d413627 100644 --- a/contracts/interfaces/IInterchainTokenService.sol +++ b/contracts/interfaces/IInterchainTokenService.sol @@ -50,6 +50,7 @@ interface IInterchainTokenService is error CannotDeployRemotelyToSelf(); error InvalidPayload(); error GatewayCallFailed(bytes data); + error NotSupported(); event InterchainTransfer( bytes32 indexed tokenId,