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: ethrex_common::constants::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
13 name: "DEPOSIT_CONTRACT_ADDRESS",
14 active_since_fork: Prague,
15};
16
17pub const BEACON_ROOTS_ADDRESS: SystemContract = SystemContract {
18 address: H160([
19 0x00, 0x0F, 0x3D, 0xF6, 0xD7, 0x32, 0x80, 0x7E, 0xF1, 0x31, 0x9F, 0xB7, 0xB8, 0xBB, 0x85,
20 0x22, 0xD0, 0xBE, 0xAC, 0x02,
21 ]),
22 name: "BEACON_ROOTS_ADDRESS",
23 active_since_fork: Paris,
24};
25
26pub const HISTORY_STORAGE_ADDRESS: SystemContract = SystemContract {
27 address: H160([
28 0x00, 0x00, 0xF9, 0x08, 0x27, 0xF1, 0xC5, 0x3A, 0x10, 0xCB, 0x7A, 0x02, 0x33, 0x5B, 0x17,
29 0x53, 0x20, 0x00, 0x29, 0x35,
30 ]),
31 name: "HISTORY_STORAGE_ADDRESS",
32 active_since_fork: Prague,
33};
34
35pub const WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS: SystemContract = SystemContract {
36 address: H160([
37 0x00, 0x00, 0x09, 0x61, 0xEF, 0x48, 0x0E, 0xB5, 0x5E, 0x80, 0xD1, 0x9A, 0xD8, 0x35, 0x79,
38 0xA6, 0x4C, 0x00, 0x70, 0x02,
39 ]),
40 name: "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS",
41 active_since_fork: Prague,
42};
43
44pub const CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS: SystemContract = SystemContract {
45 address: H160([
46 0x00, 0x00, 0xBB, 0xDD, 0xC7, 0xCE, 0x48, 0x86, 0x42, 0xFB, 0x57, 0x9F, 0x8B, 0x00, 0xF3,
47 0xA5, 0x90, 0x00, 0x72, 0x51,
48 ]),
49 name: "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS",
50 active_since_fork: Prague,
51};
52
53pub const BUILDER_DEPOSIT_CONTRACT_ADDRESS: SystemContract = SystemContract {
56 address: H160([
57 0x00, 0x00, 0xBF, 0xF4, 0x69, 0x84, 0xE3, 0x72, 0x56, 0x91, 0xFA, 0x54, 0x0A, 0x8C, 0x75,
58 0x89, 0x30, 0x0D, 0x82, 0x82,
59 ]),
60 name: "BUILDER_DEPOSIT_CONTRACT_ADDRESS",
61 active_since_fork: Amsterdam,
62};
63
64pub const BUILDER_EXIT_CONTRACT_ADDRESS: SystemContract = SystemContract {
67 address: H160([
68 0x00, 0x00, 0x64, 0xD6, 0x78, 0x50, 0x5A, 0xD4, 0x8F, 0x8C, 0xCB, 0x09, 0x3B, 0xC6, 0x56,
69 0x13, 0x80, 0x0E, 0x82, 0x82,
70 ]),
71 name: "BUILDER_EXIT_CONTRACT_ADDRESS",
72 active_since_fork: Amsterdam,
73};
74
75pub const SYSTEM_CONTRACTS: [SystemContract; 7] = [
76 BEACON_ROOTS_ADDRESS,
77 HISTORY_STORAGE_ADDRESS,
78 DEPOSIT_CONTRACT_ADDRESS,
79 WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS,
80 CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS,
81 BUILDER_DEPOSIT_CONTRACT_ADDRESS,
82 BUILDER_EXIT_CONTRACT_ADDRESS,
83];
84
85pub fn system_contracts_for_fork(fork: Fork) -> impl Iterator<Item = SystemContract> {
86 SYSTEM_CONTRACTS
87 .into_iter()
88 .filter(move |system_contract| system_contract.active_since_fork <= fork)
89}
90
91pub const PRAGUE_SYSTEM_CONTRACTS: [SystemContract; 2] = [
92 WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS,
93 CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS,
94];
95
96pub const AMSTERDAM_REQUEST_PREDEPLOYS: [SystemContract; 2] = [
100 BUILDER_DEPOSIT_CONTRACT_ADDRESS,
101 BUILDER_EXIT_CONTRACT_ADDRESS,
102];
103
104pub const EXPIRY_VERIFIER_PREDEPLOY: SystemContract = SystemContract {
105 address: H160([
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x81, 0x41,
108 ]),
109 name: "EXPIRY_VERIFIER_PREDEPLOY",
110 active_since_fork: Hegota,
111};
112
113pub const EXPIRY_VERIFIER_RUNTIME_BYTECODE: [u8; 26] = [
116 0x60, 0x08, 0x36, 0x14, 0x60, 0x0a, 0x57, 0x5f, 0x5f, 0xfd, 0x5b, 0x5f, 0x35, 0x60, 0xc0, 0x1c,
117 0x42, 0x11, 0x60, 0x16, 0x57, 0x00, 0x5b, 0x5f, 0x5f, 0xfd,
118];