chore: replace rinkeby with goerli (#1768)
* chore: replace rinkeby with goerli * ignore example
This commit is contained in:
parent
454449b0c3
commit
0645f4502c
|
@ -12,7 +12,7 @@ name: Tests
|
||||||
env:
|
env:
|
||||||
ETHERSCAN_API_KEY_ETHEREUM: I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB
|
ETHERSCAN_API_KEY_ETHEREUM: I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB
|
||||||
ETHERSCAN_API_KEY_CELO: B13XSMUT6Q3Q4WZ5DNQR8RXDBA2KNTMT4M
|
ETHERSCAN_API_KEY_CELO: B13XSMUT6Q3Q4WZ5DNQR8RXDBA2KNTMT4M
|
||||||
RINKEBY_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
|
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
|
|
@ -8,10 +8,10 @@ async fn nonce_manager() {
|
||||||
use ethers_signers::{LocalWallet, Signer};
|
use ethers_signers::{LocalWallet, Signer};
|
||||||
use std::time::Duration;
|
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 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()
|
.unwrap()
|
||||||
.parse::<LocalWallet>()
|
.parse::<LocalWallet>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
use ethers_providers::{Http, JsonRpcClient, Middleware, Provider, RINKEBY};
|
use ethers_providers::{Http, JsonRpcClient, Middleware, Provider, GOERLI};
|
||||||
|
|
||||||
use ethers_core::{
|
use ethers_core::{
|
||||||
types::{BlockNumber, TransactionRequest},
|
types::{BlockNumber, TransactionRequest},
|
||||||
|
@ -87,7 +87,7 @@ async fn send_with_chain_id_anvil() {
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(not(feature = "celo"))]
|
#[cfg(not(feature = "celo"))]
|
||||||
async fn pending_txs_with_confirmations_testnet() {
|
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 chain_id = provider.get_chainid().await.unwrap();
|
||||||
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
||||||
let address = wallet.address();
|
let address = wallet.address();
|
||||||
|
@ -102,7 +102,7 @@ use ethers_core::types::{Address, Eip1559TransactionRequest};
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(not(feature = "celo"))]
|
#[cfg(not(feature = "celo"))]
|
||||||
async fn websocket_pending_txs_with_confirmations_testnet() {
|
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 chain_id = provider.get_chainid().await.unwrap();
|
||||||
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
||||||
let address = wallet.address();
|
let address = wallet.address();
|
||||||
|
@ -123,7 +123,7 @@ async fn generic_pending_txs_test<M: Middleware>(provider: M, who: Address) {
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(not(feature = "celo"))]
|
#[cfg(not(feature = "celo"))]
|
||||||
async fn typed_txs() {
|
async fn typed_txs() {
|
||||||
let provider = RINKEBY.provider();
|
let provider = GOERLI.provider();
|
||||||
|
|
||||||
let chain_id = provider.get_chainid().await.unwrap();
|
let chain_id = provider.get_chainid().await.unwrap();
|
||||||
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
|
||||||
|
@ -297,7 +297,7 @@ impl TestWallets {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub async fn fund<T: JsonRpcClient, U: Into<u32>>(&self, provider: &Provider<T>, n: U) {
|
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<_>>();
|
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"
|
let signer = "39aa18eeb5d12c071e5f19d8e9375a872e90cb1f2fa640384ffd8800a2f3e8f1"
|
||||||
.parse::<LocalWallet>()
|
.parse::<LocalWallet>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -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
|
/// Pre-instantiated Infura HTTP clients which rotate through multiple API keys
|
||||||
/// to prevent rate limits
|
/// to prevent rate limits
|
||||||
|
@ -695,11 +695,9 @@ pub mod test_provider {
|
||||||
"5c812e02193c4ba793f8c214317582bd",
|
"5c812e02193c4ba793f8c214317582bd",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub static RINKEBY: Lazy<TestProvider> =
|
pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
|
||||||
Lazy::new(|| TestProvider::new(INFURA_KEYS, "rinkeby"));
|
|
||||||
pub static MAINNET: Lazy<TestProvider> =
|
pub static MAINNET: Lazy<TestProvider> =
|
||||||
Lazy::new(|| TestProvider::new(INFURA_KEYS, "mainnet"));
|
Lazy::new(|| TestProvider::new(INFURA_KEYS, "mainnet"));
|
||||||
pub static GOERLI: Lazy<TestProvider> = Lazy::new(|| TestProvider::new(INFURA_KEYS, "goerli"));
|
|
||||||
pub static ROPSTEN: Lazy<TestProvider> =
|
pub static ROPSTEN: Lazy<TestProvider> =
|
||||||
Lazy::new(|| TestProvider::new(INFURA_KEYS, "ropsten"));
|
Lazy::new(|| TestProvider::new(INFURA_KEYS, "ropsten"));
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ mod eth_tests {
|
||||||
types::{Address, BlockId, TransactionRequest, H256},
|
types::{Address, BlockId, TransactionRequest, H256},
|
||||||
utils::Anvil,
|
utils::Anvil,
|
||||||
};
|
};
|
||||||
use ethers_providers::RINKEBY;
|
use ethers_providers::GOERLI;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn non_existing_data_works() {
|
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(H256::zero()).await.unwrap().is_none());
|
||||||
assert!(provider.get_transaction_receipt(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]
|
#[tokio::test]
|
||||||
async fn client_version() {
|
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
|
// e.g., Geth/v1.10.6-omnibus-1af33248/linux-amd64/go1.16.6
|
||||||
assert!(provider
|
assert!(provider
|
||||||
|
@ -36,7 +36,7 @@ mod eth_tests {
|
||||||
// Without TLS this would error with "TLS Support not compiled in"
|
// Without TLS this would error with "TLS Support not compiled in"
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn ssl_websocket() {
|
async fn ssl_websocket() {
|
||||||
let provider = RINKEBY.ws().await;
|
let provider = GOERLI.ws().await;
|
||||||
let _number = provider.get_block_number().await.unwrap();
|
let _number = provider.get_block_number().await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,16 @@ abigen!(
|
||||||
]"#
|
]"#
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
||||||
// Remove liquidity from uniswap V2.
|
// 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.
|
// This example uses pair contract and uniswap swap contract to remove liquidity.
|
||||||
#[tokio::main]
|
pub async fn example() -> Result<()> {
|
||||||
async fn main() -> Result<()> {
|
|
||||||
let provider = Arc::new({
|
let provider = Arc::new({
|
||||||
// connect to the network
|
// connect to the network
|
||||||
let provider = Provider::<Http>::try_from(
|
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?;
|
let chain_id = provider.get_chainid().await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue