diff --git a/mev_inspect/utils.py b/mev_inspect/utils.py index f8785cc..e6f2ec9 100644 --- a/mev_inspect/utils.py +++ b/mev_inspect/utils.py @@ -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