From 02f4db3c0a5827d00cc0cc7dc9681c6c47ed2eba Mon Sep 17 00:00:00 2001 From: SGiaccobasso Date: Tue, 10 Sep 2024 00:22:29 -0300 Subject: [PATCH 01/18] feat: create gmp tracker event interface --- contracts/interfaces/IAxelarGMPTracker.sol | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 contracts/interfaces/IAxelarGMPTracker.sol diff --git a/contracts/interfaces/IAxelarGMPTracker.sol b/contracts/interfaces/IAxelarGMPTracker.sol new file mode 100644 index 00000000..40eee466 --- /dev/null +++ b/contracts/interfaces/IAxelarGMPTracker.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +interface IAxelarGMPTracker { + event GMPTracker( + string sourceChain, + string destinationChain, + string sourceAddress, + string destinationAddress, + string tokenAddress, + uint256 amount + uint256 decimals + ); +} From 91ce7f55ffa8b1efb39951c57cfcb0a8e5ac3cab Mon Sep 17 00:00:00 2001 From: SGiaccobasso Date: Tue, 10 Sep 2024 15:25:02 -0300 Subject: [PATCH 02/18] chore: rename of file, add comments --- contracts/interfaces/IAxelarGMPTracker.sol | 15 ----------- contracts/interfaces/IAxelarGMPVolume.sol | 31 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 15 deletions(-) delete mode 100644 contracts/interfaces/IAxelarGMPTracker.sol create mode 100644 contracts/interfaces/IAxelarGMPVolume.sol diff --git a/contracts/interfaces/IAxelarGMPTracker.sol b/contracts/interfaces/IAxelarGMPTracker.sol deleted file mode 100644 index 40eee466..00000000 --- a/contracts/interfaces/IAxelarGMPTracker.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -interface IAxelarGMPTracker { - event GMPTracker( - string sourceChain, - string destinationChain, - string sourceAddress, - string destinationAddress, - string tokenAddress, - uint256 amount - uint256 decimals - ); -} diff --git a/contracts/interfaces/IAxelarGMPVolume.sol b/contracts/interfaces/IAxelarGMPVolume.sol new file mode 100644 index 00000000..e76d31c6 --- /dev/null +++ b/contracts/interfaces/IAxelarGMPVolume.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +/** + * @title IAxelarGMPVolume + * @dev Interface for tracking volume of General Message Passing (GMP) calls in the Axelar network. + * This interface defines an event that should be emitted when a GMP transfer occurs, + * allowing for standardized volume tracking across different implementations. + */ +interface IAxelarGMPVolume { + /** + * @dev Emitted when a GMP transfer occurs, providing details for volume tracking. + * @param sourceChain The name or identifier of the source chain where the transfer originated. + * @param destinationChain The name or identifier of the destination chain where the transfer is received. + * @param sourceAddress The address on the source chain that initiated the transfer. + * @param destinationAddress The address on the destination chain that receives the transfer. + * @param tokenAddress The address of the token contract being transferred. + * @param amount The amount of tokens transferred. + * @param decimals The number of decimals for the transferred token. + */ + event GMPVolume( + string sourceChain, + string destinationChain, + string sourceAddress, + string destinationAddress, + string tokenAddress, + uint256 amount, + uint256 decimals + ); +} From 346eeec090369d4a844813c19e0f00b88ed3cdc1 Mon Sep 17 00:00:00 2001 From: Canh Trinh Date: Thu, 12 Sep 2024 17:56:53 -0400 Subject: [PATCH 03/18] chore: minor changes to event name and its properties --- contracts/interfaces/IAxelarGMPTransfer.sol | 33 +++++++++++++++++++++ contracts/interfaces/IAxelarGMPVolume.sol | 31 ------------------- 2 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 contracts/interfaces/IAxelarGMPTransfer.sol delete mode 100644 contracts/interfaces/IAxelarGMPVolume.sol diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol new file mode 100644 index 00000000..00488e00 --- /dev/null +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +/** + * @title IAxelarGMPTransfer + * @dev Interface for tracking asset value transfers using General Message Passing (GMP) calls in the Axelar Network. + * This interface defines an event that should be emitted when a GMP transfer occurs, + * allowing for standardized volume tracking across different implementations. + */ +interface IAxelarGMPTransfer { + /** + * @dev Emitted when a GMP transfer occurs, providing details for volume tracking. + * @param sender The address of the caller that initiated the transfer on the source chain. + * @param sourceChain The Axelar chain identifier of the source chain. + * @param destinationChain The Axelar chain identifier of the destination chain. + * @param destinationAddress The address of the contract on the destination chain that receives the transfer. + * @param recipientAddress The address of the final recipient of the transferred assets on the destination chain. + * @param tokenAddress The address of the token contract on the source chain. + * @param amount The amount (in atomic units) of tokens transferred. + * @param decimals The number of decimal places for the token. + */ + event AxelarGMPTransfer( + address indexed sender, + string sourceChain, + string destinationChain, + string destinationAddress, + string recipientAddress, + string tokenAddress, + uint256 amount, + uint256 decimals + ); +} diff --git a/contracts/interfaces/IAxelarGMPVolume.sol b/contracts/interfaces/IAxelarGMPVolume.sol deleted file mode 100644 index e76d31c6..00000000 --- a/contracts/interfaces/IAxelarGMPVolume.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -/** - * @title IAxelarGMPVolume - * @dev Interface for tracking volume of General Message Passing (GMP) calls in the Axelar network. - * This interface defines an event that should be emitted when a GMP transfer occurs, - * allowing for standardized volume tracking across different implementations. - */ -interface IAxelarGMPVolume { - /** - * @dev Emitted when a GMP transfer occurs, providing details for volume tracking. - * @param sourceChain The name or identifier of the source chain where the transfer originated. - * @param destinationChain The name or identifier of the destination chain where the transfer is received. - * @param sourceAddress The address on the source chain that initiated the transfer. - * @param destinationAddress The address on the destination chain that receives the transfer. - * @param tokenAddress The address of the token contract being transferred. - * @param amount The amount of tokens transferred. - * @param decimals The number of decimals for the transferred token. - */ - event GMPVolume( - string sourceChain, - string destinationChain, - string sourceAddress, - string destinationAddress, - string tokenAddress, - uint256 amount, - uint256 decimals - ); -} From 886af350eb29bd23d9a93ecc69df2b2243950077 Mon Sep 17 00:00:00 2001 From: Canh Trinh Date: Tue, 17 Sep 2024 21:59:31 -0400 Subject: [PATCH 04/18] Update contracts/interfaces/IAxelarGMPTransfer.sol Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 00488e00..c2232225 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -25,7 +25,7 @@ interface IAxelarGMPTransfer { string sourceChain, string destinationChain, string destinationAddress, - string recipientAddress, + bytes recipient, string tokenAddress, uint256 amount, uint256 decimals From 6163a3eaa69f39566c1353cabadfda73d33ae8b3 Mon Sep 17 00:00:00 2001 From: Canh Trinh Date: Tue, 17 Sep 2024 22:01:22 -0400 Subject: [PATCH 05/18] Update contracts/interfaces/IAxelarGMPTransfer.sol Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index c2232225..3ebda928 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -24,7 +24,7 @@ interface IAxelarGMPTransfer { address indexed sender, string sourceChain, string destinationChain, - string destinationAddress, + string destinationContractAddress, bytes recipient, string tokenAddress, uint256 amount, From 05f6cce40722defa49f9fb1b00de6553c1f4e8bc Mon Sep 17 00:00:00 2001 From: Canh Trinh Date: Tue, 17 Sep 2024 22:02:34 -0400 Subject: [PATCH 06/18] Update contracts/interfaces/IAxelarGMPTransfer.sol Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 3ebda928..7e197548 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -26,7 +26,7 @@ interface IAxelarGMPTransfer { string destinationChain, string destinationContractAddress, bytes recipient, - string tokenAddress, + address token, uint256 amount, uint256 decimals ); From 586d3fdb0008c820b27cf830ce5ef006711285da Mon Sep 17 00:00:00 2001 From: SGiaccobasso Date: Fri, 20 Sep 2024 14:32:33 -0300 Subject: [PATCH 07/18] chore: add transfer received event --- contracts/interfaces/IAxelarGMPTransfer.sol | 46 ++++++++++++++------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 7e197548..0d0b3281 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -3,31 +3,49 @@ pragma solidity ^0.8.0; /** - * @title IAxelarGMPTransfer + * @title IInterchainTransferSent * @dev Interface for tracking asset value transfers using General Message Passing (GMP) calls in the Axelar Network. - * This interface defines an event that should be emitted when a GMP transfer occurs, + * This interface defines an event that should be emitted when a GMP transfer is sent, * allowing for standardized volume tracking across different implementations. */ -interface IAxelarGMPTransfer { +interface IInterchainTransferSent { /** - * @dev Emitted when a GMP transfer occurs, providing details for volume tracking. - * @param sender The address of the caller that initiated the transfer on the source chain. - * @param sourceChain The Axelar chain identifier of the source chain. + * @dev Emitted when a GMP transfer is sent, providing details for volume tracking. * @param destinationChain The Axelar chain identifier of the destination chain. - * @param destinationAddress The address of the contract on the destination chain that receives the transfer. - * @param recipientAddress The address of the final recipient of the transferred assets on the destination chain. - * @param tokenAddress The address of the token contract on the source chain. + * @param destinationContractAddress The address of the contract on the destination chain that receives the transfer. + * @param recipient The address of the final recipient of the transferred assets on the destination chain. + * @param token The address of the token contract on the source chain. * @param amount The amount (in atomic units) of tokens transferred. - * @param decimals The number of decimal places for the token. */ - event AxelarGMPTransfer( - address indexed sender, - string sourceChain, + event InterchainTransferSent( string destinationChain, string destinationContractAddress, bytes recipient, address token, uint256 amount, - uint256 decimals + ); +} + +/** + * @title IInterchainTransferReceived + * @dev Interface for tracking asset value transfers using General Message Passing (GMP) calls in the Axelar Network. + * This interface defines an event that should be emitted when a GMP transfer is received, + * allowing for standardized volume tracking across different implementations. + */ +interface IInterchainTransferReceived { + /** + * @dev Emitted when an interchain transfer is received, providing details for volume tracking. + * @param sender The address of the caller that initiated the transfer on the source chain. + * @param sourceChain The Axelar chain identifier of the source chain. + * @param recipient The address of the final recipient of the transferred assets on the destination chain. + * @param token The address of the token contract on the destination chain. + * @param amount The amount (in atomic units) of tokens received. + */ + event InterchainTransferReceived( + string sender, + string sourceChain, + bytes recipient, + address token, + uint256 amount, ); } From 45387403f5d3cb1d1fc40eddae49c952eb00f4c2 Mon Sep 17 00:00:00 2001 From: Canh Trinh Date: Tue, 24 Sep 2024 11:22:10 -0400 Subject: [PATCH 08/18] chore: minor updates to transfer interface --- contracts/interfaces/IAxelarGMPTransfer.sol | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 0d0b3281..d278a805 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -22,7 +22,7 @@ interface IInterchainTransferSent { string destinationContractAddress, bytes recipient, address token, - uint256 amount, + uint256 amount ); } @@ -35,17 +35,19 @@ interface IInterchainTransferSent { interface IInterchainTransferReceived { /** * @dev Emitted when an interchain transfer is received, providing details for volume tracking. - * @param sender The address of the caller that initiated the transfer on the source chain. * @param sourceChain The Axelar chain identifier of the source chain. + * @param sourceAddress The address of the contract that initiated the transfer on the source chain. + * @param sender The address of the sender in case it is different from the source contract address * @param recipient The address of the final recipient of the transferred assets on the destination chain. * @param token The address of the token contract on the destination chain. * @param amount The amount (in atomic units) of tokens received. */ event InterchainTransferReceived( - string sender, string sourceChain, + string sourceAddress, + bytes sender, bytes recipient, address token, - uint256 amount, + uint256 amount ); } From 43fa007fa65e3c10309fb6681a531104051f1a3f Mon Sep 17 00:00:00 2001 From: SGiaccobasso Date: Wed, 25 Sep 2024 17:19:31 -0300 Subject: [PATCH 09/18] chore: add new event toGMPExecutableWithToken test --- contracts/interfaces/IAxelarGMPTransfer.sol | 10 ++----- .../executable/GMPExecutableWithTokenTest.sol | 27 ++++++++++++------- test/executable/GMPExecutableWithToken.js | 12 ++++++--- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 0d0b3281..2f6644fd 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -22,7 +22,7 @@ interface IInterchainTransferSent { string destinationContractAddress, bytes recipient, address token, - uint256 amount, + uint256 amount ); } @@ -41,11 +41,5 @@ interface IInterchainTransferReceived { * @param token The address of the token contract on the destination chain. * @param amount The amount (in atomic units) of tokens received. */ - event InterchainTransferReceived( - string sender, - string sourceChain, - bytes recipient, - address token, - uint256 amount, - ); + event InterchainTransferReceived(string sender, string sourceChain, bytes recipient, address token, uint256 amount); } diff --git a/contracts/test/executable/GMPExecutableWithTokenTest.sol b/contracts/test/executable/GMPExecutableWithTokenTest.sol index 722140e5..eaf8ae09 100644 --- a/contracts/test/executable/GMPExecutableWithTokenTest.sol +++ b/contracts/test/executable/GMPExecutableWithTokenTest.sol @@ -3,17 +3,18 @@ pragma solidity ^0.8.0; import { AxelarGMPExecutableWithToken } from '../../executable/AxelarGMPExecutableWithToken.sol'; +import { IInterchainTransferReceived } from '../../interfaces/IAxelarGMPTransfer.sol'; -contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken { +contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchainTransferReceived { event Received(uint256 num); event ReceivedWithToken(uint256 num, address tokenAddress, uint256 amount); constructor(address gatewayAddress) AxelarGMPExecutableWithToken(gatewayAddress) {} function _execute( - bytes32, /*commandId*/ - string calldata, /*sourceChain*/ - string calldata, /*sourceAddress*/ + bytes32 /*commandId*/, + string calldata /*sourceChain*/, + string calldata /*sourceAddress*/, bytes calldata payload ) internal override { uint256 num = abi.decode(payload, (uint256)); @@ -21,14 +22,20 @@ contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken { } function _executeWithToken( - bytes32, /*commandId*/ - string calldata, /*sourceChain*/ - string calldata, /*sourceAddress*/ - bytes calldata payload, + bytes32 /*commandId*/, + string calldata sourceChain, + string calldata sourceAddress, + bytes calldata, string calldata tokenSymbol, uint256 amount ) internal override { - uint256 num = abi.decode(payload, (uint256)); - emit ReceivedWithToken(num, gatewayWithToken().tokenAddresses(tokenSymbol), amount); + // Emit InterchainTransferReceived event + emit InterchainTransferReceived( + sourceAddress, + sourceChain, + abi.encodePacked(address(this)), + gatewayWithToken().tokenAddresses(tokenSymbol), + amount + ); } } diff --git a/test/executable/GMPExecutableWithToken.js b/test/executable/GMPExecutableWithToken.js index 03023922..1e89e696 100644 --- a/test/executable/GMPExecutableWithToken.js +++ b/test/executable/GMPExecutableWithToken.js @@ -130,10 +130,14 @@ describe('GMPExecutableWithToken', () => { ); await expect(execute) - .to.emit(GMPExecutableWithToken, 'ReceivedWithToken') - .withArgs(num, tokenA.address, swapAmount) - .to.emit(tokenA, 'Transfer') - .withArgs(destinationChainGateway.address, GMPExecutableWithToken.address, swapAmount); + .to.emit(GMPExecutableWithToken, 'InterchainTransferReceived') + .withArgs( + userWallet.address.toString(), + sourceChain, + GMPExecutableWithToken.address.toLowerCase(), + await destinationChainGateway.tokenAddresses(symbolA), + swapAmount, + ); }); }); From 9c08753c92be72fd0ca505afb3089984cf76373b Mon Sep 17 00:00:00 2001 From: npty <78221556+npty@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:08:28 +0700 Subject: [PATCH 10/18] chore: add indexed to token Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index d278a805..4ccdcc8f 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -21,7 +21,7 @@ interface IInterchainTransferSent { string destinationChain, string destinationContractAddress, bytes recipient, - address token, + address indexed token, uint256 amount ); } From ddc1367f11c016fa4c49698e775daf31612fb7f9 Mon Sep 17 00:00:00 2001 From: npty <78221556+npty@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:09:05 +0700 Subject: [PATCH 11/18] chore: indexed recipient Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 4ccdcc8f..26733359 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -46,7 +46,7 @@ interface IInterchainTransferReceived { string sourceChain, string sourceAddress, bytes sender, - bytes recipient, + address indexed recipient, address token, uint256 amount ); From b25db3adfcf64e6868675e3cf61f1215edf95afa Mon Sep 17 00:00:00 2001 From: npty <78221556+npty@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:09:21 +0700 Subject: [PATCH 12/18] chore: indexed token Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index 26733359..bac08221 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -47,7 +47,7 @@ interface IInterchainTransferReceived { string sourceAddress, bytes sender, address indexed recipient, - address token, + address indexed token, uint256 amount ); } From 6ad4eb2d693d4c99b931afe7739a76fc2f552f7a Mon Sep 17 00:00:00 2001 From: npty <78221556+npty@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:09:44 +0700 Subject: [PATCH 13/18] chore: indexed sender Co-authored-by: Milap Sheth --- contracts/interfaces/IAxelarGMPTransfer.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IAxelarGMPTransfer.sol index bac08221..9ce1880a 100644 --- a/contracts/interfaces/IAxelarGMPTransfer.sol +++ b/contracts/interfaces/IAxelarGMPTransfer.sol @@ -20,6 +20,7 @@ interface IInterchainTransferSent { event InterchainTransferSent( string destinationChain, string destinationContractAddress, + address indexed sender, bytes recipient, address indexed token, uint256 amount From fa1433742d637ea45063c22b87632c91c9ad326a Mon Sep 17 00:00:00 2001 From: npty <78221556+npty@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:11:05 +0700 Subject: [PATCH 14/18] chore: remove payload Co-authored-by: Milap Sheth --- contracts/test/executable/GMPExecutableWithTokenTest.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/test/executable/GMPExecutableWithTokenTest.sol b/contracts/test/executable/GMPExecutableWithTokenTest.sol index 1e904c7f..63a7b44a 100644 --- a/contracts/test/executable/GMPExecutableWithTokenTest.sol +++ b/contracts/test/executable/GMPExecutableWithTokenTest.sol @@ -33,7 +33,7 @@ contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchain emit InterchainTransferReceived( sourceChain, sourceAddress, - payload, + bytes(sourceAddress), abi.encodePacked(address(this)), gatewayWithToken().tokenAddresses(tokenSymbol), amount From a63d73eba67d4609282a0ca70be6140f9f294df2 Mon Sep 17 00:00:00 2001 From: npty Date: Wed, 2 Oct 2024 19:14:05 +0700 Subject: [PATCH 15/18] chore: rename to IInterchainTransfer --- .../{IAxelarGMPTransfer.sol => IInterchainTransfer.sol} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename contracts/interfaces/{IAxelarGMPTransfer.sol => IInterchainTransfer.sol} (100%) diff --git a/contracts/interfaces/IAxelarGMPTransfer.sol b/contracts/interfaces/IInterchainTransfer.sol similarity index 100% rename from contracts/interfaces/IAxelarGMPTransfer.sol rename to contracts/interfaces/IInterchainTransfer.sol From 4865831215464ffdb043b916bc17ff5451e39450 Mon Sep 17 00:00:00 2001 From: npty Date: Wed, 2 Oct 2024 19:19:33 +0700 Subject: [PATCH 16/18] chore: fix test --- contracts/test/executable/GMPExecutableWithTokenTest.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/test/executable/GMPExecutableWithTokenTest.sol b/contracts/test/executable/GMPExecutableWithTokenTest.sol index 63a7b44a..e2a5ed69 100644 --- a/contracts/test/executable/GMPExecutableWithTokenTest.sol +++ b/contracts/test/executable/GMPExecutableWithTokenTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import { AxelarGMPExecutableWithToken } from '../../executable/AxelarGMPExecutableWithToken.sol'; -import { IInterchainTransferReceived } from '../../interfaces/IAxelarGMPTransfer.sol'; +import { IInterchainTransferReceived } from '../../interfaces/IInterchainTransfer.sol'; contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchainTransferReceived { event Received(uint256 num); @@ -22,10 +22,10 @@ contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchain } function _executeWithToken( - bytes32 /*commandId*/, + bytes32 /* commandId */, string calldata sourceChain, string calldata sourceAddress, - bytes calldata payload, + bytes calldata /* payload */, string calldata tokenSymbol, uint256 amount ) internal override { @@ -34,7 +34,7 @@ contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchain sourceChain, sourceAddress, bytes(sourceAddress), - abi.encodePacked(address(this)), + address(this), gatewayWithToken().tokenAddresses(tokenSymbol), amount ); From 35df51834ecfa03e9fd4a956f2e937925805b365 Mon Sep 17 00:00:00 2001 From: npty Date: Wed, 2 Oct 2024 19:21:07 +0700 Subject: [PATCH 17/18] chore: make comment consistent --- contracts/test/executable/GMPExecutableWithTokenTest.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/test/executable/GMPExecutableWithTokenTest.sol b/contracts/test/executable/GMPExecutableWithTokenTest.sol index e2a5ed69..059323e0 100644 --- a/contracts/test/executable/GMPExecutableWithTokenTest.sol +++ b/contracts/test/executable/GMPExecutableWithTokenTest.sol @@ -22,10 +22,10 @@ contract GMPExecutableWithTokenTest is AxelarGMPExecutableWithToken, IInterchain } function _executeWithToken( - bytes32 /* commandId */, + bytes32 /*commandId*/, string calldata sourceChain, string calldata sourceAddress, - bytes calldata /* payload */, + bytes calldata /*payload*/, string calldata tokenSymbol, uint256 amount ) internal override { From 68ac977f0da11eaae0678140f11c17698adf2f7f Mon Sep 17 00:00:00 2001 From: npty Date: Wed, 2 Oct 2024 22:34:12 +0700 Subject: [PATCH 18/18] chore: refactor test a bit --- test/executable/GMPExecutableWithToken.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/executable/GMPExecutableWithToken.js b/test/executable/GMPExecutableWithToken.js index f260994f..fa5b6ce6 100644 --- a/test/executable/GMPExecutableWithToken.js +++ b/test/executable/GMPExecutableWithToken.js @@ -2,7 +2,7 @@ const chai = require('chai'); const { - utils: { defaultAbiCoder, keccak256, id }, + utils: { defaultAbiCoder, toUtf8Bytes, keccak256, id }, } = require('ethers'); const { expect } = chai; const { ethers } = require('hardhat'); @@ -30,7 +30,6 @@ describe('GMPExecutableWithToken', () => { before(async () => { [ownerWallet, userWallet] = await ethers.getSigners(); - gatewayFactory = await ethers.getContractFactory('MockGateway', ownerWallet); tokenFactory = await ethers.getContractFactory('ERC20MintableBurnable', ownerWallet); GMPExecutableWithTokenFactory = await ethers.getContractFactory('GMPExecutableWithTokenTest', ownerWallet); @@ -86,6 +85,7 @@ describe('GMPExecutableWithToken', () => { const approveCommandId = getRandomID(); const sourceTxHash = keccak256('0x123abc123abc'); const sourceEventIndex = 17; + const userWalletAddress = userWallet.address.toString(); const approveWithMintData = defaultAbiCoder.encode( ['string', 'string', 'address', 'bytes32', 'string', 'uint256', 'bytes32', 'uint256'], @@ -111,7 +111,7 @@ describe('GMPExecutableWithToken', () => { .withArgs( approveCommandId, sourceChain, - userWallet.address.toString(), + userWalletAddress, GMPExecutableWithToken.address, payloadHash, symbolA, @@ -123,7 +123,7 @@ describe('GMPExecutableWithToken', () => { const execute = await GMPExecutableWithToken.executeWithToken( approveCommandId, sourceChain, - userWallet.address.toString(), + userWalletAddress, payload, symbolA, swapAmount, @@ -133,9 +133,9 @@ describe('GMPExecutableWithToken', () => { .to.emit(GMPExecutableWithToken, 'InterchainTransferReceived') .withArgs( sourceChain, - userWallet.address.toString(), - payload, - GMPExecutableWithToken.address.toLowerCase(), + userWalletAddress, + toUtf8Bytes(userWalletAddress), + GMPExecutableWithToken.address, await destinationChainGateway.tokenAddresses(symbolA), swapAmount, );