From f0dc40b45a9e589392810e5770b3161b90d51893 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 7 Dec 2022 21:40:07 +0200 Subject: [PATCH 1/3] Add address as argument. --- .../mooncrawl/mooncrawl/state_crawler/cli.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py index b3b708421..99dcf9712 100644 --- a/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py +++ b/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py @@ -341,6 +341,11 @@ def handle_crawl(args: argparse.Namespace) -> None: Read all view methods of the contracts and crawl """ + address = "0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f" + + if args.address: + address = args.address + my_job = { "type": "function", "stateMutability": "view", @@ -359,14 +364,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) @@ -456,6 +461,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( From 3d32e612aa5f66d40fd9be1b6cc62fe2d6a540c3 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 7 Dec 2022 21:46:43 +0200 Subject: [PATCH 2/3] Add to ChecksummAddress. --- crawlers/mooncrawl/mooncrawl/state_crawler/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py index 99dcf9712..c857ea37b 100644 --- a/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py +++ b/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py @@ -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 @@ -344,7 +345,7 @@ def handle_crawl(args: argparse.Namespace) -> None: address = "0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1f" if args.address: - address = args.address + address = Web3.toChecksumAddress(args.address) my_job = { "type": "function", From b4b3ee9ae4185dcc797c2c2db61803127542d118 Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Thu, 8 Dec 2022 05:55:06 -0800 Subject: [PATCH 3/3] Increased timeout for metadata requests (http) --- crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py index 6140fd788..4cb718b8a 100644 --- a/crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py +++ b/crawlers/mooncrawl/mooncrawl/metadata_crawler/cli.py @@ -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())