Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
use filter builder
Browse files Browse the repository at this point in the history
  • Loading branch information
brech1 committed Sep 21, 2023
1 parent 6d673f1 commit 83b34a3
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions eigentrust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,21 +466,17 @@ impl Client {
self.config.as_address.parse::<Address>().unwrap(),
self.get_signer(),
);
let filter = as_contract.attestation_created_filter().filter.from_block(0);
let domain = H160::from(str_to_20_byte_array(&self.config.domain)?);

// Fetch logs matching the filter.
let logs = self
.signer
.get_logs(&filter)
.await
.map_err(|e| EigenError::ParsingError(e.to_string()))?;
// Set filter
let filter = as_contract
.attestation_created_filter()
.filter
.topic3(build_att_key(domain))
.from_block(0);

// Filter logs based on the correct key.
let filtered_logs: Vec<Log> =
logs.iter().filter(|log| log.topics[3] == build_att_key(domain)).cloned().collect();

Ok(filtered_logs)
// Fetch logs matching the filter.
self.signer.get_logs(&filter).await.map_err(|e| EigenError::ParsingError(e.to_string()))
}

/// Verifies the given proof.
Expand Down

0 comments on commit 83b34a3

Please sign in to comment.