From 6a1a906beafa7b58c26c443f028cf4f16d654230 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Thu, 6 Jan 2022 15:33:55 -0800 Subject: [PATCH] Cosmetic --- api/logics.py | 5 ++--- api/models.py | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/logics.py b/api/logics.py index 340d9f7e..f8ebab04 100644 --- a/api/logics.py +++ b/api/logics.py @@ -131,7 +131,6 @@ class Logics(): order.save() return True, None - # 2) When maker cancels after bond '''The order dissapears from book and goes to cancelled. Maker is charged a small amount of sats, to prevent DDOS @@ -171,7 +170,7 @@ class Logics(): order.satoshis_now = cls.satoshis_now(order) bond_satoshis = int(order.satoshis_now * BOND_SIZE) - description = f'RoboSats - Maker bond for order ID {order.id}. These sats will return to you if you do not cheat!' + description = f'RoboSats - Publishing {str(order)} - This bond will return to you if you do not cheat.' # Gen HODL Invoice invoice, payment_hash, expires_at = LNNode.gen_hodl_invoice(bond_satoshis, description, BOND_EXPIRY*3600) @@ -205,7 +204,7 @@ class Logics(): order.satoshis_now = cls.satoshis_now(order) bond_satoshis = int(order.satoshis_now * BOND_SIZE) - description = f'RoboSats - Taker bond for order ID {order.id}. These sats will return to you if you do not cheat!' + description = f'RoboSats - Taking {str(order)} - This bond will return to you if you do not cheat.' # Gen HODL Invoice invoice, payment_hash, expires_at = LNNode.gen_hodl_invoice(bond_satoshis, description, BOND_EXPIRY*3600) diff --git a/api/models.py b/api/models.py index b9a5ae66..1524ef8d 100644 --- a/api/models.py +++ b/api/models.py @@ -128,6 +128,10 @@ class Order(models.Model): # buyer payment LN invoice buyer_invoice = models.ForeignKey(LNPayment, related_name='buyer_invoice', on_delete=models.SET_NULL, null=True, default=None, blank=True) + def __str__(self): + # Make relational back to ORDER + return (f'Order {self.id}: {self.Types(self.type).label} {"{:,}".format(self.t0_satoshis)} Sats for {self.Currencies(self.currency).label}') + @receiver(pre_delete, sender=Order) def delelete_HTLCs_at_order_deletion(sender, instance, **kwargs): to_delete = (instance.maker_bond, instance.buyer_invoice, instance.taker_bond, instance.trade_escrow)