From 5f15005f44d988eabeb2c04d8fd66191169b2a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Wypch=C5=82o?= Date: Fri, 12 Feb 2021 11:39:56 +0100 Subject: [PATCH] adjust funds notifications (#615) --- setup-scripts/funds-checker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup-scripts/funds-checker.py b/setup-scripts/funds-checker.py index d7c8fdbc..630298eb 100755 --- a/setup-scripts/funds-checker.py +++ b/setup-scripts/funds-checker.py @@ -62,15 +62,16 @@ async def check_funds(): round(unallocated_funds / sc_precision), round(allocated_funds / sc_precision) ) - # Send an alert if there is less than 1 allowance worth of money left. - if balance < allowance_funds: + # Send an alert if there is less than a certain part of allowance worth of money left in the wallet. + WALLET_ALLOWANCE_THRESHOLD = 0.3 + if balance < allowance_funds * WALLET_ALLOWANCE_THRESHOLD: wallet_address_res = siad.get("/wallet/address") wallet_msg = "Address: {}".format(wallet_address_res["address"]) message = "__Wallet balance running low!__ {} {}".format(balance_msg, wallet_msg) return await send_msg(client, message, force_notify=True) # Alert devs when only a fraction of the allowance is remaining. - SPEND_THRESHOLD = 0.8 + SPEND_THRESHOLD = 0.9 if allocated_funds >= SPEND_THRESHOLD * allowance_funds: message = "__More than {:.0%} of allowance spent!__ {}".format( SPEND_THRESHOLD, alloc_msg