-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from yash-atreya/yash/mig_alloy
use alloy bindings
- Loading branch information
Showing
7 changed files
with
742 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
[workspace] | ||
members = [ | ||
"app", | ||
"crates/bindings", | ||
] | ||
members = ["app", "crates/bindings"] | ||
|
||
[workspace.dependencies] | ||
bindings = { path = "crates/bindings" } | ||
foundry-contracts = { path = "crates/bindings" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
use bindings::counter::Counter; | ||
|
||
use ethers::{prelude::Middleware, providers::test_provider::GOERLI, types::Address}; | ||
|
||
use alloy::{ | ||
primitives::Address, | ||
providers::{builder, Provider}, | ||
}; | ||
use eyre::Result; | ||
use std::sync::Arc; | ||
use foundry_contracts::counter::Counter; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
let provider = GOERLI.provider(); | ||
let provider = Arc::new(provider); | ||
let provider = builder().with_recommended_fillers().on_anvil_with_wallet(); | ||
|
||
let address = "0x0000000000000000000000000000000000000000".parse::<Address>()?; | ||
|
||
let contract = Counter::new(address, provider); | ||
let blk = contract.client().get_block_number().await?; | ||
let _contract = Counter::new(address, provider.clone()); | ||
|
||
let blk = provider.get_block_number().await?; | ||
println!("Hello, world! {}", blk); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[package] | ||
name = "bindings" | ||
name = "foundry-contracts" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
ethers = { version = "2", default-features = false, features = ["abigen"] } | ||
serde = "1" | ||
alloy = { git = "https://github.com/alloy-rs/alloy", features = [ | ||
"sol-types", | ||
"contract", | ||
] } |
Oops, something went wrong.