diff --git a/ethers-contract/ethers-contract-abigen/src/source.rs b/ethers-contract/ethers-contract-abigen/src/source.rs index 0ddda89c..a1189cf3 100644 --- a/ethers-contract/ethers-contract-abigen/src/source.rs +++ b/ethers-contract/ethers-contract-abigen/src/source.rs @@ -349,8 +349,7 @@ mod tests { assert_eq!(parsed, Source::String(src.to_owned())); let hardhat_src = format!( - r#"{{"_format": "hh-sol-artifact-1", "contractName": "Verifier", "sourceName": "contracts/verifier.sol", "abi": {}, "bytecode": "0x", "deployedBytecode": "0x", "linkReferences": {{}}, "deployedLinkReferences": {{}}}}"#, - src, + r#"{{"_format": "hh-sol-artifact-1", "contractName": "Verifier", "sourceName": "contracts/verifier.sol", "abi": {src}, "bytecode": "0x", "deployedBytecode": "0x", "linkReferences": {{}}, "deployedLinkReferences": {{}}}}"#, ); let hardhat_parsed = Source::parse(&hardhat_src).unwrap(); assert_eq!(hardhat_parsed, Source::String(hardhat_src)); diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 5a1f1036..70dd6a10 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -69,6 +69,9 @@ pub enum Chain { Sepolia = 11155111, Aurora = 1313161554, AuroraTestnet = 1313161555, + Celo = 42220, + CeloAlfajores = 44787, + CeloBaklava = 62320, } // === impl Chain === @@ -117,6 +120,9 @@ impl fmt::Display for Chain { Chain::EvmosTestnet => "evmos-testnet", Chain::Aurora => "aurora", Chain::AuroraTestnet => "aurora-testnet", + Chain::Celo => "celo", + Chain::CeloAlfajores => "celo-alfajores", + Chain::CeloBaklava => "celo-baklava", }; f.pad(chain) @@ -195,6 +201,9 @@ impl TryFrom for Chain { 9000 => Chain::EvmosTestnet, 1313161554 => Chain::Aurora, 1313161555 => Chain::AuroraTestnet, + 42220 => Chain::Celo, + 44787 => Chain::CeloAlfajores, + 62320 => Chain::CeloBaklava, _ => return Err(ParseChainError(chain.to_string())), }) } @@ -255,6 +264,9 @@ impl FromStr for Chain { "emerald-testnet" => Chain::EmeraldTestnet, "aurora" => Chain::Aurora, "aurora-testnet" => Chain::AuroraTestnet, + "celo" => Chain::Celo, + "celo-alfajores" => Chain::CeloAlfajores, + "celo-baklava" => Chain::CeloBaklava, _ => return Err(ParseChainError(chain.to_owned())), }) } @@ -293,6 +305,7 @@ impl Chain { Chain::Oasis => 5_500, Chain::Emerald => 6_000, Chain::Dev | Chain::AnvilHardhat => 200, + Chain::Celo | Chain::CeloAlfajores | Chain::CeloBaklava => 5_000, // Explictly handle all network to make it easier not to forget this match when new // networks are added. Chain::Morden | @@ -411,6 +424,15 @@ impl Chain { } Chain::Evmos => ("https://evm.evmos.org/api", "https://evm.evmos.org/"), Chain::EvmosTestnet => ("https://evm.evmos.dev/api", "https://evm.evmos.dev/"), + Chain::Celo => { + ("https://explorer.celo.org/mainnet", "https://explorer.celo.org/mainnet/api") + } + Chain::CeloAlfajores => { + ("https://explorer.celo.org/alfajores", "https://explorer.celo.org/alfajores/api") + } + Chain::CeloBaklava => { + ("https://explorer.celo.org/baklava", "https://explorer.celo.org/baklava/api") + } Chain::AnvilHardhat | Chain::Dev | Chain::Morden | Chain::MoonbeamDev => { // this is explicitly exhaustive so we don't forget to add new urls when adding a // new chain @@ -440,7 +462,10 @@ impl Chain { Chain::Rsk | Chain::Oasis | Chain::Emerald | - Chain::EmeraldTestnet, + Chain::EmeraldTestnet | + Chain::Celo | + Chain::CeloAlfajores | + Chain::CeloBaklava, ) } } diff --git a/ethers-core/src/types/transaction/eip1559.rs b/ethers-core/src/types/transaction/eip1559.rs index ea96da1e..ba080e19 100644 --- a/ethers-core/src/types/transaction/eip1559.rs +++ b/ethers-core/src/types/transaction/eip1559.rs @@ -56,7 +56,7 @@ pub struct Eip1559TransactionRequest { /// Represents the maximum tx fee that will go to the miner as part of the user's /// fee payment. It serves 3 purposes: /// 1. Compensates miners for the uncle/ommer risk + fixed costs of including transaction in a - /// block; + /// block; /// 2. Allows users with high opportunity costs to pay a premium to miners; /// 3. In times where demand exceeds the available block space (i.e. 100% full, 30mm gas), /// this component allows first price auctions (i.e. the pre-1559 fee model) to happen on the diff --git a/ethers-etherscan/src/lib.rs b/ethers-etherscan/src/lib.rs index ce511ad9..9c9930db 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -98,7 +98,10 @@ impl Client { Chain::Cronos | Chain::CronosTestnet | Chain::Aurora | - Chain::AuroraTestnet => std::env::var("ETHERSCAN_API_KEY")?, + Chain::AuroraTestnet | + Chain::Celo | + Chain::CeloAlfajores | + Chain::CeloBaklava => std::env::var("ETHERSCAN_API_KEY")?, Chain::Fantom | Chain::FantomTestnet => { std::env::var("FTMSCAN_API_KEY").or_else(|_| std::env::var("FANTOMSCAN_API_KEY"))? } diff --git a/examples/gas_price_usd.rs b/examples/gas_price_usd.rs index 43e9bb2c..307baf82 100644 --- a/examples/gas_price_usd.rs +++ b/examples/gas_price_usd.rs @@ -39,10 +39,9 @@ async fn main() -> Result<(), Box> { r#" Gas price --------------- - {:>10.2} gwei - {:>10.8} usd - "#, - gwei, usd_per_gas + {gwei:>10.2} gwei + {usd_per_gas:>10.8} usd + "# ); Ok(()) } diff --git a/examples/paginated_logs.rs b/examples/paginated_logs.rs index 573175c3..9f94f9e0 100644 --- a/examples/paginated_logs.rs +++ b/examples/paginated_logs.rs @@ -1,4 +1,4 @@ -use ethers::{abi::AbiDecode, prelude::*, providers::Middleware, utils::keccak256}; +use ethers::{abi::AbiDecode, prelude::*, providers::Middleware}; use eyre::Result; use std::sync::Arc; diff --git a/examples/subscribe_events_by_type.rs b/examples/subscribe_events_by_type.rs index bc917ccb..76e394ac 100644 --- a/examples/subscribe_events_by_type.rs +++ b/examples/subscribe_events_by_type.rs @@ -37,8 +37,8 @@ async fn main() -> Result<(), Box> { // Note that `log` has type AnswerUpdatedFilter while let Some(Ok((log, meta))) = stream.next().await { - println!("{:?}", log); - println!("{:?}", meta) + println!("{log:?}"); + println!("{meta:?}") } Ok(()) diff --git a/examples/subscribe_logs.rs b/examples/subscribe_logs.rs index c85e3728..b8cb1891 100644 --- a/examples/subscribe_logs.rs +++ b/examples/subscribe_logs.rs @@ -1,4 +1,4 @@ -use ethers::{abi::AbiDecode, prelude::*, utils::keccak256}; +use ethers::{abi::AbiDecode, prelude::*}; use eyre::Result; use std::sync::Arc;