From eef88a91a36ee86c09a04ca1af935763ec4d210f Mon Sep 17 00:00:00 2001 From: Venticello <1232990+venticello@users.noreply.github.com> Date: Tue, 20 Sep 2022 13:35:33 +0300 Subject: [PATCH] Web3() -> Web3 for static fuctions. Avoid creating an instance of the Web3 class for static functions. --- moonworm/crawler/function_call_crawler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moonworm/crawler/function_call_crawler.py b/moonworm/crawler/function_call_crawler.py index 9715ccc..d1d90e9 100644 --- a/moonworm/crawler/function_call_crawler.py +++ b/moonworm/crawler/function_call_crawler.py @@ -111,7 +111,7 @@ def utfy_dict(dic): return dic elif isinstance(dic, bytes): - return Web3().toHex(dic) + return Web3.toHex(dic) elif isinstance(dic, tuple): return tuple(utfy_dict(x) for x in dic) @@ -147,7 +147,7 @@ class FunctionCallCrawler: self.contract_addresses = contract_addresses self.contract = Web3().eth.contract(abi=self.contract_abi) self.on_decode_error = on_decode_error - self.whitelisted_methods = {Web3().toHex(function_abi_to_4byte_selector(a)) for a in self.contract_abi} + self.whitelisted_methods = {Web3.toHex(function_abi_to_4byte_selector(a)) for a in self.contract_abi} def process_transaction(self, transaction: Dict[str, Any]): try: