Update check signatures for Trace object

This commit is contained in:
Luke Van Seters 2021-07-20 18:22:29 -04:00
parent ba761b48ee
commit 06fce79512

View File

@ -1,22 +1,19 @@
from typing import List
from hexbytes.main import HexBytes
from mev_inspect.schemas import Trace
def check_call_for_signature(call, signatures):
if call["action"]["input"] == None:
def check_trace_for_signature(trace: Trace, signatures: List[str]):
if trace.action["input"] == None:
return False
## By default set this to False
signature_present_boolean = False
## Iterate over all signatures, and if our call matches any of them set it to True
## Iterate over all signatures, and if our trace matches any of them set it to True
for signature in signatures:
# print("Desired signature:", str(signature))
# print("Actual", HexBytes(call['action']['input']))
if HexBytes(call["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
print("hit")
signature_present_boolean = True
return True
return signature_present_boolean
return False