1use crate::space::Space;
2use rlp_derive::{RlpDecodable, RlpEncodable};
3
4#[derive(
5 Default, Copy, Clone, Debug, Eq, PartialEq, RlpEncodable, RlpDecodable,
6)]
7pub struct AllChainID {
8 native: u32,
9 ethereum: u32,
10}
11
12impl AllChainID {
13 pub fn new(native: u32, ethereum: u32) -> Self { Self { native, ethereum } }
14
15 pub fn fake_for_virtual(chain_id: u32) -> Self {
16 Self {
17 native: chain_id,
18 ethereum: chain_id,
19 }
20 }
21
22 pub fn in_space(&self, space: Space) -> u32 {
23 match space {
24 Space::Native => self.native,
25 Space::Ethereum => self.ethereum,
26 }
27 }
28
29 pub fn in_native_space(&self) -> u32 { self.in_space(Space::Native) }
30
31 pub fn in_evm_space(&self) -> u32 { self.in_space(Space::Ethereum) }
32}