From 50c7ff1d8eb93bb31de47ad0a323afe25abdd739 Mon Sep 17 00:00:00 2001 From: Alejandro Banzas Date: Mon, 31 Oct 2022 17:01:34 +0100 Subject: [PATCH] adding chiado support (#1811) --- ethers-contract/src/multicall/mod.rs | 1 + ethers-core/src/types/chain.rs | 8 ++++++++ ethers-etherscan/src/lib.rs | 1 + 3 files changed, 10 insertions(+) diff --git a/ethers-contract/src/multicall/mod.rs b/ethers-contract/src/multicall/mod.rs index be81bc2d..e120a87f 100644 --- a/ethers-contract/src/multicall/mod.rs +++ b/ethers-contract/src/multicall/mod.rs @@ -47,6 +47,7 @@ pub static MULTICALL_SUPPORTED_CHAIN_IDS: Lazy<[U256; 47]> = Lazy::new(|| { U256::from(Polygon), // Polygon U256::from(PolygonMumbai), // PolygonMumbai U256::from(XDai), // XDai + U256::from(Chiado), // ChiadoTestnet U256::from(Avalanche), // Avalanche U256::from(AvalancheFuji), // AvalancheFuji U256::from(FantomTestnet), // FantomTestnet diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 4645b890..0b127aa5 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -32,6 +32,7 @@ pub enum Chain { Kovan = 42, #[strum(serialize = "xdai")] XDai = 100, + Chiado = 10200, Polygon = 137, Fantom = 250, Dev = 1337, @@ -103,6 +104,7 @@ impl Chain { Chain::Goerli | Chain::Kovan | Chain::XDai | + Chain::Chiado | Chain::Sepolia | Chain::Moonbase | Chain::MoonbeamDev | @@ -186,6 +188,9 @@ impl Chain { Chain::XDai => { ("https://blockscout.com/xdai/mainnet/api", "https://blockscout.com/xdai/mainnet") } + Chain::Chiado => { + ("https://blockscout.chiadochain.net/api", "https://blockscout.chiadochain.net") + } Chain::Sokol => { ("https://blockscout.com/poa/sokol/api", "https://blockscout.com/poa/sokol") } @@ -230,6 +235,7 @@ impl fmt::Display for Chain { Chain::Goerli => "goerli", Chain::Kovan => "kovan", Chain::XDai => "xdai", + Chain::Chiado => "chiado", Chain::Polygon => "polygon", Chain::PolygonMumbai => "mumbai", Chain::Avalanche => "avalanche", @@ -299,6 +305,7 @@ impl TryFrom for Chain { 5 => Chain::Goerli, 42 => Chain::Kovan, 100 => Chain::XDai, + 10200 => Chain::Chiado, 137 => Chain::Polygon, 1337 => Chain::Dev, 31337 => Chain::AnvilHardhat, @@ -359,6 +366,7 @@ impl FromStr for Chain { "goerli" => Chain::Goerli, "kovan" => Chain::Kovan, "xdai" => Chain::XDai, + "chiado" => Chain::Chiado, "polygon" => Chain::Polygon, "mumbai" | "polygon-mumbai" => Chain::PolygonMumbai, "avalanche" => Chain::Avalanche, diff --git a/ethers-etherscan/src/lib.rs b/ethers-etherscan/src/lib.rs index 4df3ebf2..9bd36992 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -103,6 +103,7 @@ impl Client { std::env::var("FTMSCAN_API_KEY").or_else(|_| std::env::var("FANTOMSCAN_API_KEY"))? } Chain::XDai | + Chain::Chiado | Chain::Sepolia | Chain::Rsk | Chain::Sokol |