|
|
|
@ -118,6 +118,7 @@ class Transactions(util.Base):
|
|
|
|
|
if len(stored_trade_reference) > 1:
|
|
|
|
|
self.log.error(f"Multiple references valid for TXID {txid}: {reference}")
|
|
|
|
|
self.irc.sendmsg(f"Multiple references valid for TXID {txid}: {reference}")
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "MULTIPLE_REFS_MATCH")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
stored_trade = False
|
|
|
|
@ -136,6 +137,7 @@ class Transactions(util.Base):
|
|
|
|
|
if not stored_trade:
|
|
|
|
|
self.log.info(f"Failed to get reference by amount and currency: {txid} {currency} {amount}")
|
|
|
|
|
self.irc.sendmsg(f"Failed to get reference by amount and currency: {txid} {currency} {amount}")
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "ALT_LOOKUP_FAILED")
|
|
|
|
|
return
|
|
|
|
|
if currency == "USD":
|
|
|
|
|
amount_usd = amount
|
|
|
|
@ -147,6 +149,10 @@ class Transactions(util.Base):
|
|
|
|
|
self.log.info("Not checking against amount and currency as amount exceeds MAX")
|
|
|
|
|
self.irc.sendmsg(f"Not checking against amount and currency as amount exceeds MAX")
|
|
|
|
|
# Close here if the amount exceeds the allowable limit for no reference
|
|
|
|
|
if len(stored_trade_reference) == 1: # better safe than sorry
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "EXCEEDS_MAX", stored_trade_reference[0])
|
|
|
|
|
else:
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "EXCEEDS_MAX")
|
|
|
|
|
return
|
|
|
|
|
# Note that we have looked it up without reference so we don't use +- below
|
|
|
|
|
# This might be redundant given the amount checks in find_trade, but better safe than sorry!
|
|
|
|
@ -156,6 +162,7 @@ class Transactions(util.Base):
|
|
|
|
|
if not stored_trade:
|
|
|
|
|
self.log.info(f"No reference in DB for {reference}")
|
|
|
|
|
self.irc.sendmsg(f"No reference in DB for {reference}")
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "NOREF", stored_trade["id"])
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
amount = float(amount)
|
|
|
|
@ -165,6 +172,7 @@ class Transactions(util.Base):
|
|
|
|
|
if not stored_trade["currency"] == currency:
|
|
|
|
|
self.log.info(f"Currency mismatch, Agora: {stored_trade['currency']} / Sink: {currency}")
|
|
|
|
|
self.irc.sendmsg(f"Currency mismatch, Agora: {stored_trade['currency']} / Sink: {currency}")
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "CURRENCY_MISMATCH", stored_trade["id"])
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# Make sure the expected amount was sent
|
|
|
|
@ -178,6 +186,7 @@ class Transactions(util.Base):
|
|
|
|
|
if not min_amount < amount < max_amount:
|
|
|
|
|
self.log.info("Amount mismatch - not in margins: {stored_trade['amount']} (min: {min_amount} / max: {max_amount}")
|
|
|
|
|
self.irc.sendmsg(f"Amount mismatch - not in margins: {stored_trade['amount']} (min: {min_amount} / max: {max_amount}")
|
|
|
|
|
self.ux.notify.notify_tx_lookup_failed(currency, amount, reference, "AMOUNT_MARGIN_MISMATCH", stored_trade["id"])
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
r.hmset(f"tx.{txid}", to_store)
|
|
|
|
|