Export order and function updates
This commit is contained in:
parent
536c01c7f9
commit
356735dc5f
@ -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
|
||||
|
@ -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
|
||||
]
|
||||
)
|
||||
|
||||
|
0
tests/test_liquidation_integration.py
Normal file
0
tests/test_liquidation_integration.py
Normal file
Loading…
x
Reference in New Issue
Block a user