22 lines
652 B
Rust
22 lines
652 B
Rust
|
use ethers::{
|
||
|
types::{Address, Filter},
|
||
|
HttpProvider,
|
||
|
};
|
||
|
use std::convert::TryFrom;
|
||
|
|
||
|
#[tokio::main]
|
||
|
async fn main() -> Result<(), failure::Error> {
|
||
|
// connect to the network
|
||
|
let provider = HttpProvider::try_from("http://localhost:8545")?;
|
||
|
|
||
|
let filter = Filter::new()
|
||
|
.address_str("f817796F60D268A36a57b8D2dF1B97B14C0D0E1d")?
|
||
|
.event("ValueChanged(address,string,string)") // event name
|
||
|
.topic("9729a6fbefefc8f6005933898b13dc45c3a2c8b7".parse::<Address>()?); // indexed param
|
||
|
|
||
|
let logs = provider.get_logs(&filter).await?;
|
||
|
println!("Got logs: {}", serde_json::to_string(&logs).unwrap());
|
||
|
|
||
|
Ok(())
|
||
|
}
|