Aave transfers

This commit is contained in:
Gui Heise 2021-10-13 00:53:14 -04:00
parent fc5ccc9b9b
commit cf7836896b
2 changed files with 11 additions and 14 deletions

View File

@ -11,10 +11,14 @@ from mev_inspect.schemas.classified_traces import (
Protocol,
)
<<<<<<< HEAD
<<<<<<< HEAD
=======
from mev_inspect.schemas.transfers import ERC20Transfer, aTokenTransfer, Transfer
>>>>>>> Aave transfers
=======
from mev_inspect.schemas.transfers import ERC20Transfer, Transfer
>>>>>>> Aave transfers
from mev_inspect.schemas.liquidations import Liquidation
from mev_inspect.transfers import get_transfer
@ -96,21 +100,13 @@ def _get_payback_token_and_amount(
if child.classification == Classification.transfer and isinstance(
child, DecodedCallTrace
):
if liquidation.inputs["_receiveAToken"]:
child_transfer = aTokenTransfer.from_trace(child)
child_transfer = ERC20Transfer.from_trace(child)
if (
child_transfer.to_address == liquidator
) and child.from_address in AAVE_CONTRACT_ADDRESSES:
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:
if (
child_transfer.to_address == liquidator
and child.from_address in AAVE_CONTRACT_ADDRESSES
):
return child_transfer.token_address, child_transfer.amount
return liquidation.inputs["_collateral"], 0

View File

@ -12,3 +12,4 @@ class Transfer(BaseModel):
to_address: str
amount: int
token_address: str