Simplify liquidation data logic
This commit is contained in:
parent
5149840a76
commit
0cc259220d
@ -31,28 +31,12 @@ def find_liquidations_from_traces(
|
|||||||
|
|
||||||
liquidations.append(trace)
|
liquidations.append(trace)
|
||||||
|
|
||||||
# Found liquidation, now parse inputs for data
|
|
||||||
for input in trace.inputs:
|
|
||||||
|
|
||||||
if input == "_purchaseAmount":
|
|
||||||
liquidation_amount = trace.inputs[input]
|
|
||||||
elif input == "_collateral":
|
|
||||||
collateral_address = trace.inputs[input]
|
|
||||||
# This will be the address of the sent token
|
|
||||||
elif input == "_reserve":
|
|
||||||
reserve = trace.inputs[input]
|
|
||||||
# This will be the address of the received token
|
|
||||||
elif input == "_user":
|
|
||||||
|
|
||||||
liquidated_user = trace.inputs[input]
|
|
||||||
# Register liquidation
|
|
||||||
result.append(
|
result.append(
|
||||||
Liquidation(
|
Liquidation(
|
||||||
liquidated_user=liquidated_user,
|
liquidated_user=trace.inputs["_user"],
|
||||||
collateral_address=collateral_address,
|
collateral_address=trace.inputs["_collateral"],
|
||||||
collateral_amount=liquidation_amount,
|
collateral_amount=trace.inputs["_purchaseAmount"],
|
||||||
collateral_source="",
|
reserve=trace.inputs["_reserve"],
|
||||||
reserve=reserve,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user