Fix eth liquidations
This commit is contained in:
parent
a31dd7c09b
commit
3ceaf7f6cf
@ -10,7 +10,7 @@ from mev_inspect.schemas.classifiers import (
|
|||||||
SeizeClassifier,
|
SeizeClassifier,
|
||||||
)
|
)
|
||||||
from mev_inspect.schemas.liquidations import Liquidation
|
from mev_inspect.schemas.liquidations import Liquidation
|
||||||
from mev_inspect.schemas.prices import CETH_TOKEN_ADDRESS
|
from mev_inspect.schemas.prices import CETH_TOKEN_ADDRESS, ETH_TOKEN_ADDRESS
|
||||||
from mev_inspect.schemas.traces import Protocol
|
from mev_inspect.schemas.traces import Protocol
|
||||||
from mev_inspect.schemas.transfers import Transfer
|
from mev_inspect.schemas.transfers import Transfer
|
||||||
|
|
||||||
@ -32,10 +32,11 @@ class CompoundLiquidationClassifier(LiquidationClassifier):
|
|||||||
debt_purchase_amount = None
|
debt_purchase_amount = None
|
||||||
received_amount = None
|
received_amount = None
|
||||||
|
|
||||||
debt_purchase_amount = (
|
debt_purchase_amount, debt_token_address = (
|
||||||
liquidation_trace.value
|
liquidation_trace.value,
|
||||||
|
ETH_TOKEN_ADDRESS
|
||||||
if debt_token_address == CETH_TOKEN_ADDRESS and liquidation_trace.value != 0
|
if debt_token_address == CETH_TOKEN_ADDRESS and liquidation_trace.value != 0
|
||||||
else liquidation_trace.inputs["repayAmount"]
|
else liquidation_trace.inputs["repayAmount"],
|
||||||
)
|
)
|
||||||
|
|
||||||
debt_transfer = get_debt_transfer(liquidator, child_transfers)
|
debt_transfer = get_debt_transfer(liquidator, child_transfers)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from mev_inspect.classifiers.trace import TraceClassifier
|
from mev_inspect.classifiers.trace import TraceClassifier
|
||||||
from mev_inspect.liquidations import get_liquidations
|
from mev_inspect.liquidations import get_liquidations
|
||||||
from mev_inspect.schemas.liquidations import Liquidation
|
from mev_inspect.schemas.liquidations import Liquidation
|
||||||
|
from mev_inspect.schemas.prices import ETH_TOKEN_ADDRESS
|
||||||
from mev_inspect.schemas.traces import Protocol
|
from mev_inspect.schemas.traces import Protocol
|
||||||
from tests.utils import load_comp_markets, load_cream_markets, load_test_block
|
from tests.utils import load_comp_markets, load_cream_markets, load_test_block
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ def test_c_ether_liquidations(trace_classifier: TraceClassifier):
|
|||||||
Liquidation(
|
Liquidation(
|
||||||
liquidated_user="0xb5535a3681cf8d5431b8acfd779e2f79677ecce9",
|
liquidated_user="0xb5535a3681cf8d5431b8acfd779e2f79677ecce9",
|
||||||
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
||||||
debt_token_address="0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
|
debt_token_address=ETH_TOKEN_ADDRESS,
|
||||||
debt_purchase_amount=268066492249420078,
|
debt_purchase_amount=268066492249420078,
|
||||||
received_amount=4747650169097,
|
received_amount=4747650169097,
|
||||||
received_token_address="0x39aa39c021dfbae8fac545936693ac917d5e7563",
|
received_token_address="0x39aa39c021dfbae8fac545936693ac917d5e7563",
|
||||||
@ -44,7 +45,7 @@ def test_c_ether_liquidations(trace_classifier: TraceClassifier):
|
|||||||
Liquidation(
|
Liquidation(
|
||||||
liquidated_user="0x45df6f00166c3fb77dc16b9e47ff57bc6694e898",
|
liquidated_user="0x45df6f00166c3fb77dc16b9e47ff57bc6694e898",
|
||||||
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
||||||
debt_token_address="0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
|
debt_token_address=ETH_TOKEN_ADDRESS,
|
||||||
debt_purchase_amount=414547860568297082,
|
debt_purchase_amount=414547860568297082,
|
||||||
received_amount=321973320649,
|
received_amount=321973320649,
|
||||||
received_token_address="0x35a18000230da775cac24873d00ff85bccded550",
|
received_token_address="0x35a18000230da775cac24873d00ff85bccded550",
|
||||||
@ -71,7 +72,7 @@ def test_c_ether_liquidations(trace_classifier: TraceClassifier):
|
|||||||
Liquidation(
|
Liquidation(
|
||||||
liquidated_user="0xacbcf5d2970eef25f02a27e9d9cd31027b058b9b",
|
liquidated_user="0xacbcf5d2970eef25f02a27e9d9cd31027b058b9b",
|
||||||
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
liquidator_user="0xe0090ec6895c087a393f0e45f1f85098a6c33bef",
|
||||||
debt_token_address="0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
|
debt_token_address=ETH_TOKEN_ADDRESS,
|
||||||
debt_purchase_amount=1106497772527562662,
|
debt_purchase_amount=1106497772527562662,
|
||||||
received_amount=910895850496,
|
received_amount=910895850496,
|
||||||
received_token_address="0x35a18000230da775cac24873d00ff85bccded550",
|
received_token_address="0x35a18000230da775cac24873d00ff85bccded550",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user