Skip to content

Commit

Permalink
fix tests and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jul 29, 2024
1 parent f418163 commit 7ba0ad2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 36 deletions.
68 changes: 37 additions & 31 deletions contracts/InterchainTokenServiceCallContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}
Expand All @@ -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);
}

/**
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down
5 changes: 1 addition & 4 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -53,7 +51,6 @@ async function deployInterchainTokenService(
chainName,
tokenManagerAddress,
tokenHandlerAddress,
callContract.address
]);
const proxy = await create3DeployContract(create3DeployerAddress, wallet, Proxy, deploymentKey, [
implementation.address,
Expand Down

0 comments on commit 7ba0ad2

Please sign in to comment.