Skip to content

Commit

Permalink
addressed most comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jan 10, 2025
1 parent c387d98 commit bc06339
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
15 changes: 6 additions & 9 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ contract InterchainTokenService is
function linkToken(
bytes32 salt,
string calldata destinationChain,
bytes memory destinationTokenAddress,
bytes calldata destinationTokenAddress,
TokenManagerType tokenManagerType,
bytes memory linkParams,
bytes calldata linkParams,
uint256 gasValue
) public payable whenNotPaused returns (bytes32 tokenId) {
if (destinationTokenAddress.length == 0) revert EmptyDestinationAddress();
Expand All @@ -338,7 +338,7 @@ contract InterchainTokenService is

address deployer = msg.sender;

if (msg.sender == interchainTokenFactory) {
if (deployer == interchainTokenFactory) {
deployer = TOKEN_FACTORY_DEPLOYER;
} else if (bytes(destinationChain).length == 0) {
// TODO: Only support linking new tokens via ITS factory, to include chain name in token id derivation
Expand Down Expand Up @@ -900,9 +900,6 @@ contract InterchainTokenService is

// Get message type of the inner ITS message
messageType = _getMessageType(payload);

// Prevent link token to be usable on ITS HUB.
if (messageType == MESSAGE_TYPE_LINK_TOKEN) revert NotSupported();
} else {
// Prevent receiving a direct message from the ITS Hub. This is not supported yet.
if (keccak256(abi.encodePacked(sourceChain)) == ITS_HUB_CHAIN_NAME_HASH) revert UntrustedChain();
Expand All @@ -923,9 +920,9 @@ contract InterchainTokenService is
function _linkToken(
bytes32 tokenId,
string calldata destinationChain,
bytes memory destinationTokenAddress,
bytes calldata destinationTokenAddress,
TokenManagerType tokenManagerType,
bytes memory params,
bytes calldata params,
uint256 gasValue
) internal {
// slither-disable-next-line unused-return
Expand Down Expand Up @@ -978,7 +975,7 @@ contract InterchainTokenService is
_callContract(destinationChain, payload, IGatewayCaller.MetadataVersion.CONTRACT_CALL, gasValue);
}

/*
/**
* @notice Deploys a token manager.
* @param tokenId The ID of the token.
* @param tokenManagerType The type of the token manager to be deployed.
Expand Down
13 changes: 12 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const compilerSettings = {
optimizer: optimizerSettings,
},
};
const itsCompilerService = {
version: '0.8.21',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: {
...optimizerSettings,
runs: 100,
},
},
};

/**
* @type import('hardhat/config').HardhatUserConfig
Expand All @@ -59,7 +69,8 @@ module.exports = {
'contracts/proxies/InterchainProxy.sol': fixedContractCompilerSettings,
'contracts/proxies/TokenManagerProxy.sol': fixedContractCompilerSettings,
'contracts/interchain-token/InterchainToken.sol': fixedContractCompilerSettings,
'contracts/test/TestInterchainTokenService.sol': fixedContractCompilerSettings,
'contracts/test/TestInterchainTokenService.sol': itsCompilerService,
'contracts/InterchainTokenService.sol': itsCompilerService,
},
},
defaultNetwork: 'hardhat',
Expand Down

0 comments on commit bc06339

Please sign in to comment.