-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from 0xcregis/153-feat-anychain-ethereum-base…
…-chain feat: anychain-ethereum BASE chain
- Loading branch information
Showing
13 changed files
with
86 additions
and
10 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
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 BASE mainnet | ||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] | ||
pub struct Base; | ||
|
||
impl Network for Base { | ||
const NAME: &'static str = "base"; | ||
} | ||
|
||
impl EthereumNetwork for Base { | ||
const CHAIN_ID: u32 = 8453; | ||
const NETWORK_ID: u32 = 8453; | ||
} | ||
|
||
impl FromStr for Base { | ||
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 Base { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}", Self::NAME) | ||
} | ||
} |
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 BASE testnet | ||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] | ||
pub struct BaseGoerli; | ||
|
||
impl Network for BaseGoerli { | ||
const NAME: &'static str = "base goerli"; | ||
} | ||
|
||
impl EthereumNetwork for BaseGoerli { | ||
const CHAIN_ID: u32 = 84531; | ||
const NETWORK_ID: u32 = 84531; | ||
} | ||
|
||
impl FromStr for BaseGoerli { | ||
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 BaseGoerli { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}", Self::NAME) | ||
} | ||
} |
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
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