Compare commits

...

2 Commits

@ -117,10 +117,11 @@ def payout_users():
_fa = wownero.from_atomic _fa = wownero.from_atomic
_aw = wownero.as_wownero _aw = wownero.as_wownero
for post in Post.select(): for post in Post.select():
try:
submitter = Profile.get(username=post.submitter) submitter = Profile.get(username=post.submitter)
balances = wallet.balances(post.account_index) balances = wallet.balances(post.account_index)
url = url_for('post.read', id=post.id, _external=True) url = url_for('post.read', id=post.id, _external=True)
if balances[1] > 0.1: if balances[1] > 0.05:
print(f"Post #{post.id} has {balances[1]} funds unlocked and ready to send. Sweeping all funds to user's address ({submitter.address}).") print(f"Post #{post.id} has {balances[1]} funds unlocked and ready to send. Sweeping all funds to user's address ({submitter.address}).")
sweep = wallet.sweep_all(account=post.account_index, dest_address=submitter.address) sweep = wallet.sweep_all(account=post.account_index, dest_address=submitter.address)
print(sweep) print(sweep)
@ -128,8 +129,8 @@ def payout_users():
amount = 0 amount = 0
for amt in sweep["amount_list"]: for amt in sweep["amount_list"]:
amount += int(amt) amount += int(amt)
# post_webhook(f"Paid out :moneybag: {_aw(_fa(amount))} WOW to `{post.submitter}` for post [{post.id}]({url})") except Exception as e:
# god damn you eimernase, why'd you ruin this for me? :P print(f"Failed because: {e}")
@app.cli.command("add_admin") @app.cli.command("add_admin")
@click.argument("username") @click.argument("username")

@ -87,6 +87,10 @@ def create():
try: try:
wallet = wownero.Wallet() wallet = wownero.Wallet()
account_index = wallet.new_account() account_index = wallet.new_account()
in_use = Post.select().where(Post.account_index == account_index).first()
if in_use:
flash("Suchwow wallet is fucked up! Try again later.", "is-danger")
return redirect(request.url)
except: except:
flash("Suchwow wallet is fucked up! Try again later.", "is-danger") flash("Suchwow wallet is fucked up! Try again later.", "is-danger")
return redirect(request.url) return redirect(request.url)