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 address as argument. #732

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def crawl_uri(metadata_uri: str) -> Any:
while retry < 3:
try:

response = urllib.request.urlopen(metadata_uri, timeout=5)
response = urllib.request.urlopen(metadata_uri, timeout=30.0)

if response.status == 200:
result = json.loads(response.read())
Expand Down
17 changes: 15 additions & 2 deletions crawlers/mooncrawl/mooncrawl/state_crawler/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
create_moonstream_engine,
)
from sqlalchemy.orm import sessionmaker
from web3 import Web3

from .db import view_call_to_label, commit_session, clean_labels
from .Multicall2_interface import Contract as Multicall2
Expand Down Expand Up @@ -341,6 +342,11 @@ def handle_crawl(args: argparse.Namespace) -> None:
Read all view methods of the contracts and crawl
"""

address = "0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f"

if args.address:
address = Web3.toChecksumAddress(args.address)

my_job = {
"type": "function",
"stateMutability": "view",
Expand All @@ -359,14 +365,14 @@ def handle_crawl(args: argparse.Namespace) -> None:
"type": "uint256",
}
],
"address": "0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f",
"address": address,
"inputs": [],
},
}
],
"name": "tokenURI",
"outputs": [{"internalType": "string", "name": "", "type": "string"}],
"address": "0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f",
"address": address,
}

blockchain_type = AvailableBlockchainType(args.blockchain)
Expand Down Expand Up @@ -456,6 +462,13 @@ def main() -> None:
default=500,
help="Size of chunks wich send to Multicall2 contract.",
)
view_state_crawler_parser.add_argument(
"--address",
"-a",
type=str,
default="0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f",
help="Contract address.",
)
view_state_crawler_parser.set_defaults(func=handle_crawl)

view_state_cleaner = subparsers.add_parser(
Expand Down