mango-explorer/tests/test_liquidationevent.py

35 lines
1.2 KiB
Python
Raw Normal View History

from .context import mango
from .fakes import fake_public_key, fake_token
from decimal import Decimal
import datetime
def test_liquidation_event():
balances_before = [
mango.TokenValue(fake_token("ETH"), Decimal(1)),
mango.TokenValue(fake_token("BTC"), Decimal("0.1")),
mango.TokenValue(fake_token("USDT"), Decimal(1000))
]
balances_after = [
mango.TokenValue(fake_token("ETH"), Decimal(1)),
mango.TokenValue(fake_token("BTC"), Decimal("0.05")),
mango.TokenValue(fake_token("USDT"), Decimal(2000))
]
timestamp = datetime.datetime(2021, 5, 17, 12, 20, 56)
event = mango.LiquidationEvent(timestamp, "Liquidator", "Group", True, ["signature"],
fake_public_key(), fake_public_key(),
balances_before, balances_after)
assert str(event) == """« 🥭 Liqudation Event ✅ at 2021-05-17 12:20:56
💧 Liquidator: Liquidator
🗃 Group: Group
📇 Signatures: ['signature']
👛 Wallet: 11111111111111111111111111111112
💳 Margin Account: 11111111111111111111111111111112
💸 Changes:
0.00000000 ETH
-0.05000000 BTC
1,000.00000000 USDT
»"""