anychain_ethereum/network/
ethereum_classic.rs

1use crate::network::EthereumNetwork;
2use anychain_core::{Network, NetworkError};
3
4use serde::Serialize;
5use std::{fmt, str::FromStr};
6
7/// Represents an ETC mainnet
8#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
9pub struct EthereumClassic;
10
11impl Network for EthereumClassic {
12    const NAME: &'static str = "ethereum classic";
13}
14
15impl EthereumNetwork for EthereumClassic {
16    const CHAIN_ID: u32 = 61;
17    const NETWORK_ID: u32 = 61;
18}
19
20impl FromStr for EthereumClassic {
21    type Err = NetworkError;
22
23    fn from_str(s: &str) -> Result<Self, Self::Err> {
24        match s {
25            Self::NAME => Ok(Self),
26            _ => Err(NetworkError::InvalidNetwork(s.into())),
27        }
28    }
29}
30
31impl fmt::Display for EthereumClassic {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        write!(f, "{}", Self::NAME)
34    }
35}