1use ethrex_common::{H160, types::Fork, types::Fork::*};
2
3pub use ethrex_common::constants::SYSTEM_ADDRESS;
4
5pub struct SystemContract {
6 pub address: H160,
7 pub name: &'static str,
8 pub active_since_fork: Fork,
9}
10
11pub const DEPOSIT_CONTRACT_ADDRESS: SystemContract = SystemContract {
12 address: H160([
13 0x00, 0x00, 0x00, 0x00, 0x21, 0x9A, 0xB5, 0x40, 0x35, 0x6C, 0xBB, 0x83, 0x9C, 0xBE, 0x05,
14 0x30, 0x3D, 0x77, 0x05, 0xFA,
15 ]),
16 name: "DEPOSIT_CONTRACT_ADDRESS",
17 active_since_fork: Prague,
18};
19
20pub const BEACON_ROOTS_ADDRESS: SystemContract = SystemContract {
21 address: H160([
22 0x00, 0x0F, 0x3D, 0xF6, 0xD7, 0x32, 0x80, 0x7E, 0xF1, 0x31, 0x9F, 0xB7, 0xB8, 0xBB, 0x85,
23 0x22, 0xD0, 0xBE, 0xAC, 0x02,
24 ]),
25 name: "BEACON_ROOTS_ADDRESS",
26 active_since_fork: Paris,
27};
28
29pub const HISTORY_STORAGE_ADDRESS: SystemContract = SystemContract {
30 address: H160([
31 0x00, 0x00, 0xF9, 0x08, 0x27, 0xF1, 0xC5, 0x3A, 0x10, 0xCB, 0x7A, 0x02, 0x33, 0x5B, 0x17,
32 0x53, 0x20, 0x00, 0x29, 0x35,
33 ]),
34 name: "HISTORY_STORAGE_ADDRESS",
35 active_since_fork: Prague,
36};
37
38pub const WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS: SystemContract = SystemContract {
39 address: H160([
40 0x00, 0x00, 0x09, 0x61, 0xEF, 0x48, 0x0E, 0xB5, 0x5E, 0x80, 0xD1, 0x9A, 0xD8, 0x35, 0x79,
41 0xA6, 0x4C, 0x00, 0x70, 0x02,
42 ]),
43 name: "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS",
44 active_since_fork: Prague,
45};
46
47pub const CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS: SystemContract = SystemContract {
48 address: H160([
49 0x00, 0x00, 0xBB, 0xDD, 0xC7, 0xCE, 0x48, 0x86, 0x42, 0xFB, 0x57, 0x9F, 0x8B, 0x00, 0xF3,
50 0xA5, 0x90, 0x00, 0x72, 0x51,
51 ]),
52 name: "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS",
53 active_since_fork: Prague,
54};
55
56pub const SYSTEM_CONTRACTS: [SystemContract; 5] = [
57 BEACON_ROOTS_ADDRESS,
58 HISTORY_STORAGE_ADDRESS,
59 DEPOSIT_CONTRACT_ADDRESS,
60 WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS,
61 CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS,
62];
63
64pub fn system_contracts_for_fork(fork: Fork) -> impl Iterator<Item = SystemContract> {
65 SYSTEM_CONTRACTS
66 .into_iter()
67 .filter(move |system_contract| system_contract.active_since_fork <= fork)
68}
69
70pub const PRAGUE_SYSTEM_CONTRACTS: [SystemContract; 2] = [
71 WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS,
72 CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS,
73];