-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40422dc
commit 443fd53
Showing
3 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::network::EthereumNetwork; | ||
use anychain_core::{Network, NetworkError}; | ||
|
||
use serde::Serialize; | ||
use std::{fmt, str::FromStr}; | ||
|
||
/// Represents an ETH mainnet | ||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] | ||
pub struct OptimismGoerli; | ||
|
||
impl Network for OptimismGoerli { | ||
const NAME: &'static str = "optimism goerli"; | ||
} | ||
|
||
impl EthereumNetwork for OptimismGoerli { | ||
const CHAIN_ID: u32 = 420; | ||
const NETWORK_ID: u32 = 420; | ||
} | ||
|
||
impl FromStr for OptimismGoerli { | ||
type Err = NetworkError; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
Self::NAME => Ok(Self), | ||
_ => Err(NetworkError::InvalidNetwork(s.into())), | ||
} | ||
} | ||
} | ||
|
||
impl fmt::Display for OptimismGoerli { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}", Self::NAME) | ||
} | ||
} |