Skip to content

Commit 1c42a54

Browse files
cleanup
1 parent 3007e8d commit 1c42a54

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/main.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloy::{
2-
primitives::{address, Address},
2+
primitives::Address,
33
providers::{Provider, ProviderBuilder, WsConnect},
44
rpc::types::{BlockNumberOrTag, Filter, ValueOrArray, Log},
55
};
@@ -10,8 +10,8 @@ use hex_literal::hex;
1010

1111
#[tokio::main]
1212
async fn main() -> Result<()> {
13-
let rpc_url_chain1 = "wss://sepolia.infura.io/ws/v3/8dd4a35393c04ed8a4c1c563c8ea099e"; // Replace with your actual URL
14-
let rpc_url_chain2 = "wss://polygon-amoy.infura.io/ws/v3/8dd4a35393c04ed8a4c1c563c8ea099e"; // Replace with your actual URL
13+
let rpc_url_chain1 = "wss://sepolia.infura.io/ws/v3/8dd4a35393c04ed8a4c1c563c8ea099e";
14+
let rpc_url_chain2 = "wss://polygon-amoy.infura.io/ws/v3/8dd4a35393c04ed8a4c1c563c8ea099e";
1515

1616
let ws_chain1 = WsConnect::new(rpc_url_chain1);
1717
let ws_chain2 = WsConnect::new(rpc_url_chain2);
@@ -21,18 +21,13 @@ async fn main() -> Result<()> {
2121

2222
let contract_address: Address = Address::from(hex!("8c6faf12a32462f5f2f5282821fe9e789e6d82e7"));
2323

24-
let filter_chain1 = Filter::new()
24+
let filter_chain = Filter::new()
2525
.address(ValueOrArray::Value(contract_address))
2626
.event("Generate(uint256,uint256)")
2727
.from_block(BlockNumberOrTag::Latest);
2828

29-
let filter_chain2 = Filter::new()
30-
.address(ValueOrArray::Value(contract_address))
31-
.event("Generate(uint256,uint256)")
32-
.from_block(BlockNumberOrTag::Latest);
33-
34-
let sub_chain1 = provider_chain1.subscribe_logs(&filter_chain1).await?;
35-
let sub_chain2 = provider_chain2.subscribe_logs(&filter_chain2).await?;
29+
let sub_chain1 = provider_chain1.subscribe_logs(&filter_chain).await?;
30+
let sub_chain2 = provider_chain2.subscribe_logs(&filter_chain).await?;
3631

3732
let mut stream_chain1 = sub_chain1.into_stream();
3833
let mut stream_chain2 = sub_chain2.into_stream();

0 commit comments

Comments
 (0)