diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index f4069eb8..6bcbdd56 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -21,6 +21,8 @@ pub enum Chain { Kovan = 42, XDai = 100, Polygon = 137, + Fantom = 250, + FantomTestnet = 4002, PolygonMumbai = 80001, Avalanche = 43114, AvalancheFuji = 43113, @@ -102,6 +104,8 @@ impl FromStr for Chain { "moonriver" => Chain::Moonriver, "optimism" => Chain::Optimism, "optimism-kovan" => Chain::OptimismKovan, + "fantom" => Chain::Fantom, + "fantom-testnet" => Chain::FantomTestnet, _ => return Err(ParseChainError(chain.to_owned())), }) } diff --git a/ethers-etherscan/src/lib.rs b/ethers-etherscan/src/lib.rs index ab075a93..341b855b 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -66,6 +66,13 @@ impl Client { Url::parse("https://api-kovan-optimistic.etherscan.io/api"), Url::parse("https://kovan-optimistic.etherscan.io"), ), + Chain::Fantom => { + (Url::parse("https://api.ftmscan.com"), Url::parse("https://ftmscan.com")) + } + Chain::FantomTestnet => ( + Url::parse("https://api-testnet.ftmscan.com"), + Url::parse("https://testnet.ftmscan.com"), + ), chain => return Err(EtherscanError::ChainNotSupported(chain)), }; @@ -89,7 +96,9 @@ impl Client { Chain::Rinkeby | Chain::Goerli | Chain::Optimism | - Chain::OptimismKovan => std::env::var("ETHERSCAN_API_KEY")?, + Chain::OptimismKovan | + Chain::Fantom | + Chain::FantomTestnet => std::env::var("ETHERSCAN_API_KEY")?, Chain::XDai | Chain::Sepolia => String::default(), Chain::Moonbeam | Chain::MoonbeamDev | Chain::Moonriver => {