This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Showing
6 changed files
with
89 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::fmt; | ||
|
||
use crate::types::U256; | ||
|
||
#[derive(Debug)] | ||
pub enum Chain { | ||
Mainnet, | ||
Ropsten, | ||
Rinkeby, | ||
Goerli, | ||
Kovan, | ||
XDai, | ||
} | ||
|
||
impl fmt::Display for Chain { | ||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | ||
write!(formatter, "{:?}", self) | ||
} | ||
} | ||
|
||
impl From<Chain> for u32 { | ||
fn from(chain: Chain) -> Self { | ||
match chain { | ||
Chain::Mainnet => 1, | ||
Chain::Ropsten => 3, | ||
Chain::Rinkeby => 4, | ||
Chain::Goerli => 5, | ||
Chain::Kovan => 42, | ||
Chain::XDai => 100, | ||
} | ||
} | ||
} | ||
|
||
impl From<Chain> for U256 { | ||
fn from(chain: Chain) -> Self { | ||
u32::from(chain).into() | ||
} | ||
} |
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 |
---|---|---|
|
@@ -48,5 +48,9 @@ pub use txpool::*; | |
mod trace; | ||
pub use trace::*; | ||
|
||
mod chain; | ||
pub use chain::*; | ||
|
||
mod proof; | ||
|
||
pub use proof::*; |
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