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

feat(core): Utility to detect Shanghai-enabled chains #2431

Merged
merged 3 commits into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@ impl Chain {
}
}

/// Returns whether the chain supports the `PUSH0` opcode or not.
///
/// For more information, see EIP-3855:
/// `<https://eips.ethereum.org/EIPS/eip-3855>`
pub const fn supports_push0(&self) -> bool {
match self {
Chain::Mainnet | Chain::Goerli | Chain::Sepolia => true,
_ => false,
}
}

/// Returns the chain's blockchain explorer and its API (Etherscan and Etherscan-like) URLs.
///
/// Returns `(API_URL, BASE_URL)`
Expand Down