adjust funds notifications (#615)
This commit is contained in:
parent
e91d0cb78c
commit
5f15005f44
|
@ -62,15 +62,16 @@ async def check_funds():
|
||||||
round(unallocated_funds / sc_precision), round(allocated_funds / sc_precision)
|
round(unallocated_funds / sc_precision), round(allocated_funds / sc_precision)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Send an alert if there is less than 1 allowance worth of money left.
|
# Send an alert if there is less than a certain part of allowance worth of money left in the wallet.
|
||||||
if balance < allowance_funds:
|
WALLET_ALLOWANCE_THRESHOLD = 0.3
|
||||||
|
if balance < allowance_funds * WALLET_ALLOWANCE_THRESHOLD:
|
||||||
wallet_address_res = siad.get("/wallet/address")
|
wallet_address_res = siad.get("/wallet/address")
|
||||||
wallet_msg = "Address: {}".format(wallet_address_res["address"])
|
wallet_msg = "Address: {}".format(wallet_address_res["address"])
|
||||||
message = "__Wallet balance running low!__ {} {}".format(balance_msg, wallet_msg)
|
message = "__Wallet balance running low!__ {} {}".format(balance_msg, wallet_msg)
|
||||||
return await send_msg(client, message, force_notify=True)
|
return await send_msg(client, message, force_notify=True)
|
||||||
|
|
||||||
# Alert devs when only a fraction of the allowance is remaining.
|
# 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:
|
if allocated_funds >= SPEND_THRESHOLD * allowance_funds:
|
||||||
message = "__More than {:.0%} of allowance spent!__ {}".format(
|
message = "__More than {:.0%} of allowance spent!__ {}".format(
|
||||||
SPEND_THRESHOLD, alloc_msg
|
SPEND_THRESHOLD, alloc_msg
|
||||||
|
|
Reference in New Issue