-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathl2_slot_info_v2.rs
More file actions
76 lines (64 loc) · 1.52 KB
/
l2_slot_info_v2.rs
File metadata and controls
76 lines (64 loc) · 1.52 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
use super::l2_slot_info::SlotData;
use alloy::primitives::B256;
pub struct L2SlotContext {
pub info: L2SlotInfoV2,
pub end_of_sequencing: bool,
pub allow_forced_inclusion: bool,
}
#[derive(Debug, Clone)]
pub struct L2SlotInfoV2 {
base_fee: u64,
slot_timestamp: u64,
parent_id: u64,
parent_hash: B256,
parent_gas_limit_without_anchor: u64,
parent_timestamp: u64,
}
impl L2SlotInfoV2 {
pub fn new(
base_fee: u64,
slot_timestamp: u64,
parent_id: u64,
parent_hash: B256,
parent_gas_limit_without_anchor: u64,
parent_timestamp: u64,
) -> Self {
Self {
base_fee,
slot_timestamp,
parent_id,
parent_hash,
parent_gas_limit_without_anchor,
parent_timestamp,
}
}
pub fn base_fee(&self) -> u64 {
self.base_fee
}
pub fn slot_timestamp(&self) -> u64 {
self.slot_timestamp
}
pub fn parent_id(&self) -> u64 {
self.parent_id
}
pub fn parent_hash(&self) -> &B256 {
&self.parent_hash
}
pub fn parent_gas_limit_without_anchor(&self) -> u64 {
self.parent_gas_limit_without_anchor
}
pub fn parent_timestamp(&self) -> u64 {
self.parent_timestamp
}
}
impl SlotData for L2SlotInfoV2 {
fn slot_timestamp(&self) -> u64 {
self.slot_timestamp
}
fn parent_id(&self) -> u64 {
self.parent_id
}
fn parent_hash(&self) -> &B256 {
&self.parent_hash
}
}