Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ChainID string
// Startup strategy
StartBlock uint64
ForceStart bool
Rewind uint64
CursorRewind uint64 // Safety rewind from saved cursor
BatchSize uint64
Interval time.Duration
ReorgSafe uint64
UseBloom bool
}
Config holds configuration parameters for the Scanner.
type Filter ¶
type Filter struct {
// Contracts is the list of contract addresses to listen to (Log.Address).
// If empty, listens to all contracts.
Contracts []common.Address
// Topics is the list of event topics to listen to.
// Maps to eth_getLogs topics parameter: [[A, B], [C], null, [D]]
// Logical relation: (Topic0 in [A, B]) AND (Topic1 in [C])
Topics [][]common.Hash
}
Filter defines the scanning rules for the scanner. It is used both for generating RPC request parameters and for local Bloom Filter checks.
func (*Filter) AddContract ¶
AddContract adds contract addresses to listen to
func (*Filter) IsHeavy ¶
IsHeavy determines if the filter is too complex for efficient local Bloom Filter checks. Rule of thumb: Bloom filter tends to saturate if topics at any position > 20 or contracts > 20.
func (*Filter) MatchesBloom ¶
MatchesBloom uses the local Bloom Filter to quickly check if a block might contain matching logs. Returns false if it definitely doesn't contain matching logs (Safe to Skip). Returns true if it might contain matching logs (Need to Fetch).
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner orchestrates the scanning of blocks and processing of logs.
func (*Scanner) SetHandler ¶
SetHandler sets the callback function to be called when logs are received