Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple addresses #126

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions moonworm/crawler/log_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import logging
import time
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union

from eth_abi.codec import ABICodec
from eth_typing.evm import ChecksumAddress
Expand Down Expand Up @@ -135,7 +135,7 @@ def _crawl_events(
from_block: int,
to_block: int,
batch_size: int,
contract_address: ChecksumAddress,
contract_address: Union[ChecksumAddress, List[ChecksumAddress]],
batch_size_update_threshold: int = 1000,
max_blocks_batch: int = 10000,
min_blocks_batch: int = 100,
Expand All @@ -148,6 +148,10 @@ def _crawl_events(
events = []
current_from_block = from_block

address_list = (
[contract_address] if isinstance(contract_address, str) else contract_address
) # for backwards compatibility

while current_from_block <= to_block:
current_to_block = min(current_from_block + batch_size, to_block)
try:
Expand All @@ -156,7 +160,7 @@ def _crawl_events(
event_abi,
current_from_block,
current_to_block,
[contract_address],
address_list,
)
events.extend(events_chunk)
current_from_block = current_to_block + 1
Expand Down
2 changes: 1 addition & 1 deletion moonworm/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MOONWORM_VERSION = "0.9.2"
MOONWORM_VERSION = "0.9.3"
Loading