Skip to content

Commit 087bfa4

Browse files
committed
evm: Add CCTP request
1 parent ba4414b commit 087bfa4

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.cspell/custom-dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Custom Dictionary Words
22
Aptos
3+
CCTP
34
Devnet
45
hashv
56
idls

evm/src/libraries/ExecutorMessages.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ library ExecutorMessages {
55
bytes4 private constant REQ_MM = "ERM1";
66
bytes4 private constant REQ_VAA_V1 = "ERV1";
77
bytes4 private constant REQ_NTT_V1 = "ERN1";
8+
bytes4 private constant REQ_CCTP_V1 = "ERC1";
89

910
/// @notice Payload length will not fit in a uint32.
1011
/// @dev Selector: 492f620d.
@@ -54,4 +55,12 @@ library ExecutorMessages {
5455
{
5556
return abi.encodePacked(REQ_NTT_V1, srcChain, srcManager, messageId);
5657
}
58+
59+
/// @notice Encodes a version 1 CCTP request payload.
60+
/// @param sourceDomain The source chain for the CCTP transfer.
61+
/// @param nonce The nonce of the CCTP transfer.
62+
/// @return bytes The encoded request.
63+
function makeCCTPv1Request(uint32 sourceDomain, uint64 nonce) internal pure returns (bytes memory) {
64+
return abi.encodePacked(REQ_CCTP_V1, sourceDomain, nonce);
65+
}
5766
}

evm/test/ExecutorMessages.t.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@ contract ExecutorMessagesTest is Test {
3838
bytes memory buf = ExecutorMessages.makeNTTv1Request(srcChain, srcManager, messageId);
3939
assertEq(keccak256(expected), keccak256(buf));
4040
}
41+
42+
function test_makeCCTPv1Request() public pure {
43+
uint32 srcDomain = 7;
44+
uint64 nonce = 42;
45+
bytes memory expected = abi.encodePacked("ERC1", srcDomain, nonce);
46+
bytes memory buf = ExecutorMessages.makeCCTPv1Request(srcDomain, nonce);
47+
assertEq(keccak256(expected), keccak256(buf));
48+
}
4149
}

0 commit comments

Comments
 (0)