Skip to content

Commit b691ee2

Browse files
committed
WIP: feat: transact flow
1 parent 5d70919 commit b691ee2

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/Passage.sol

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ contract Passage {
2121
/// @param amount - The amount of the token entering the rollup.
2222
event Enter(uint256 indexed rollupChainId, address indexed token, address indexed rollupRecipient, uint256 amount);
2323

24+
/// @notice Emitted to send a special transaction to the rollup.
25+
event Transact(
26+
uint256 indexed rollupChainId,
27+
address indexed sender,
28+
address indexed to,
29+
bytes data,
30+
uint256 value,
31+
uint256 gas,
32+
uint256 maxPrioFee,
33+
uint256 maxBaseFee
34+
);
35+
2436
/// @notice Emitted when the admin withdraws tokens from the contract.
2537
event Withdrawal(address indexed token, address indexed recipient, uint256 amount);
2638

@@ -56,6 +68,40 @@ contract Passage {
5668
emit Enter(rollupChainId, address(0), rollupRecipient, msg.value);
5769
}
5870

71+
/// @notice Allows a special transaction to be sent to the rollup with sender == L1 msg.sender.
72+
/// @dev Transaction is processed after normal rollup block execution.
73+
/// @param rollupChainId - The rollup chain to send the transaction to.
74+
/// @param to - The address to call on the rollup.
75+
/// @param data - The data to send to the rollup.
76+
/// @param value - The amount of Ether to send on the rollup.
77+
/// @param gas - The gas limit for the transaction.
78+
/// @param maxPrioFee - The maximum priority fee for the transaction.
79+
/// @param maxBaseFee - The maximum base fee for the transaction.
80+
/// @custom:emits Transact indicating the transaction to mine on the rollup.
81+
function transact(
82+
uint256 rollupChainId,
83+
address to,
84+
bytes calldata data,
85+
uint256 value,
86+
uint256 gas,
87+
uint256 maxPrioFee,
88+
uint256 maxBaseFee
89+
) public {
90+
emit Transact(rollupChainId, msg.sender, to, data, value, gas, maxPrioFee, maxBaseFee);
91+
}
92+
93+
/// @dev See `transact` above for docs.
94+
function transact(
95+
address to,
96+
bytes calldata data,
97+
uint256 value,
98+
uint256 gas,
99+
uint256 maxPrioFee,
100+
uint256 maxBaseFee
101+
) external {
102+
transact(defaultRollupChainId, to, data, value, gas, maxPrioFee, maxBaseFee);
103+
}
104+
59105
/// @notice Allows the admin to withdraw ETH or ERC20 tokens from the contract.
60106
/// @dev Only the admin can call this function.
61107
function withdraw(address token, address recipient, uint256 amount) external {

0 commit comments

Comments
 (0)