Multiple liquidations tests
This commit is contained in:
parent
07763e0e3c
commit
e135830b5d
@ -89,6 +89,61 @@ class TestAaveLiquidations(unittest.TestCase):
|
||||
self.assertEqual(result[1], liquidation)
|
||||
self.assertEqual(len(result), 2)
|
||||
|
||||
def multiple_liquidations_in_block(self):
|
||||
|
||||
transaction1 = (
|
||||
"0xedd062c3a728db4b114f2e83cac281d19a9f753e36afa8a35cdbdf1e1dd5d017"
|
||||
)
|
||||
transaction2 = (
|
||||
"0x18492f250cf4735bd67a21c6cc26b7d9c59cf2fb077356dc924f36bc68a810e5"
|
||||
)
|
||||
transaction3 = (
|
||||
"0x191b05b28ebaf460e38e90ac6a801681b500f169041ae83a45b32803ef2ec98c"
|
||||
)
|
||||
block_number = 12498502
|
||||
|
||||
liquidation1 = Liquidation(
|
||||
liquidated_user="0x6c6541ae8a7c6a6f968124a5ff2feac8f0c7875b",
|
||||
liquidator_user="0x7185e240d8e9e2d692cbc68d30eecf965e9a7feb",
|
||||
collateral_token_address="0x514910771af9ca656af840dff83e8264ecf986ca",
|
||||
debt_token_address="0x4fabb145d64652a948d72533023f6e7a623c7c53",
|
||||
debt_purchase_amount=228905512631913119672,
|
||||
received_amount=10111753901939162887,
|
||||
protocol=Protocol.aave,
|
||||
transaction_hash=transaction1,
|
||||
)
|
||||
|
||||
liquidation2 = Liquidation(
|
||||
liquidated_user="0x6c6541ae8a7c6a6f968124a5ff2feac8f0c7875b",
|
||||
liquidator_user="0x19256c009781bc2d1545db745af6dfd30c7e9cfa",
|
||||
collateral_token_address="0x514910771af9ca656af840dff83e8264ecf986ca",
|
||||
debt_token_address="0x0000000000085d4780b73119b644ae5ecd22b376",
|
||||
debt_purchase_amount=497030000000000000000,
|
||||
received_amount=21996356316098208090,
|
||||
protocol=Protocol.aave,
|
||||
transaction_hash=transaction2,
|
||||
block_number=block_number,
|
||||
)
|
||||
|
||||
liquidation3 = Liquidation(
|
||||
liquidated_user="0xda874f844389df33c0fad140df4970fe1b366726",
|
||||
liquidator_user="0x7185e240d8e9e2d692cbc68d30eecf965e9a7feb",
|
||||
collateral_token_address="0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
|
||||
debt_token_address="0x57ab1ec28d129707052df4df418d58a2d46d5f51",
|
||||
debt_purchase_amount=447810000000000000000,
|
||||
received_amount=121531358145247546,
|
||||
protocol=Protocol.aave,
|
||||
transaction_hash=transaction3,
|
||||
block_number=block_number,
|
||||
)
|
||||
|
||||
block = load_test_block(block_number)
|
||||
trace_classifier = TraceClassifier()
|
||||
classified_traces = trace_classifier(block.traces)
|
||||
result = get_liquidations(classified_traces)
|
||||
|
||||
self.assertEqual(result, [liquidation1, liquidation2, liquidation3])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user