openzeppelin_monitor::services::filter

Struct EVMBlockFilter

Source
pub struct EVMBlockFilter<T> {
    pub _client: PhantomData<T>,
}
Expand description

Filter implementation for EVM-compatible blockchains

Fields§

§_client: PhantomData<T>

Implementations§

Source§

impl<T> EVMBlockFilter<T>

Source

pub fn find_matching_transaction( &self, tx_status: &TransactionStatus, transaction: &EVMTransaction, tx_receipt: &Option<EVMTransactionReceipt>, monitor: &Monitor, matched_transactions: &mut Vec<TransactionCondition>, )

Finds transactions that match the monitor’s conditions.

§Arguments
  • tx_status - Status of the transaction (success/failure)
  • transaction - The transaction to check
  • tx_receipt - Transaction receipt
  • monitor - Monitor containing match conditions
  • matched_transactions - Vector to store matching transactions
Source

pub fn find_matching_functions_for_transaction( &self, contract_specs: &[(String, EVMContractSpec)], transaction: &EVMTransaction, monitor: &Monitor, matched_functions: &mut Vec<FunctionCondition>, matched_on_args: &mut EVMMatchArguments, )

Finds function calls in a transaction that match the monitor’s conditions.

Decodes the transaction input data using the contract ABI and matches against the monitor’s function conditions.

§Arguments
  • contract_specs - List of contract specifications
  • transaction - The transaction containing the function call
  • monitor - Monitor containing function match conditions
  • matched_functions - Vector to store matching functions
  • matched_on_args - Arguments from matched function calls
Source

pub async fn find_matching_events_for_transaction( &self, logs: &[EVMReceiptLog], monitor: &Monitor, matched_events: &mut Vec<EventCondition>, matched_on_args: &mut EVMMatchArguments, involved_addresses: &mut Vec<String>, )

Finds events in a transaction receipt that match the monitor’s conditions.

Processes event logs from the transaction receipt and matches them against the monitor’s event conditions.

§Arguments
  • logs - Transaction receipt containing event logs
  • monitor - Monitor containing event match conditions
  • matched_events - Vector to store matching events
  • matched_on_args - Arguments from matched events
  • involved_addresses - Addresses involved in matched events
Source

pub fn evaluate_expression( &self, expression: &str, args: &Option<Vec<EVMMatchParamEntry>>, ) -> bool

Evaluates a match expression against provided parameters.

§Arguments
  • expression - The expression to evaluate
  • args - Optional parameters to use in evaluation
§Returns

true if the expression matches, false otherwise

Source

pub async fn decode_events( &self, abi: &ContractSpec, log: &EVMReceiptLog, ) -> Option<EVMMatchParamsMap>

Decodes event logs using the provided ABI.

§Arguments
  • abi - Contract ABI for decoding
  • log - Event log to decode
§Returns

Option containing EVMMatchParamsMap with decoded event data if successful

Trait Implementations§

Source§

impl<T: BlockChainClient + EvmClientTrait> BlockFilter for EVMBlockFilter<T>

Source§

fn filter_block<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, client: &'life1 T, network: &'life2 Network, block: &'life3 BlockType, monitors: &'life4 [Monitor], contract_specs: Option<&'life5 [(String, ContractSpec)]>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MonitorMatch>, FilterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Processes a block and finds matches based on monitor conditions.

§Arguments
  • client - Blockchain client for additional data fetching
  • network - Network of the blockchain
  • block - The block to process
  • monitors - Active monitors containing match conditions
§Returns

Vector of matches found in the block

Source§

type Client = T

Auto Trait Implementations§

§

impl<T> Freeze for EVMBlockFilter<T>

§

impl<T> RefUnwindSafe for EVMBlockFilter<T>
where T: RefUnwindSafe,

§

impl<T> Send for EVMBlockFilter<T>
where T: Send,

§

impl<T> Sync for EVMBlockFilter<T>
where T: Sync,

§

impl<T> Unpin for EVMBlockFilter<T>
where T: Unpin,

§

impl<T> UnwindSafe for EVMBlockFilter<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Chain<T> for T

§

fn len(&self) -> usize

The number of items that this chain link consists of.
§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,