-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathIL1MessageQueueV2.sol
More file actions
116 lines (97 loc) · 4.93 KB
/
Copy pathIL1MessageQueueV2.sol
File metadata and controls
116 lines (97 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IL1MessageQueueV2 {
/**********
* Events *
**********/
/// @notice Emitted when a new L1 => L2 transaction is appended to the queue.
/// @param sender The address of the sender account on L2.
/// @param target The address of the target account on L2.
/// @param value The ETH value transferred to the target account on L2.
/// @param queueIndex The index of this transaction in the message queue.
/// @param gasLimit The gas limit used on L2.
/// @param data The calldata passed to the target account on L2.
event QueueTransaction(
address indexed sender,
address indexed target,
uint256 value,
uint64 queueIndex,
uint256 gasLimit,
bytes data
);
/// @notice Emitted when some L1 => L2 transactions are finalized on L1.
/// @param finalizedIndex The index of the last message finalized.
event FinalizedDequeuedTransaction(uint256 finalizedIndex);
/*************************
* Public View Functions *
*************************/
/// @notice Return the start index of all messages in this contract.
function firstCrossDomainMessageIndex() external view returns (uint256);
/// @notice Return the start index of all unfinalized messages.
function nextUnfinalizedQueueIndex() external view returns (uint256);
/// @notice Return the index to be used for the next message.
/// @dev Also the total number of appended messages, including messages in `L1MessageQueueV1`.
function nextCrossDomainMessageIndex() external view returns (uint256);
/// @notice Return the message rolling hash of `queueIndex`.
/// @param queueIndex The index to query.
function getMessageRollingHash(uint256 queueIndex) external view returns (bytes32);
/// @notice Return the message enqueue timestamp of `queueIndex`.
/// @param queueIndex The index to query.
function getMessageEnqueueTimestamp(uint256 queueIndex) external view returns (uint256);
/// @notice Return the first unfinalized message enqueue timestamp.
function getFirstUnfinalizedMessageEnqueueTime() external view returns (uint256);
/// @notice Return the amount of ETH that should be paid for a cross-domain message.
/// @param gasLimit The gas limit required to complete the message relay on L2.
function estimateCrossDomainMessageFee(uint256 gasLimit) external view returns (uint256);
/// @notice Return the estimated base fee on L2.
function estimateL2BaseFee() external view returns (uint256);
/// @notice Return the intrinsic gas required by the provided cross-domain message.
/// @param data The calldata of the cross-domain message.
function calculateIntrinsicGasFee(bytes calldata data) external view returns (uint256);
/// @notice Compute the transaction hash of an L1 message.
/// @param sender The address of the sender account.
/// @param queueIndex The index of this transaction in the message queue.
/// @param value The ETH value transferred to the target account.
/// @param target The address of the target account.
/// @param gasLimit The gas limit provided.
/// @param data The calldata passed to the target account.
function computeTransactionHash(
address sender,
uint256 queueIndex,
uint256 value,
address target,
uint256 gasLimit,
bytes calldata data
) external view returns (bytes32);
/*****************************
* Public Mutating Functions *
*****************************/
/// @notice Append a L1 => L2 cross-domain message to the message queue.
/// @param target The address of the target account on L2.
/// @param gasLimit The gas limit used on L2.
/// @param data The calldata passed to the target account on L2.
/// @dev This function can only be called by `L1ScrollMessenger`.
function appendCrossDomainMessage(
address target,
uint256 gasLimit,
bytes calldata data
) external;
/// @notice Append an enforced transaction to the message queue.
/// @param sender The address of the sender account on L2.
/// @param target The address of the target account on L2.
/// @param value The ETH value transferred to the target account on L2.
/// @param gasLimit The gas limit used on L2.
/// @param data The calldata passed to the target account on L2.
/// @dev This function can only be called by `EnforcedTxGateway`.
function appendEnforcedTransaction(
address sender,
address target,
uint256 value,
uint256 gasLimit,
bytes calldata data
) external;
/// @notice Mark cross-domain messages as finalized.
/// @param nextUnfinalizedQueueIndex The index of the first unfinalized message after this call.
/// @dev This function can only be called by `ScrollChain`.
function finalizePoppedCrossDomainMessage(uint256 nextUnfinalizedQueueIndex) external;
}