Compare commits
5 Commits
ethers-mid
...
master
Author | SHA1 | Date |
---|---|---|
Jonathan LEI | 36dac5864c | |
DaniPopes | 16f9fab75c | |
Georgios Konstantopoulos | 80ac3947d0 | |
Georgios Konstantopoulos | 797488eedf | |
Georgios Konstantopoulos | 89b1b2de78 |
|
@ -63,11 +63,11 @@ jobs:
|
|||
- uses: Swatinem/rust-cache@v2
|
||||
- name: test ${{ matrix.flags.flags }}
|
||||
shell: bash
|
||||
# skip `ethers_etherscan::it` and `ethers::live`
|
||||
# skip `ethers_etherscan::it`
|
||||
run: |
|
||||
cargo nextest run \
|
||||
${{ matrix.flags.flags }} \
|
||||
-E "!binary(~live) & !(deps(ethers-etherscan) & kind(test))"
|
||||
-E "!(deps(ethers-etherscan) & kind(test))"
|
||||
|
||||
etherscan-tests:
|
||||
name: etherscan tests
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
pub use ethers_core::types::{Address, Chain};
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#![deny(rustdoc::broken_intra_doc_links, missing_docs, unsafe_code)]
|
||||
#![warn(unreachable_pub)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(missing_docs)]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#![deny(missing_docs, unsafe_code, unused_crate_dependencies)]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
use abigen::Contracts;
|
||||
use proc_macro::TokenStream;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
#[path = "contract.rs"]
|
||||
mod _contract;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(not(target_arch = "wasm32"), deny(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
pub mod types;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
use crate::errors::{is_blocked_by_cloudflare_response, is_cloudflare_security_challenge};
|
||||
use contract::ContractMetadata;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
/// The [Gas Escalator middleware](crate::gas_escalator::GasEscalatorMiddleware)
|
||||
/// is used to re-broadcast transactions with an increasing gas price to guarantee
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![allow(clippy::type_complexity)]
|
||||
#![warn(missing_docs)]
|
||||
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
mod ext;
|
||||
pub use ext::*;
|
||||
|
|
|
@ -51,7 +51,7 @@ pub(super) fn sig_from_digest_bytes_trial_recovery(
|
|||
|
||||
/// Modify the v value of a signature to conform to eip155
|
||||
pub(super) fn apply_eip155(sig: &mut EthSig, chain_id: u64) {
|
||||
let v = (chain_id * 2 + 35) + ((sig.v - 1) % 2);
|
||||
let v = (chain_id * 2 + 35) + sig.v;
|
||||
sig.v = v;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(unsafe_code, rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
mod wallet;
|
||||
pub use wallet::{MnemonicBuilder, Wallet, WalletError};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
pub mod artifacts;
|
||||
pub mod sourcemap;
|
||||
|
|
|
@ -62,10 +62,11 @@ ethers-etherscan = { workspace = true, features = ["ethers-solc"] }
|
|||
ethers-middleware.workspace = true
|
||||
ethers-providers.workspace = true
|
||||
ethers-signers.workspace = true
|
||||
ethers-solc = { workspace = true }
|
||||
ethers-solc.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
serde.workspace = true
|
||||
tokio = { workspace = true, features = ["macros", "rt"] }
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
|
||||
ethers-contract = { workspace = true, features = ["eip712"] }
|
||||
ethers-providers = { workspace = true, features = ["rustls"] } # allow https connections
|
||||
ethers-solc = { workspace = true, features = ["svm-solc"] }
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
|
||||
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms), allow(dead_code, unused_variables))))]
|
||||
|
||||
#[doc(inline)]
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
use ethers::prelude::*;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
ethers::contract::abigen!(SimpleStorage, "../testdata/SimpleStorage.json");
|
||||
|
||||
static CELO_TESTNET_URL: &str = "https://alfajores-forno.celo-testnet.org";
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_send_transaction() {
|
||||
// Celo testnet
|
||||
let provider =
|
||||
Provider::<Http>::try_from(CELO_TESTNET_URL).unwrap().interval(Duration::from_secs(3));
|
||||
let chain_id = provider.get_chainid().await.unwrap().as_u64();
|
||||
|
||||
// Funded with https://celo.org/developers/faucet
|
||||
// Please do not drain this account :)
|
||||
let wallet = "d652abb81e8c686edba621a895531b1f291289b63b5ef09a94f686a5ecdd5db1"
|
||||
.parse::<LocalWallet>()
|
||||
.unwrap()
|
||||
.with_chain_id(chain_id);
|
||||
let client = SignerMiddleware::new(provider, wallet);
|
||||
|
||||
let balance_before = client.get_balance(client.address(), None).await.unwrap();
|
||||
let tx = TransactionRequest::pay(client.address(), 100);
|
||||
let _receipt = client.send_transaction(tx, None).await.unwrap().confirmations(3).await.unwrap();
|
||||
let balance_after = client.get_balance(client.address(), None).await.unwrap();
|
||||
assert!(balance_before > balance_after);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn deploy_and_call_contract() {
|
||||
// Celo testnet
|
||||
let provider =
|
||||
Provider::<Http>::try_from(CELO_TESTNET_URL).unwrap().interval(Duration::from_secs(3));
|
||||
let chain_id = provider.get_chainid().await.unwrap().as_u64();
|
||||
|
||||
// Funded with https://celo.org/developers/faucet
|
||||
let wallet = "58ea5643a78c36926ad5128a6b0d8dfcc7fc705788a993b1c724be3469bc9697"
|
||||
.parse::<LocalWallet>()
|
||||
.unwrap()
|
||||
.with_chain_id(chain_id);
|
||||
let client = provider.with_signer(wallet);
|
||||
let client = Arc::new(client);
|
||||
|
||||
let deploy_tx = SimpleStorage::deploy(client, ()).unwrap();
|
||||
let contract = deploy_tx.send().await.unwrap();
|
||||
|
||||
let value: U256 = contract.value().call().await.unwrap();
|
||||
assert_eq!(value, 0.into());
|
||||
|
||||
// make a state mutating transaction
|
||||
// gas estimation costs are sometimes under-reported on celo,
|
||||
// so we manually set it to avoid failures
|
||||
let call = contract.set_value(1.into()).gas(100000);
|
||||
let pending_tx = call.send().await.unwrap();
|
||||
let _receipt = pending_tx.await.unwrap();
|
||||
|
||||
let value: U256 = contract.method("value", ()).unwrap().call().await.unwrap();
|
||||
assert_eq!(value, 1.into());
|
||||
}
|
|
@ -10,7 +10,7 @@ use ethers::{
|
|||
};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
#[tokio::test]
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_derive_eip712() {
|
||||
// Generate Contract ABI Bindings
|
||||
abigen!(
|
||||
|
@ -40,6 +40,7 @@ async fn test_derive_eip712() {
|
|||
|
||||
// get ABI and bytecode for the DeriveEip712Test contract
|
||||
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests");
|
||||
Solc::find_or_install_svm_version("0.6.0").unwrap(); // install solc
|
||||
let result = Solc::default().compile_source(path).unwrap();
|
||||
let (abi, bytecode, _) = result
|
||||
.find("DeriveEip712Test")
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
//! Ethers integration tests.
|
||||
#![cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
#[cfg(feature = "celo")]
|
||||
mod celo;
|
||||
|
||||
mod eip712;
|
||||
|
|
Loading…
Reference in New Issue