From ccc0abf70b614c2ed4c1553ba143e3f901c6fbbf Mon Sep 17 00:00:00 2001 From: yhtiyar Date: Thu, 2 Dec 2021 16:09:26 +0300 Subject: [PATCH] fix lint issues --- moonworm/cli.py | 4 ++-- moonworm/cu_watch.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/moonworm/cli.py b/moonworm/cli.py index 3b66fb4..7399680 100644 --- a/moonworm/cli.py +++ b/moonworm/cli.py @@ -121,10 +121,10 @@ def handle_watch(args: argparse.Namespace) -> None: state_provider.clear_db_session() else: - state_provider = Web3StateProvider(web3) + watch_contract( web3=web3, - state_provider=state_provider, + state_provider=Web3StateProvider(web3), contract_address=web3.toChecksumAddress(args.contract), contract_abi=contract_abi, num_confirmations=args.confirmations, diff --git a/moonworm/cu_watch.py b/moonworm/cu_watch.py index 721e4f0..5f81534 100644 --- a/moonworm/cu_watch.py +++ b/moonworm/cu_watch.py @@ -20,6 +20,7 @@ from moonworm.crawler.moonstream_ethereum_state_provider import ( from moonworm.crawler.networks import Network from .contracts import CU, ERC721 +from .crawler.ethereum_state_provider import EthereumStateProvider from .crawler.function_call_crawler import ( ContractFunctionCall, FunctionCallCrawler, @@ -222,12 +223,14 @@ def watch_cu_contract( with yield_db_session_ctx() as session: function_call_state = MockState() - web3_state = Web3StateProvider(web3) - eth_state_provider = web3_state + + eth_state_provider: Optional[EthereumStateProvider] = None if use_moonstream_web3_provider: eth_state_provider = MoonstreamEthereumStateProvider( - web3, network=Network.polygon, session=session + web3, network=Network.polygon, db_session=session ) + else: + eth_state_provider = Web3StateProvider(web3) crawler = FunctionCallCrawler( function_call_state,