Update check signatures for Trace object
This commit is contained in:
parent
ba761b48ee
commit
06fce79512
@ -1,22 +1,19 @@
|
|||||||
|
from typing import List
|
||||||
|
|
||||||
from hexbytes.main import HexBytes
|
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
|
return False
|
||||||
|
|
||||||
## By default set this to False
|
## Iterate over all signatures, and if our trace matches any of them set it to True
|
||||||
signature_present_boolean = False
|
|
||||||
|
|
||||||
## Iterate over all signatures, and if our call matches any of them set it to True
|
|
||||||
for signature in signatures:
|
for signature in signatures:
|
||||||
# print("Desired signature:", str(signature))
|
if HexBytes(trace.action["input"]).startswith(signature):
|
||||||
# print("Actual", HexBytes(call['action']['input']))
|
|
||||||
|
|
||||||
if HexBytes(call["action"]["input"]).startswith((signature)):
|
|
||||||
## Note that we are turning the input into hex bytes here, which seems to be fine
|
## Note that we are turning the input into hex bytes here, which seems to be fine
|
||||||
## Working with strings was doing weird things
|
## Working with strings was doing weird things
|
||||||
print("hit")
|
return True
|
||||||
signature_present_boolean = True
|
|
||||||
|
|
||||||
return signature_present_boolean
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user