Export order and function updates

This commit is contained in:
Gui Heise 2021-09-24 19:41:38 -04:00
parent 536c01c7f9
commit 356735dc5f
3 changed files with 18 additions and 32 deletions

View File

@ -3,7 +3,6 @@ from typing import List
from mev_inspect.traces import (
get_child_traces,
is_child_of_any_address,
is_child_trace_address,
)
from mev_inspect.schemas.classified_traces import (
ClassifiedTrace,
@ -27,34 +26,6 @@ AAVE_CONTRACT_ADDRESSES: List[str] = [
]
def _get_liquidator_payback(
child_traces: List[ClassifiedTrace], liquidator: str
) -> int:
for child in child_traces:
if child.classification == Classification.transfer:
child_transfer = ERC20Transfer.from_trace(child)
if (child_transfer.to_address == liquidator) and (
child.from_address in AAVE_CONTRACT_ADDRESSES
):
return child_transfer.amount
return 0
def _is_child_of_any_address(
trace: ClassifiedTrace, parent_liquidations: List[List[int]]
) -> bool:
return any(
[
is_child_trace_address(trace.trace_address, parent)
for parent in parent_liquidations
]
)
def get_liquidations(
traces: List[ClassifiedTrace],
) -> List[Liquidation]:
@ -96,5 +67,20 @@ def get_liquidations(
)
)
print(liquidations)
return liquidations
def _get_liquidator_payback(
child_traces: List[ClassifiedTrace], liquidator: str
) -> int:
for child in child_traces:
if child.classification == Classification.transfer:
child_transfer = ERC20Transfer.from_trace(child)
if (child_transfer.to_address == liquidator) and (
child.from_address in AAVE_CONTRACT_ADDRESSES
):
return child_transfer.amount
return 0

View File

@ -35,13 +35,13 @@ def get_child_traces(
def is_child_of_any_address(
trace: ClassifiedTrace, parent_liquidations: List[List[int]]
trace: ClassifiedTrace, parent_trace_addresses: List[List[int]]
) -> bool:
return any(
[
is_child_trace_address(trace.trace_address, parent)
for parent in parent_liquidations
for parent in parent_trace_addresses
]
)

View File