Skip to content

Commit

Permalink
chore(meta): update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Nov 15, 2023
1 parent f3d9ca4 commit fd55a13
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 168 deletions.
164 changes: 86 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,100 @@
name: CI

on:
push:
branches: [main]
pull_request:
push:
branches: [main]
pull_request:

# Yeah I know it's bad practice to have API keys, this is a read-only API key
# so that we do not get rate limited by Etherscan (and it's free to generate as
# many as you want)
env:
ETHERSCAN_API_KEY: "I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB"
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
GETH_BUILD: "1.11.2-73b01f40"
SOLC_VERSION: "0.8.20"
CARGO_TERM_COLOR: always
CARGO_TERM_COLOR: always
ETHERSCAN_API_KEY: "I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB"
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"

jobs:
etherscan-tests:
name: etherscan tests (${{ matrix.os }}) (${{ matrix.rust }})
runs-on: ${{ matrix.os}}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
rust: ["stable", "1.66"] # MSRV
exclude:
- rust: "1.66" # MSRV
concurrency: etherscan-tests-${{ github.head_ref || github.run_id }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: build
if: ${{ matrix.rust == '1.66' }} # MSRV
run: cargo build
# Don't use cargo-nextest since all the tests have to be run sequentially
- name: live tests
run: cargo test --test it
test:
name: test (${{ matrix.os }}) (${{ matrix.rust }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
rust: ["stable", "1.65"] # MSRV
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Only run tests on latest stable and above
- name: build
if: ${{ matrix.rust == '1.65' }} # MSRV
run: cargo build --workspace
# Don't use cargo-nextest since all the tests have to be run sequentially
- name: test
if: ${{ matrix.rust != '1.65' }} # MSRV
run: cargo test --workspace

feature-checks:
name: feature checks
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
- name: cargo hack
run: cargo hack check --feature-powerset --depth 1 --all-targets
wasm:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: check
run: cargo check --workspace --target wasm32-unknown-unknown

clippy:
name: clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy
- uses: Swatinem/rust-cache@v2
- name: clippy
run: cargo clippy --workspace --all-features --all-targets
env:
RUSTFLAGS: "-D warnings"
feature-checks:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo hack
run: cargo hack check --feature-powerset --depth 2 --all-targets

docs:
name: docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- uses: Swatinem/rust-cache@v2
- name: doc
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo clippy --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings

fmt:
name: fmt
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: fmt --check
run: cargo fmt --all --check
docs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"

fmt:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check
18 changes: 18 additions & 0 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: deps

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule: [cron: "00 00 * * *"]

jobs:
cargo-deny:
name: cargo deny check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
/Cargo.lock
.vscode
.idea
14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[package]
name = "foundry-block-explorers"
authors = ["Foundry Maintainers"]
readme = "README.md"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"
authors = ["Foundry Contributors"]
license = "MIT OR Apache-2.0"
description = "Bindings for Etherscan.io and other block explorer APIs"
keywords = ["crypto", "ethers", "ethereum", "web3", "etherscan"]
version = "0.1.0"
edition = "2021"
homepage = "https://github.com/foundry-rs/block-explorers"
repository = "https://github.com/foundry-rs/block-explorers"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -16,8 +18,6 @@ rustdoc-args = ["--cfg", "docsrs"]
all-features = true

[dependencies]
foundry-compilers = { version = "0.1", optional = true }

alloy-chains = "0.1"
alloy-json-abi = { version = "0.4", default-features = false, features = ["std", "serde_json"] }
alloy-primitives = { version = "0.4", default-features = false, features = ["std", "serde"] }
Expand All @@ -29,6 +29,8 @@ thiserror = "1.0"
tracing = "0.1.37"
semver = "1.0"

foundry-compilers = { version = "0.1", optional = true }

[dev-dependencies]
tempfile = "3.8"
tokio = { version = "1.32", features = ["macros", "rt-multi-thread", "time"] }
Expand Down
51 changes: 34 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Foundry Block Explorers
# foundry-block-explorers

Originally part of [`ethers-rs`] as `ethers-etherscan`, Foundry Block Explorers providers bindings for the [etherscan.io web API](https://docs.etherscan.io) and other block explorers.
Bindings for Etherscan.io and other block explorer APIs.

Originally part of [`ethers-rs`] as [`ethers-etherscan`](https://crates.io/crates/ethers-etherscan).

[`ethers-rs`]: https://github.com/gakonst/ethers-rs

Expand All @@ -12,6 +14,24 @@ Originally part of [`ethers-rs`] as `ethers-etherscan`, Foundry Block Explorers
[telegram-badge]: https://img.shields.io/endpoint?color=neon&style=for-the-badge&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Ffoundry_rs
[telegram-url]: https://t.me/foundry_rs

## Examples

```rust,no_run
use alloy_chains::Chain;
use foundry_block_explorers::Client;
async fn foo() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(Chain::Mainnet, "<your_api_key>")?;
// Or using environment variables
let client = Client::new_from_env(Chain::Mainnet)?;
let address = "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413".parse()?;
let metadata = client.contract_source_code(address).await?;
assert_eq!(metadata.items[0].contract_name, "DAO");
Ok(())
}
```

## Supported Rust Versions

<!--
Expand All @@ -21,27 +41,24 @@ When updating this, also update:
- .github/workflows/ci.yml
-->

Foundry Block explorers will keep a rolling MSRV (minimum supported rust version) policy of **at
Foundry will keep a rolling MSRV (minimum supported rust version) policy of **at
least** 6 months. When increasing the MSRV, the new Rust version must have been
released at least six months ago. The current MSRV is 1.65.0.

Note that the MSRV is not increased automatically, and only as part of a minor
release.

## Examples
#### License

```rust,no_run
use alloy_chains::Chain;
use foundry_block_explorers::Client;
<sup>
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>

async fn foo() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(Chain::Mainnet, "<your_api_key>")?;
// Or using environment variables
let client = Client::new_from_env(Chain::Mainnet)?;
<br>

let address = "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413".parse()?;
let metadata = client.contract_source_code(address).await?;
assert_eq!(metadata.items[0].contract_name, "DAO");
Ok(())
}
```
<sub>
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in these crates by you, as defined in the Apache-2.0 license,
shall be dual licensed as above, without any additional terms or conditions.
</sub>
52 changes: 0 additions & 52 deletions cliff.toml

This file was deleted.

2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.66"
msrv = "1.65"
Loading

0 comments on commit fd55a13

Please sign in to comment.