axos_primitives/
chain.rs

1use alloc::string::String;
2use alloy_primitives::Address;
3use serde::{Deserialize, Serialize};
4
5use crate::blocks::{BlockInfo, Epoch};
6use crate::system::SystemConfig;
7
8mod base;
9mod optimism;
10
11/// A Chain Configuration
12#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
13pub struct ChainConfig {
14    /// The network name
15    pub network: String,
16    /// The L1 chain id
17    pub l1_chain_id: u64,
18    /// The L2 chain id
19    pub l2_chain_id: u64,
20    /// The L1 block referenced by the L2 chain
21    pub l1_start_epoch: Epoch,
22    /// The L2 genesis block info
23    pub l2_genesis: BlockInfo,
24    /// The initial system config value
25    pub system_config: SystemConfig,
26    /// The batch inbox address
27    pub batch_inbox: Address,
28    /// The deposit contract address
29    pub deposit_contract: Address,
30    /// The L1 system config contract
31    pub system_config_contract: Address,
32    /// The maximum byte size of all pending channels
33    pub max_channel_size: u64,
34    /// The max timeout for a channel (as measured by the frame L1 block number)
35    pub channel_timeout: u64,
36    /// Number of L1 blocks in a sequence window
37    pub seq_window_size: u64,
38    /// Maximum timestamp drift
39    pub max_seq_drift: u64,
40    /// Timestamp of the regolith hardfork
41    pub regolith_time: u64,
42    /// Network blocktime
43    #[serde(default = "default_blocktime")]
44    pub blocktime: u64,
45    /// L2 To L1 Message passer address
46    pub l2_to_l1_message_passer: Address,
47}
48
49fn default_blocktime() -> u64 {
50    2
51}