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()) diff --git a/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/state_crawler/cli.py index b3b708421..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 @@ -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", @@ -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) @@ -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(