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