From 0645f4502ca8dae643019ccc3383c56069415c68 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 7 Oct 2022 17:58:32 +0200 Subject: [PATCH] chore: replace rinkeby with goerli (#1768) * chore: replace rinkeby with goerli * ignore example --- .github/workflows/ci.yml | 2 +- ethers-middleware/tests/nonce_manager.rs | 4 ++-- ethers-middleware/tests/signer.rs | 10 +++++----- ethers-providers/src/lib.rs | 6 ++---- ethers-providers/tests/provider.rs | 8 ++++---- examples/remove_liquidity.rs | 9 +++++---- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4245a60d..bb2a143a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ name: Tests env: ETHERSCAN_API_KEY_ETHEREUM: I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB ETHERSCAN_API_KEY_CELO: B13XSMUT6Q3Q4WZ5DNQR8RXDBA2KNTMT4M - RINKEBY_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2" + GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2" jobs: tests: diff --git a/ethers-middleware/tests/nonce_manager.rs b/ethers-middleware/tests/nonce_manager.rs index 31e36909..ce7bac22 100644 --- a/ethers-middleware/tests/nonce_manager.rs +++ b/ethers-middleware/tests/nonce_manager.rs @@ -8,10 +8,10 @@ async fn nonce_manager() { use ethers_signers::{LocalWallet, Signer}; use std::time::Duration; - let provider = ethers_providers::RINKEBY.provider().interval(Duration::from_millis(2000u64)); + let provider = ethers_providers::GOERLI.provider().interval(Duration::from_millis(2000u64)); let chain_id = provider.get_chainid().await.unwrap().as_u64(); - let wallet = std::env::var("RINKEBY_PRIVATE_KEY") + let wallet = std::env::var("GOERLI_PRIVATE_KEY") .unwrap() .parse::() .unwrap() diff --git a/ethers-middleware/tests/signer.rs b/ethers-middleware/tests/signer.rs index 3929e7c5..d941f289 100644 --- a/ethers-middleware/tests/signer.rs +++ b/ethers-middleware/tests/signer.rs @@ -1,5 +1,5 @@ #![allow(unused)] -use ethers_providers::{Http, JsonRpcClient, Middleware, Provider, RINKEBY}; +use ethers_providers::{Http, JsonRpcClient, Middleware, Provider, GOERLI}; use ethers_core::{ types::{BlockNumber, TransactionRequest}, @@ -87,7 +87,7 @@ async fn send_with_chain_id_anvil() { #[tokio::test] #[cfg(not(feature = "celo"))] async fn pending_txs_with_confirmations_testnet() { - let provider = RINKEBY.provider().interval(Duration::from_millis(3000)); + let provider = GOERLI.provider().interval(Duration::from_millis(3000)); let chain_id = provider.get_chainid().await.unwrap(); let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); let address = wallet.address(); @@ -102,7 +102,7 @@ use ethers_core::types::{Address, Eip1559TransactionRequest}; #[tokio::test] #[cfg(not(feature = "celo"))] async fn websocket_pending_txs_with_confirmations_testnet() { - let provider = RINKEBY.ws().await.interval(Duration::from_millis(3000)); + let provider = GOERLI.ws().await.interval(Duration::from_millis(3000)); let chain_id = provider.get_chainid().await.unwrap(); let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); let address = wallet.address(); @@ -123,7 +123,7 @@ async fn generic_pending_txs_test(provider: M, who: Address) { #[tokio::test] #[cfg(not(feature = "celo"))] async fn typed_txs() { - let provider = RINKEBY.provider(); + let provider = GOERLI.provider(); let chain_id = provider.get_chainid().await.unwrap(); let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); @@ -297,7 +297,7 @@ impl TestWallets { #[allow(unused)] pub async fn fund>(&self, provider: &Provider, n: U) { let addrs = (0..n.into()).map(|i| self.get(i).address()).collect::>(); - // hardcoded funder address private key, rinkeby + // hardcoded funder address private key, goerli let signer = "39aa18eeb5d12c071e5f19d8e9375a872e90cb1f2fa640384ffd8800a2f3e8f1" .parse::() .unwrap() diff --git a/ethers-providers/src/lib.rs b/ethers-providers/src/lib.rs index 8a323db1..6905b14a 100644 --- a/ethers-providers/src/lib.rs +++ b/ethers-providers/src/lib.rs @@ -675,7 +675,7 @@ pub trait CeloMiddleware: Middleware { } } -pub use test_provider::{GOERLI, MAINNET, RINKEBY, ROPSTEN}; +pub use test_provider::{GOERLI, MAINNET, ROPSTEN}; /// Pre-instantiated Infura HTTP clients which rotate through multiple API keys /// to prevent rate limits @@ -695,11 +695,9 @@ pub mod test_provider { "5c812e02193c4ba793f8c214317582bd", ]; - pub static RINKEBY: Lazy = - Lazy::new(|| TestProvider::new(INFURA_KEYS, "rinkeby")); + pub static GOERLI: Lazy = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli")); pub static MAINNET: Lazy = Lazy::new(|| TestProvider::new(INFURA_KEYS, "mainnet")); - pub static GOERLI: Lazy = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli")); pub static ROPSTEN: Lazy = Lazy::new(|| TestProvider::new(INFURA_KEYS, "ropsten")); diff --git a/ethers-providers/tests/provider.rs b/ethers-providers/tests/provider.rs index b1da9db7..4878964b 100644 --- a/ethers-providers/tests/provider.rs +++ b/ethers-providers/tests/provider.rs @@ -9,11 +9,11 @@ mod eth_tests { types::{Address, BlockId, TransactionRequest, H256}, utils::Anvil, }; - use ethers_providers::RINKEBY; + use ethers_providers::GOERLI; #[tokio::test] async fn non_existing_data_works() { - let provider = RINKEBY.provider(); + let provider = GOERLI.provider(); assert!(provider.get_transaction(H256::zero()).await.unwrap().is_none()); assert!(provider.get_transaction_receipt(H256::zero()).await.unwrap().is_none()); @@ -23,7 +23,7 @@ mod eth_tests { #[tokio::test] async fn client_version() { - let provider = RINKEBY.provider(); + let provider = GOERLI.provider(); // e.g., Geth/v1.10.6-omnibus-1af33248/linux-amd64/go1.16.6 assert!(provider @@ -36,7 +36,7 @@ mod eth_tests { // Without TLS this would error with "TLS Support not compiled in" #[tokio::test] async fn ssl_websocket() { - let provider = RINKEBY.ws().await; + let provider = GOERLI.ws().await; let _number = provider.get_block_number().await.unwrap(); } diff --git a/examples/remove_liquidity.rs b/examples/remove_liquidity.rs index ab4ceab9..7392c076 100644 --- a/examples/remove_liquidity.rs +++ b/examples/remove_liquidity.rs @@ -19,15 +19,16 @@ abigen!( ]"# ); +fn main() {} + // Remove liquidity from uniswap V2. -// This example will remove 500 liquidity of 2 test tokens, TA and TB on Rinkeby testnet. +// This example will remove 500 liquidity of 2 test tokens, TA and TB on goerli testnet. // This example uses pair contract and uniswap swap contract to remove liquidity. -#[tokio::main] -async fn main() -> Result<()> { +pub async fn example() -> Result<()> { let provider = Arc::new({ // connect to the network let provider = Provider::::try_from( - "https://rinkeby.infura.io/v3/a111fcada47746d990e0e2b7df50d00a", + "https://goerli.infura.io/v3/a111fcada47746d990e0e2b7df50d00a", )?; let chain_id = provider.get_chainid().await?;