Aave transfers
This commit is contained in:
parent
f5b4e87c4c
commit
fc5ccc9b9b
@ -11,6 +11,10 @@ from mev_inspect.schemas.classified_traces import (
|
|||||||
Protocol,
|
Protocol,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
from mev_inspect.schemas.transfers import ERC20Transfer, aTokenTransfer, Transfer
|
||||||
|
>>>>>>> Aave transfers
|
||||||
from mev_inspect.schemas.liquidations import Liquidation
|
from mev_inspect.schemas.liquidations import Liquidation
|
||||||
from mev_inspect.transfers import get_transfer
|
from mev_inspect.transfers import get_transfer
|
||||||
|
|
||||||
@ -84,15 +88,29 @@ def _get_payback_token_and_amount(
|
|||||||
) -> Tuple[str, int]:
|
) -> Tuple[str, int]:
|
||||||
|
|
||||||
"""Look for and return liquidator payback from liquidation"""
|
"""Look for and return liquidator payback from liquidation"""
|
||||||
|
child: ClassifiedTrace
|
||||||
|
child_transfer: Transfer
|
||||||
|
|
||||||
for child in child_traces:
|
for child in child_traces:
|
||||||
|
|
||||||
if child.classification == Classification.transfer:
|
if child.classification == Classification.transfer and isinstance(
|
||||||
|
child, DecodedCallTrace
|
||||||
|
):
|
||||||
|
if liquidation.inputs["_receiveAToken"]:
|
||||||
|
|
||||||
child_transfer = ERC20Transfer.from_trace(child)
|
child_transfer = aTokenTransfer.from_trace(child)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
child_transfer.to_address == liquidator
|
child_transfer.to_address == liquidator
|
||||||
) and child.from_address in AAVE_CONTRACT_ADDRESSES:
|
) and child.from_address in AAVE_CONTRACT_ADDRESSES:
|
||||||
return child_transfer.token_address, child_transfer.amount
|
return child_transfer.token_address, child_transfer.amount
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
child_transfer = ERC20Transfer.from_trace(child)
|
||||||
|
|
||||||
|
if (
|
||||||
|
child_transfer.to_address == liquidator
|
||||||
|
) and child.from_address in AAVE_CONTRACT_ADDRESSES:
|
||||||
|
|
||||||
return liquidation.inputs["_collateral"], 0
|
return liquidation.inputs["_collateral"], 0
|
||||||
|
@ -2,10 +2,8 @@ from typing import List
|
|||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
ETH_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
ETH_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
||||||
|
|
||||||
|
|
||||||
class Transfer(BaseModel):
|
class Transfer(BaseModel):
|
||||||
block_number: int
|
block_number: int
|
||||||
transaction_hash: str
|
transaction_hash: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user