Skip to content

Commit f766fb7

Browse files
committed
evm: Base Bridge request
1 parent 3e24f77 commit f766fb7

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@ bytes4 prefix = "ERC2" // 4-byte prefix for this struct
313313
uint8 autoDiscover // Currently, must be one.
314314
```
315315

316+
##### Base Bridge Request
317+
318+
[Base Bridge](https://github.com/base/bridge)
319+
320+
```solidity
321+
bytes4 prefix = "ERB1" // 4-byte prefix for this struct
322+
uint8 autoDiscover // Currently, must be one.
323+
```
324+
316325
#### Relay Instructions
317326

318327
##### Gas Instruction

evm/src/libraries/ExecutorMessages.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ library ExecutorMessages {
66
bytes4 private constant REQ_NTT_V1 = "ERN1";
77
bytes4 private constant REQ_CCTP_V1 = "ERC1";
88
bytes4 private constant REQ_CCTP_V2 = "ERC2";
9+
bytes4 private constant REQ_BASE_V1 = "ERB1";
910

1011
/// @notice Payload length will not fit in a uint32.
1112
/// @dev Selector: 492f620d.
@@ -52,4 +53,12 @@ library ExecutorMessages {
5253
function makeCCTPv2Request() internal pure returns (bytes memory) {
5354
return abi.encodePacked(REQ_CCTP_V2, uint8(1));
5455
}
56+
57+
/// @notice Encodes a version 1 Base Bridge request payload.
58+
/// This request currently assumes the Executor will auto detect the event off chain.
59+
/// That may change in the future, in which case this interface would change.
60+
/// @return bytes The encoded request.
61+
function makeBaseBridgeV1Request() internal pure returns (bytes memory) {
62+
return abi.encodePacked(REQ_BASE_V1, uint8(1));
63+
}
5564
}

evm/test/ExecutorMessages.t.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ contract ExecutorMessagesTest is Test {
3535
bytes memory buf = ExecutorMessages.makeCCTPv2Request();
3636
assertEq(keccak256(expected), keccak256(buf));
3737
}
38+
39+
function test_makeBaseBridgeV1Request() public pure {
40+
bytes memory expected = abi.encodePacked("ERB1", uint8(1));
41+
bytes memory buf = ExecutorMessages.makeBaseBridgeV1Request();
42+
assertEq(keccak256(expected), keccak256(buf));
43+
}
3844
}

0 commit comments

Comments
 (0)