Add wallet send failsafe for dummy mode
This commit is contained in:
parent
f41e69b003
commit
1744b9ead8
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from pyotp import TOTP
|
||||
|
||||
|
@ -83,8 +84,8 @@ async def withdrawal_job(group=None):
|
|||
|
||||
# TODO: UNCOMMENT
|
||||
# COMMENTED FOR TESTING
|
||||
# if not checks["total_profit_in_xmr"] >= 0:
|
||||
# return
|
||||
if not checks["total_profit_in_xmr"] >= 0:
|
||||
return
|
||||
|
||||
total_withdrawal = sum(collapsed.values())
|
||||
if checks["total_xmr_agora"] < total_withdrawal:
|
||||
|
@ -110,7 +111,7 @@ async def withdrawal_job(group=None):
|
|||
print("NOT VALID", wallet.address)
|
||||
await sendmsg(
|
||||
group.user,
|
||||
f"Invalid XMR address: {wallet.address}",
|
||||
f"Invalid XMR address: {wallet.address}, ignored",
|
||||
title="Invalid XMR address",
|
||||
)
|
||||
continue
|
||||
|
@ -131,7 +132,7 @@ async def withdrawal_job(group=None):
|
|||
print("CAST ADDRESS", cast["address"])
|
||||
print("CAST AMOUNT", cast["amount"])
|
||||
print("CAST OTP TRUNCATED BY 2", cast["otp"][-2])
|
||||
|
||||
if not settings.DUMMY:
|
||||
sent = await run.call("wallet_send_xmr", **cast)
|
||||
print("SENT", sent)
|
||||
|
||||
|
@ -142,6 +143,7 @@ async def withdrawal_job(group=None):
|
|||
description=reason,
|
||||
)
|
||||
|
||||
if not settings.DUMMY:
|
||||
payout.response = sent
|
||||
payout.save()
|
||||
|
||||
|
|
Loading…
Reference in New Issue