Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
feat(ethers-core/Chain): implement Default trait (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
meetmangukiya authored Feb 28, 2022
1 parent e0f5fe5 commit 4fd9c78
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Deserialize;
use thiserror::Error;

use core::convert::TryFrom;
use std::{fmt, str::FromStr};
use std::{default, fmt, str::FromStr};

use crate::types::U256;

Expand Down Expand Up @@ -177,3 +177,14 @@ impl Chain {
)
}
}

impl default::Default for Chain {
fn default() -> Self {
Chain::Mainnet
}
}

#[test]
fn test_default_chain() {
assert_eq!(Chain::default(), Chain::Mainnet);
}

0 comments on commit 4fd9c78

Please sign in to comment.