output for testing
This commit is contained in:
parent
244be7e990
commit
da83fe27fc
@ -32,8 +32,8 @@ def liquidations(traces: List[ClassifiedTrace]):
|
|||||||
all_traces.append(trace)
|
all_traces.append(trace)
|
||||||
liquidator = trace.from_address
|
liquidator = trace.from_address
|
||||||
if liquidator not in addrs: addrs.append(liquidator)
|
if liquidator not in addrs: addrs.append(liquidator)
|
||||||
print(f"Liquidation found: {liquidator}")
|
print(f"\nLiquidation found: \n\t{liquidator}")
|
||||||
print(f"Hash: {trace.transaction_hash}")
|
print(f"\nHash: \n\t{trace.transaction_hash}\n")
|
||||||
|
|
||||||
# Found liquidation, now parse inputs for data
|
# Found liquidation, now parse inputs for data
|
||||||
for i in trace.inputs:
|
for i in trace.inputs:
|
||||||
@ -58,38 +58,37 @@ def liquidations(traces: List[ClassifiedTrace]):
|
|||||||
protocols=[trace.protocol],)
|
protocols=[trace.protocol],)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check for transfer from liquidator
|
# Check for transfer from a registered liquidator
|
||||||
elif (
|
elif (
|
||||||
trace.classification == Classification.transfer and
|
trace.classification == Classification.transfer and
|
||||||
'sender' in trace.inputs and
|
'sender' in trace.inputs and
|
||||||
trace.inputs['sender'] in addrs and
|
trace.inputs['sender'] in addrs
|
||||||
trace.inputs['amount'] not in transfers
|
):
|
||||||
):
|
|
||||||
|
|
||||||
liquidator = next(addrs[i] for i in range(len(addrs)) if trace.inputs['sender'] == addrs[i])
|
liquidator = next(addrs[i] for i in range(len(addrs)) if trace.inputs['sender'] == addrs[i])
|
||||||
transfers.append(trace)
|
transfers.append(trace)
|
||||||
|
|
||||||
print(f"""
|
print(f"""
|
||||||
\nTransfer from liquidator {liquidator}:
|
\nTransfer from liquidator {liquidator}:
|
||||||
\nAmount in received token: {trace.inputs['amount']} to
|
\n\tAmount in received token: {trace.inputs['amount']} to
|
||||||
\n{trace.inputs['recipient']}
|
\n\t{trace.inputs['recipient']}
|
||||||
\nTransaction: {trace.transaction_hash}
|
\n\tTransaction: {trace.transaction_hash}\n
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# Check for transfer to liquidator
|
# Check for transfer to a registered liquidator
|
||||||
elif (
|
elif (
|
||||||
trace.classification == Classification.transfer and
|
trace.classification == Classification.transfer and
|
||||||
trace.inputs['recipient'] in addrs
|
trace.inputs['recipient'] in addrs
|
||||||
):
|
):
|
||||||
|
|
||||||
liquidator = next(addrs[i] for i in range(len(addrs)) if trace.inputs['recipient'] == addrs[i])
|
liquidator = next(addrs[i] for i in range(len(addrs)) if trace.inputs['recipient'] == addrs[i])
|
||||||
transfers.append(trace)
|
transfers.append(trace)
|
||||||
|
|
||||||
print(f"""
|
print(f"""
|
||||||
\nTransfer to liquidator {liquidator}:
|
\nTransfer to liquidator {liquidator}:
|
||||||
\nAmount in received token: {trace.inputs['amount']} from
|
\n\tAmount in received token: {trace.inputs['amount']} from
|
||||||
\n{trace.from_address}
|
\n\t{trace.from_address}
|
||||||
\nTransaction: {trace.transaction_hash}
|
\n\tTransaction: {trace.transaction_hash}\n
|
||||||
""")
|
""")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user