Skip to content

title: eth::EventFilter summary: Specifies which logs to accept: by emitting address(es) and/or topic(s).


eth::EventFilter

Specifies which logs to accept: by emitting address(es) and/or topic(s). More...

#include <event_filter.hpp>

Public Functions

Name
bool matches(const codec::LogEntry & log, uint64_t block =0) const
Test whether a log entry matches this filter.

Public Attributes

Name
std::vector< codec::Address > addresses
Contracts to watch; empty means "any contract".
std::vector< std::optional< codec::Hash256 > > topics
std::optional< uint64_t > from_block
Optional inclusive block range.
std::optional< uint64_t > to_block

Detailed Description

struct eth::EventFilter;

Specifies which logs to accept: by emitting address(es) and/or topic(s).

Topic matching follows the eth_getLogs semantics:

  • An empty topics vector matches any log.
  • topics[i] == std::nullopt matches any value at position i.
  • topics[i] == some_hash matches only that exact value at position i.

Address matching:

  • An empty addresses vector matches logs from any contract.
  • Otherwise only logs whose emitting address appears in the list are accepted.

Public Functions Documentation

function matches

bool matches(
    const codec::LogEntry & log,
    uint64_t block =0
) const

Test whether a log entry matches this filter.

Parameters:

  • log The log entry to test.
  • block The block number the log was included in (0 if unknown).

Return: true if the log satisfies all filter constraints.

Public Attributes Documentation

variable addresses

std::vector< codec::Address > addresses;

Contracts to watch; empty means "any contract".

variable topics

std::vector< std::optional< codec::Hash256 > > topics;

Per-position topic constraints. Each slot is optional: std::nullopt → wildcard (accept any value at this position) has_value() → must equal this exact topic hash

variable from_block

std::optional< uint64_t > from_block;

Optional inclusive block range.

variable to_block

std::optional< uint64_t > to_block;

Updated on 2026-04-26 at 17:04:52 -0700