Improve legibility
This commit is contained in:
parent
0cc259220d
commit
2f9dbeae08
@ -15,29 +15,21 @@ def find_liquidations_from_traces(
|
||||
|
||||
"""Inspect list of classified traces and identify liquidation"""
|
||||
|
||||
liquidations: List[ClassifiedTrace] = []
|
||||
seen_transactions: List[str] = []
|
||||
result: List[Liquidation] = []
|
||||
liquidations: List[Liquidation] = []
|
||||
|
||||
for trace in traces:
|
||||
|
||||
if isinstance(trace, DecodedCallTrace):
|
||||
if trace.classification == Classification.liquidate and isinstance(
|
||||
trace, DecodedCallTrace
|
||||
):
|
||||
|
||||
# Check for liquidation and register trace and unique liquidator
|
||||
if (
|
||||
trace.classification == Classification.liquidate
|
||||
and trace.transaction_hash not in seen_transactions
|
||||
):
|
||||
|
||||
liquidations.append(trace)
|
||||
|
||||
result.append(
|
||||
Liquidation(
|
||||
liquidated_user=trace.inputs["_user"],
|
||||
collateral_address=trace.inputs["_collateral"],
|
||||
collateral_amount=trace.inputs["_purchaseAmount"],
|
||||
reserve=trace.inputs["_reserve"],
|
||||
)
|
||||
liquidations.append(
|
||||
Liquidation(
|
||||
liquidated_user=trace.inputs["_user"],
|
||||
collateral_address=trace.inputs["_collateral"],
|
||||
collateral_amount=trace.inputs["_purchaseAmount"],
|
||||
reserve=trace.inputs["_reserve"],
|
||||
)
|
||||
)
|
||||
|
||||
return result
|
||||
return liquidations
|
||||
|
Loading…
x
Reference in New Issue
Block a user