From e53afd081b74a1ea820f695d5aac6acdf2376f8e Mon Sep 17 00:00:00 2001 From: ron Date: Wed, 27 Mar 2024 09:38:41 +0800 Subject: [PATCH] Rename to sendForeignToken --- contracts/src/Assets.sol | 6 +++--- contracts/src/Gateway.sol | 2 +- contracts/src/SubstrateTypes.sol | 24 ++++++++++++++---------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/contracts/src/Assets.sol b/contracts/src/Assets.sol index 59ab42972e..c45a4bea14 100644 --- a/contracts/src/Assets.sol +++ b/contracts/src/Assets.sol @@ -199,7 +199,7 @@ library Assets { } // @dev Transfer polkadot native tokens back - function transferToken( + function sendForeignToken( address executor, TokenInfo memory info, address sender, @@ -227,12 +227,12 @@ library Assets { if (destinationAddress.isAddress32()) { // The receiver has a 32-byte account ID - ticket.payload = SubstrateTypes.TransferTokenToAddress32( + ticket.payload = SubstrateTypes.SendForeignTokenToAddress32( info.tokenID, destinationChain, destinationAddress.asAddress32(), destinationChainFee, amount ); } else if (destinationAddress.isAddress20()) { // The receiver has a 20-byte account ID - ticket.payload = SubstrateTypes.TransferTokenToAddress20( + ticket.payload = SubstrateTypes.SendForeignTokenToAddress20( info.tokenID, destinationChain, destinationAddress.asAddress20(), destinationChainFee, amount ); } else { diff --git a/contracts/src/Gateway.sol b/contracts/src/Gateway.sol index 7b749947d3..efaebb8e16 100644 --- a/contracts/src/Gateway.sol +++ b/contracts/src/Gateway.sol @@ -448,7 +448,7 @@ contract Gateway is IGateway, IInitializable { } if (info.isForeign) { _submitOutbound( - Assets.transferToken( + Assets.sendForeignToken( AGENT_EXECUTOR, info, msg.sender, destinationChain, destinationAddress, destinationFee, amount ) ); diff --git a/contracts/src/SubstrateTypes.sol b/contracts/src/SubstrateTypes.sol index 4c9b7149b8..5d1f9228d1 100644 --- a/contracts/src/SubstrateTypes.sol +++ b/contracts/src/SubstrateTypes.sol @@ -135,11 +135,13 @@ library SubstrateTypes { } // destination is AccountID32 address - function TransferTokenToAddress32(bytes32 tokenID, ParaID paraID, bytes32 recipient, uint128 xcmFee, uint128 amount) - internal - view - returns (bytes memory) - { + function SendForeignTokenToAddress32( + bytes32 tokenID, + ParaID paraID, + bytes32 recipient, + uint128 xcmFee, + uint128 amount + ) internal view returns (bytes memory) { return bytes.concat( bytes1(0x00), ScaleCodec.encodeU64(uint64(block.chainid)), @@ -154,11 +156,13 @@ library SubstrateTypes { } // destination is AccountID20 address - function TransferTokenToAddress20(bytes32 tokenID, ParaID paraID, bytes20 recipient, uint128 xcmFee, uint128 amount) - internal - view - returns (bytes memory) - { + function SendForeignTokenToAddress20( + bytes32 tokenID, + ParaID paraID, + bytes20 recipient, + uint128 xcmFee, + uint128 amount + ) internal view returns (bytes memory) { return bytes.concat( bytes1(0x00), ScaleCodec.encodeU64(uint64(block.chainid)),