Skip to content

Commit ee08def

Browse files
committed
remove mention of callbacks
1 parent 6ab1106 commit ee08def

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

README.md

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Event Scanner is a Rust library for monitoring EVM-based smart contract events.
2121
- [Building a Scanner](#building-a-scanner)
2222
- [Defining Event Filters](#defining-event-filters)
2323
- [Scanning Modes](#scanning-modes)
24-
- [Working with Callbacks](#working-with-callbacks)
2524
- [Examples](#examples)
2625
- [Testing](#testing)
2726

@@ -33,7 +32,6 @@ Event Scanner is a Rust library for monitoring EVM-based smart contract events.
3332
- **Live subscriptions** – stay up to date with latest blocks via WebSocket or IPC transports.
3433
- **Hybrid flow** – automatically transition from historical catch-up into streaming mode.
3534
- **Composable filters** – register one or many contract + event signature pairs with their own callbacks.
36-
- **Retry strategies** – built-in retryable callback backoff strategies
3735
- **No database** – processing happens in-memory; persistence is left to the host application.
3836

3937
---
@@ -45,7 +43,6 @@ The library exposes two primary layers:
4543
- `EventScannerBuilder` / `EventScanner` – the main module the application will interact with.
4644
- `BlockRangeScanner` – lower-level component that streams block ranges, handles reorg, batching, and provider subscriptions.
4745

48-
Callbacks implement the `EventCallback` trait. They are executed through a `CallbackStrategy` that performs retries when necessary before reporting failures.
4946

5047
---
5148

@@ -57,7 +54,6 @@ Add `event-scanner` to your `Cargo.toml`:
5754
[dependencies]
5855
event-scanner = "0.1.0-alpha.1"
5956
```
60-
Create a callback implementing `EventCallback` and register it with the builder:
6157

6258
```rust
6359
use std::{sync::{Arc, atomic::{AtomicUsize, Ordering}}};
@@ -100,7 +96,6 @@ async fn run_scanner(ws_url: alloy::transports::http::reqwest::Url, contract: al
10096
`EventScannerBuilder` supports:
10197

10298
- `with_event_filter(s)` – attach [filters](#defining-event-filters).
103-
- `with_callback_strategy(strategy)` – override retry behaviour (`StateSyncAwareStrategy` by default).
10499
- `with_blocks_read_per_epoch` - how many blocks are read at a time in a single batch (taken into consideration when fetching historical blocks)
105100
- `with_reorg_rewind_depth` - how many blocks to rewind when a reorg is detected
106101
- `with_block_confirmations` - how many confirmations to wait for before considering a block final
@@ -110,7 +105,7 @@ Once configured, connect using either `connect_ws::<Ethereum>(ws_url)` or `conne
110105

111106
### Defining Event Filters
112107

113-
Create an `EventFilter` for each contract/event pair you want to track. The filter bundles the contract address, the event signature (from `SolEvent::SIGNATURE`), and an `Arc<dyn EventCallback + Send + Sync>`.
108+
Create an `EventFilter` for each contract/event pair you want to track. The filter bundles the contract address, the event signature (from `SolEvent::SIGNATURE`).
114109

115110
Both `contract_address` and `event` fields are optional, allowing for flexible event tracking.
116111

@@ -123,16 +118,13 @@ You can construct EventFilters using either the builder pattern (recommended) or
123118
let specific_filter = EventFilter::new()
124119
.with_contract_address(*counter_contract.address())
125120
.with_event(Counter::CountIncreased::SIGNATURE)
126-
.with_callback(Arc::new(CounterCallback));
127121

128122
// Track ALL events from a specific contract
129123
let all_contract_events_filter = EventFilter::new()
130124
.with_contract_address(*counter_contract.address())
131-
.with_callback(Arc::new(AllEventsCallback));
132125

133126
// Track ALL events from ALL contracts in the block range
134-
let all_events_filter = EventFilter::new()
135-
.with_callback(Arc::new(GlobalEventsCallback));
127+
let all_events_filter = EventFilter::new();
136128
```
137129

138130
### Direct Struct Construction
@@ -142,21 +134,18 @@ let all_events_filter = EventFilter::new()
142134
let specific_filter = EventFilter {
143135
contract_address: Some(*counter_contract.address()),
144136
event: Some(Counter::CountIncreased::SIGNATURE.to_owned()),
145-
callback: Arc::new(CounterCallback),
146137
};
147138

148139
// Track ALL events from a specific contract
149140
let all_contract_events_filter = EventFilter {
150141
contract_address: Some(*counter_contract.address()),
151142
event: None, // Will track all events from this contract
152-
callback: Arc::new(AllEventsCallback),
153143
};
154144

155145
// Track ALL events from ALL contracts in the block range
156146
let all_events_filter = EventFilter {
157147
contract_address: None, // Will track events from all contracts
158148
event: None, // Will track all event types
159-
callback: Arc::new(GlobalEventsCallback),
160149
};
161150
```
162151

@@ -184,33 +173,6 @@ For now modes are deduced from the `start` and `end` parameters. In the future,
184173

185174
See the integration tests under `tests/live_mode`, `tests/historic_mode`, and `tests/historic_to_live` for concrete examples.
186175

187-
### Working with Callbacks
188-
189-
Implement `EventCallback`:
190-
191-
```rust
192-
#[async_trait]
193-
impl EventCallback for RollupCallback {
194-
async fn on_event(&self, log: &Log) -> anyhow::Result<()> {
195-
// decode event, send to EL etc.
196-
Ok(())
197-
}
198-
}
199-
```
200-
201-
Advanced users can write custom retry behaviour by implementing the `CallbackStrategy` trait. The default `StateSyncAwareStrategy` automatically detects state-sync errors and performs exponential backoff ([smart retry mechanism](https://github.com/taikoxyz/taiko-mono/blob/f4b3a0e830e42e2fee54829326389709dd422098/packages/taiko-client/pkg/chain_iterator/block_batch_iterator.go#L149) from the geth driver) before falling back to a fixed retry policy configured via `FixedRetryConfig`.
202-
203-
```rust
204-
#[async_trait]
205-
pub trait CallbackStrategy: Send + Sync {
206-
async fn execute(
207-
&self,
208-
callback: &Arc<dyn EventCallback + Send + Sync>,
209-
log: &Log,
210-
) -> anyhow::Result<()>;
211-
}
212-
```
213-
214176
---
215177

216178
## Examples

0 commit comments

Comments
 (0)