-
Notifications
You must be signed in to change notification settings - Fork 20
/
IL1BlockContainer.sol
63 lines (51 loc) · 2.21 KB
/
IL1BlockContainer.sol
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IL1BlockContainer {
/**********
* Events *
**********/
/// @notice Emitted when a block is imported.
/// @param blockHash The hash of the imported block.
/// @param blockHeight The height of the imported block.
/// @param blockTimestamp The timestamp of the imported block.
/// @param baseFee The base fee of the imported block.
/// @param stateRoot The state root of the imported block.
event ImportBlock(
bytes32 indexed blockHash,
uint256 blockHeight,
uint256 blockTimestamp,
uint256 baseFee,
bytes32 stateRoot
);
/*************************
* Public View Functions *
*************************/
/// @notice Return the latest imported block hash
function latestBlockHash() external view returns (bytes32);
/// @notice Return the latest imported L1 base fee
function latestBaseFee() external view returns (uint256);
/// @notice Return the latest imported block number
function latestBlockNumber() external view returns (uint256);
/// @notice Return the latest imported block timestamp
function latestBlockTimestamp() external view returns (uint256);
/// @notice Return the state root of given block.
/// @param blockHash The block hash to query.
/// @return stateRoot The state root of the block.
function getStateRoot(bytes32 blockHash) external view returns (bytes32 stateRoot);
/// @notice Return the block timestamp of given block.
/// @param blockHash The block hash to query.
/// @return timestamp The corresponding block timestamp.
function getBlockTimestamp(bytes32 blockHash) external view returns (uint256 timestamp);
/*****************************
* Public Mutating Functions *
*****************************/
/// @notice Import L1 block header to this contract.
/// @param blockHash The hash of block.
/// @param blockHeaderRLP The RLP encoding of L1 block.
/// @param updateGasPriceOracle Whether to update gas price oracle.
function importBlockHeader(
bytes32 blockHash,
bytes calldata blockHeaderRLP,
bool updateGasPriceOracle
) external;
}