Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy committed Nov 11, 2024
1 parent 89cf639 commit db1dc08
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
7 changes: 1 addition & 6 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ contract InterchainTokenService is
bytes calldata metadata,
uint256 gasValue
) external payable whenNotPaused {
if (destinationAddress.length == 0) revert EmptyDestinationAddress();

amount = _takeToken(tokenId, msg.sender, amount, false);

(IGatewayCaller.MetadataVersion metadataVersion, bytes memory data) = _decodeMetadata(metadata);
Expand All @@ -518,7 +516,6 @@ contract InterchainTokenService is
bytes memory data,
uint256 gasValue
) external payable whenNotPaused {
if (destinationAddress.length == 0) revert EmptyDestinationAddress();
if (data.length == 0) revert EmptyData();

amount = _takeToken(tokenId, msg.sender, amount, false);
Expand Down Expand Up @@ -557,9 +554,6 @@ contract InterchainTokenService is
uint256 amount,
bytes calldata metadata
) external payable whenNotPaused {
if (sourceAddress == address(0)) revert EmptySourceAddress();
if (destinationAddress.length == 0) revert EmptyDestinationAddress();

amount = _takeToken(tokenId, sourceAddress, amount, true);

(IGatewayCaller.MetadataVersion metadataVersion, bytes memory data) = _decodeMetadata(metadata);
Expand Down Expand Up @@ -1044,6 +1038,7 @@ contract InterchainTokenService is
bytes memory data,
uint256 gasValue
) internal {
if (destinationAddress.length == 0) revert EmptyDestinationAddress();
if (amount == 0) revert ZeroAmount();

// slither-disable-next-line reentrancy-events
Expand Down
1 change: 0 additions & 1 deletion contracts/interfaces/IInterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ interface IInterchainTokenService is
error EmptyTokenName();
error EmptyTokenSymbol();
error EmptyParams();
error EmptySourceAddress();
error EmptyDestinationAddress();

event InterchainTransfer(
Expand Down
14 changes: 1 addition & 13 deletions test/InterchainTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,18 +1363,6 @@ describe('Interchain Token Service', () => {
await service.setPauseStatus(false).then((tx) => tx.wait);
});

it('Should revert on transmit send token when source address is zero address', async () => {
await expectRevert(
(gasOptions) =>
service.transmitInterchainTransfer(tokenId, AddressZero, destinationChain, destAddress, amount, '0x', {
...gasOptions,
value: gasValue,
}),
service,
'EmptySourceAddress',
);
});

it('Should revert on transmit send token when destination address is zero address', async () => {
await expectRevert(
(gasOptions) =>
Expand All @@ -1383,7 +1371,7 @@ describe('Interchain Token Service', () => {
value: gasValue,
}),
service,
'EmptyDestinationAddress',
'TakeTokenFailed',
);
});

Expand Down

0 comments on commit db1dc08

Please sign in to comment.