call => trace, and traces are still dicts here

This commit is contained in:
Luke Van Seters 2021-07-20 22:56:34 -04:00
parent 36c584ed4c
commit 9442078a7a
2 changed files with 11 additions and 9 deletions

View File

@ -83,10 +83,14 @@ class UniswapInspector:
for call in calls:
print("\n", call)
if (
call["action"]["to"] == uniswap_router_address.lower()
or call["action"]["to"] == sushiswap_router_address.lower()
) and utils.check_call_for_signature(
call, self.uniswap_router_trade_signatures
call["type"] == "call"
and (
call["action"]["to"] == uniswap_router_address.lower()
or call["action"]["to"] == sushiswap_router_address.lower()
)
and utils.check_trace_for_signature(
call, self.uniswap_router_trade_signatures
)
):
# print("WIP, here is where there is a call that matches what we are looking for")
1 == 1

View File

@ -2,16 +2,14 @@ from typing import List
from hexbytes.main import HexBytes
from mev_inspect.schemas import Trace
def check_trace_for_signature(trace: Trace, signatures: List[str]):
if trace.action["input"] == None:
def check_trace_for_signature(trace: dict, signatures: List[str]):
if trace["action"]["input"] == None:
return False
## Iterate over all signatures, and if our trace matches any of them set it to True
for signature in signatures:
if HexBytes(trace.action["input"]).startswith(signature):
if HexBytes(trace["action"]["input"]).startswith(signature):
## Note that we are turning the input into hex bytes here, which seems to be fine
## Working with strings was doing weird things
return True