anychain_ethereum/network/
huobi_eco_testnet.rs

1use crate::network::EthereumNetwork;
2use anychain_core::{Network, NetworkError};
3
4use serde::Serialize;
5use std::{fmt, str::FromStr};
6
7/// Represents a HECO testnet
8#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
9pub struct HuobiEcoTestnet;
10
11impl Network for HuobiEcoTestnet {
12    const NAME: &'static str = "huobi eco testnet";
13}
14
15impl EthereumNetwork for HuobiEcoTestnet {
16    const CHAIN_ID: u32 = 256;
17    const NETWORK_ID: u32 = 256;
18}
19
20impl FromStr for HuobiEcoTestnet {
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 HuobiEcoTestnet {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        write!(f, "{}", Self::NAME)
34    }
35}