@@ -20,6 +20,17 @@ contract Passage {
20
20
/// @param amount - The amount of Ether entering the rollup.
21
21
event Enter (uint256 indexed rollupChainId , address indexed rollupRecipient , uint256 amount );
22
22
23
+ /// @notice Emitted to send a special transaction to the rollup.
24
+ event Transact (
25
+ uint256 indexed rollupChainId ,
26
+ address indexed sender ,
27
+ address indexed to ,
28
+ bytes data ,
29
+ uint256 value ,
30
+ uint256 gas ,
31
+ uint256 maxFeePerGas
32
+ );
33
+
23
34
/// @notice Emitted when the admin withdraws tokens from the contract.
24
35
event Withdrawal (address indexed token , address indexed recipient , uint256 amount );
25
36
@@ -45,15 +56,64 @@ contract Passage {
45
56
/// @param rollupRecipient - The recipient of the Ether on the rollup.
46
57
/// @custom:emits Enter indicating the amount of Ether to mint on the rollup & its recipient.
47
58
function enter (uint256 rollupChainId , address rollupRecipient ) public payable {
59
+ if (msg .value == 0 ) return ;
48
60
emit Enter (rollupChainId, rollupRecipient, msg .value );
49
61
}
50
62
51
63
/// @notice Allows native Ether to enter the default rollup.
52
- /// @dev see `enter` above for docs.
64
+ /// @dev see `enter` for docs.
53
65
function enter (address rollupRecipient ) external payable {
54
66
enter (defaultRollupChainId, rollupRecipient);
55
67
}
56
68
69
+ /// @notice Allows a special transaction to be sent to the rollup with sender == L1 msg.sender.
70
+ /// @dev Transaction is processed after normal rollup block execution.
71
+ /// @dev See `enterTransact` for docs.
72
+ function transact (
73
+ uint256 rollupChainId ,
74
+ address to ,
75
+ bytes calldata data ,
76
+ uint256 value ,
77
+ uint256 gas ,
78
+ uint256 maxFeePerGas
79
+ ) public payable {
80
+ enterTransact (rollupChainId, msg .sender , to, data, value, gas, maxFeePerGas);
81
+ }
82
+
83
+ /// @dev See `transact` for docs.
84
+ function transact (address to , bytes calldata data , uint256 value , uint256 gas , uint256 maxFeePerGas )
85
+ external
86
+ payable
87
+ {
88
+ enterTransact (defaultRollupChainId, msg .sender , to, data, value, gas, maxFeePerGas);
89
+ }
90
+
91
+ /// @notice Send Ether on the rollup, send a special transaction to be sent to the rollup with sender == L1 msg.sender.
92
+ /// @dev Enter and Transact are processed after normal rollup block execution.
93
+ /// @dev See `enter` for Enter docs.
94
+ /// @param rollupChainId - The rollup chain to send the transaction to.
95
+ /// @param etherRecipient - The recipient of the ether.
96
+ /// @param to - The address to call on the rollup.
97
+ /// @param data - The data to send to the rollup.
98
+ /// @param value - The amount of Ether to send on the rollup.
99
+ /// @param gas - The gas limit for the transaction.
100
+ /// @param maxFeePerGas - The maximum fee per gas for the transaction (per EIP-1559).
101
+ /// @custom:emits Transact indicating the transaction to mine on the rollup.
102
+ function enterTransact (
103
+ uint256 rollupChainId ,
104
+ address etherRecipient ,
105
+ address to ,
106
+ bytes calldata data ,
107
+ uint256 value ,
108
+ uint256 gas ,
109
+ uint256 maxFeePerGas
110
+ ) public payable {
111
+ // if msg.value is attached, Enter
112
+ enter (rollupChainId, etherRecipient);
113
+ // emit Transact event
114
+ emit Transact (rollupChainId, msg .sender , to, data, value, gas, maxFeePerGas);
115
+ }
116
+
57
117
/// @notice Allows the admin to withdraw ETH or ERC20 tokens from the contract.
58
118
/// @dev Only the admin can call this function.
59
119
function withdraw (address token , address recipient , uint256 amount ) external {
0 commit comments