Add event inputs
This commit is contained in:
parent
2f9dbeae08
commit
0a770511a4
@ -1,20 +1,22 @@
|
||||
from typing import List
|
||||
|
||||
|
||||
from mev_inspect.schemas.classified_traces import (
|
||||
ClassifiedTrace,
|
||||
DecodedCallTrace,
|
||||
Classification,
|
||||
Protocol,
|
||||
)
|
||||
|
||||
from mev_inspect.schemas.liquidations import Liquidation
|
||||
|
||||
|
||||
def find_liquidations_from_traces(
|
||||
def get_liquidations(
|
||||
traces: List[ClassifiedTrace],
|
||||
) -> List[Liquidation]:
|
||||
|
||||
"""Inspect list of classified traces and identify liquidation"""
|
||||
|
||||
# liquidation_traces: List[DecodedCallTrace] = []
|
||||
liquidations: List[Liquidation] = []
|
||||
|
||||
for trace in traces:
|
||||
@ -26,10 +28,18 @@ def find_liquidations_from_traces(
|
||||
liquidations.append(
|
||||
Liquidation(
|
||||
liquidated_user=trace.inputs["_user"],
|
||||
collateral_address=trace.inputs["_collateral"],
|
||||
collateral_amount=trace.inputs["_purchaseAmount"],
|
||||
reserve=trace.inputs["_reserve"],
|
||||
liquidator_user=trace.inputs["_liquidator"],
|
||||
collateral_token_address=trace.inputs["_collateral"],
|
||||
collateral_amount=trace.inputs["_liquidatedCollateralAmount"],
|
||||
debt_token_address=trace.inputs["_reserve"],
|
||||
debt_purchase_amount=trace.inputs["_purchaseAmount"],
|
||||
# received_token_address=,
|
||||
# received_amount=,
|
||||
protocol=Protocol.aave,
|
||||
transaction_hash=trace.transaction_hash,
|
||||
block_number=trace.block_number,
|
||||
)
|
||||
)
|
||||
|
||||
print(liquidations)
|
||||
return liquidations
|
||||
|
@ -22,7 +22,7 @@ from mev_inspect.crud.transfers import delete_transfers_for_block, write_transfe
|
||||
from mev_inspect.miner_payments import get_miner_payments
|
||||
from mev_inspect.swaps import get_swaps
|
||||
from mev_inspect.transfers import get_transfers
|
||||
from mev_inspect.aave_liquidations import find_liquidations_from_traces
|
||||
from mev_inspect.aave_liquidations import get_liquidations
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -76,7 +76,7 @@ def inspect_block(
|
||||
delete_arbitrages_for_block(db_session, block_number)
|
||||
write_arbitrages(db_session, arbitrages)
|
||||
|
||||
liquidations = find_liquidations_from_traces(classified_traces)
|
||||
liquidations = get_liquidations(classified_traces)
|
||||
logger.info(f"Found {len(liquidations)} liquidations")
|
||||
|
||||
miner_payments = get_miner_payments(
|
||||
|
@ -1,9 +1,16 @@
|
||||
from pydantic import BaseModel
|
||||
from mev_inspect.schemas.classified_traces import Protocol
|
||||
|
||||
|
||||
class Liquidation(BaseModel):
|
||||
liquidated_user: str
|
||||
collateral_address: str
|
||||
liquidator_user: str
|
||||
collateral_token_address: str
|
||||
collateral_amount: int
|
||||
collateral_source: str
|
||||
reserve: str
|
||||
debt_token_address: str
|
||||
debt_purchase_amount: int
|
||||
# received_token_address: str
|
||||
# received_amount: int
|
||||
protocol: Protocol
|
||||
transaction_hash: str
|
||||
block_number: str
|
||||
|
Loading…
x
Reference in New Issue
Block a user