Created
December 8, 2023 10:14
-
-
Save yann300/e8254273e7805e67a91635cb2d6a561c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
// End consumer library. | |
library Client { | |
/// @dev RMN depends on this struct, if changing, please notify the RMN maintainers. | |
struct EVMTokenAmount { | |
address token; // token address on the local chain. | |
uint256 amount; // Amount of tokens. | |
} | |
struct Any2EVMMessage { | |
bytes32 messageId; // MessageId corresponding to ccipSend on source. | |
uint64 sourceChainSelector; // Source chain selector. | |
bytes sender; // abi.decode(sender) if coming from an EVM chain. | |
bytes data; // payload sent in original message. | |
EVMTokenAmount[] destTokenAmounts; // Tokens and their amounts in their destination chain representation. | |
} | |
// If extraArgs is empty bytes, the default is 200k gas limit. | |
struct EVM2AnyMessage { | |
bytes receiver; // abi.encode(receiver address) for dest EVM chains | |
bytes data; // Data payload | |
EVMTokenAmount[] tokenAmounts; // Token transfers | |
address feeToken; // Address of feeToken. address(0) means you will send msg.value. | |
bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV1) | |
} | |
// bytes4(keccak256("CCIP EVMExtraArgsV1")); | |
bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9; | |
struct EVMExtraArgsV1 { | |
uint256 gasLimit; | |
} | |
function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { | |
return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment