From 7ba0ad2b7c56b328013868f7ac140f8d5b278349 Mon Sep 17 00:00:00 2001 From: Foivos Date: Mon, 29 Jul 2024 14:35:37 +0300 Subject: [PATCH] fix tests and lint --- .../InterchainTokenServiceCallContract.sol | 68 ++++++++++--------- hardhat.config.js | 2 +- scripts/deploy.js | 5 +- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/contracts/InterchainTokenServiceCallContract.sol b/contracts/InterchainTokenServiceCallContract.sol index ae5da2a6..326c7297 100644 --- a/contracts/InterchainTokenServiceCallContract.sol +++ b/contracts/InterchainTokenServiceCallContract.sol @@ -27,17 +27,19 @@ contract InterchainTokenServiceCallContract is InterchainTokenServiceVirtual { address tokenManagerImplementation_, address tokenHandler_, address callContract_ - ) InterchainTokenServiceVirtual( - tokenManagerDeployer_, - interchainTokenDeployer_, - gateway_, - gasService_, - interchainTokenFactory_, - chainName_, - tokenManagerImplementation_, - tokenHandler_ - ) { - if(callContract_ == address(0)) revert ZeroAddress(); + ) + InterchainTokenServiceVirtual( + tokenManagerDeployer_, + interchainTokenDeployer_, + gateway_, + gasService_, + interchainTokenFactory_, + chainName_, + tokenManagerImplementation_, + tokenHandler_ + ) + { + if (callContract_ == address(0)) revert ZeroAddress(); callContract = callContract_; } @@ -55,16 +57,18 @@ contract InterchainTokenServiceCallContract is InterchainTokenServiceVirtual { uint256 gasValue ) internal override { string memory destinationAddress = trustedAddress(destinationChain); - (bool success, bytes memory returnData) = callContract.delegatecall(abi.encodeWithSelector( - ICallContract.callContract.selector, - destinationChain, - destinationAddress, - payload, - metadataVersion, - gasValue - )); + (bool success, bytes memory returnData) = callContract.delegatecall( + abi.encodeWithSelector( + ICallContract.callContract.selector, + destinationChain, + destinationAddress, + payload, + metadataVersion, + gasValue + ) + ); - if(!success) revert CallContractFailed(returnData); + if (!success) revert CallContractFailed(returnData); } /** @@ -85,17 +89,19 @@ contract InterchainTokenServiceCallContract is InterchainTokenServiceVirtual { uint256 gasValue ) internal override { string memory destinationAddress = trustedAddress(destinationChain); - (bool success, bytes memory returnData) = callContract.delegatecall(abi.encodeWithSelector( - ICallContract.callContractWithToken.selector, - destinationChain, - destinationAddress, - payload, - symbol, - amount, - metadataVersion, - gasValue - )); + (bool success, bytes memory returnData) = callContract.delegatecall( + abi.encodeWithSelector( + ICallContract.callContractWithToken.selector, + destinationChain, + destinationAddress, + payload, + symbol, + amount, + metadataVersion, + gasValue + ) + ); - if(!success) revert CallContractFailed(returnData); + if (!success) revert CallContractFailed(returnData); } } diff --git a/hardhat.config.js b/hardhat.config.js index 5f9a86ff..c02b040f 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -57,7 +57,7 @@ module.exports = { : { 'contracts/proxies/Proxy.sol': compilerSettings, 'contracts/proxies/TokenManagerProxy.sol': compilerSettings, - 'contracts/InterchainTokenService.sol': compilerSettings, + 'contracts/InterchainTokenService.sol': itsCompilerSettings, 'contracts/test/TestInterchainTokenService.sol': itsCompilerSettings, }, }, diff --git a/scripts/deploy.js b/scripts/deploy.js index d7da8009..b9708a4b 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -42,9 +42,7 @@ async function deployInterchainTokenService( ) { const interchainTokenServiceAddress = await getCreate3Address(create3DeployerAddress, wallet, deploymentKey); - const callContract = await deployContract(wallet, 'CallContract', [gatewayAddress, gasServiceAddress]); - - const implementation = await deployContract(wallet, 'InterchainTokenServiceCallContract', [ + const implementation = await deployContract(wallet, 'InterchainTokenService', [ tokenManagerDeployerAddress, interchainTokenDeployerAddress, gatewayAddress, @@ -53,7 +51,6 @@ async function deployInterchainTokenService( chainName, tokenManagerAddress, tokenHandlerAddress, - callContract.address ]); const proxy = await create3DeployContract(create3DeployerAddress, wallet, Proxy, deploymentKey, [ implementation.address,