chore: replace rinkeby with goerli (#1768)

* chore: replace rinkeby with goerli

* ignore example
This commit is contained in:
Matthias Seitz 2022-10-07 17:58:32 +02:00 committed by GitHub
parent 454449b0c3
commit 0645f4502c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 20 deletions

View File

@ -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:

View File

@ -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::<LocalWallet>()
.unwrap()

View File

@ -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<M: Middleware>(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<T: JsonRpcClient, U: Into<u32>>(&self, provider: &Provider<T>, n: U) {
let addrs = (0..n.into()).map(|i| self.get(i).address()).collect::<Vec<_>>();
// hardcoded funder address private key, rinkeby
// hardcoded funder address private key, goerli
let signer = "39aa18eeb5d12c071e5f19d8e9375a872e90cb1f2fa640384ffd8800a2f3e8f1"
.parse::<LocalWallet>()
.unwrap()

View File

@ -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<TestProvider> =
Lazy::new(|| TestProvider::new(INFURA_KEYS, "rinkeby"));
pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
pub static MAINNET: Lazy<TestProvider> =
Lazy::new(|| TestProvider::new(INFURA_KEYS, "mainnet"));
pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
pub static ROPSTEN: Lazy<TestProvider> =
Lazy::new(|| TestProvider::new(INFURA_KEYS, "ropsten"));

View File

@ -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();
}

View File

@ -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::<Http>::try_from(
"https://rinkeby.infura.io/v3/a111fcada47746d990e0e2b7df50d00a",
"https://goerli.infura.io/v3/a111fcada47746d990e0e2b7df50d00a",
)?;
let chain_id = provider.get_chainid().await?;