|
import settings |
|
from web3.auto.infura import w3 |
|
from brownie import Contract, network |
|
import datetime |
|
import time |
|
from win10toast import ToastNotifier |
|
|
|
# This script will show pending Crv to be harvested in the crvBusd vault |
|
# It will also show your share of the pending award if you supply your address in |
|
# the 'me' variable below |
|
|
|
if not w3.isConnected(): |
|
print("w3 is not connected... uh oh") |
|
exit() |
|
|
|
network.connect('mainnet') |
|
print(network.is_connected()) |
|
print(network.show_active()) |
|
|
|
busd_crv_gauge = Contract.from_explorer('0x69fb7c45726cfe2badee8317005d3f94be838840') |
|
busd_crv_vault = Contract.from_explorer('0x2994529c0652d127b7842094103715ec5299bbed') |
|
voter = Contract.from_explorer('0xF147b8125d2ef93FB6965Db97D6746952a133934') |
|
|
|
toaster = ToastNotifier() |
|
toaster.show_toast(settings.ARB_BOT_TOAST_NAME, "bot started") |
|
|
|
# This is your address where you hold yCrvBusd |
|
me = '' |
|
if (me == ''): |
|
toaster.show_toast('Warning: set your address in the script if you want to see your share') |
|
|
|
last_crv_pending = 0 |
|
my_last_share_of_crv = 0 |
|
my_last_ratio = 0 |
|
|
|
while(True): |
|
busd_crv_in_vault = busd_crv_vault.balance().to('ether') |
|
my_balance = 0 if me == '' else busd_crv_vault.balanceOf(me).to('ether') |
|
crv_pending = busd_crv_gauge.claimable_tokens.call(voter).to('ether') |
|
ratio = my_balance / busd_crv_in_vault |
|
crv_share = ratio * crv_pending |
|
|
|
if (crv_pending < last_crv_pending): |
|
toaster.show_toast(settings.ARB_BOT_TOAST_NAME, "crbBusd harvested {0} crv!".format(last_crv_pending)) |
|
|
|
if (ratio.real < float(my_last_ratio) * 0.99): |
|
toaster.show_toast(settings.ARB_BOT_TOAST_NAME, "Ratio went down to {0}!".format(ratio)) |
|
|
|
if (crv_share.real < float(my_last_share_of_crv.real) * 0.99): |
|
toaster.show_toast(settings.ARB_BOT_TOAST_NAME, "Crv share went down to {0}!".format(crv_share)) |
|
|
|
last_crv_pending = crv_pending |
|
my_last_share_of_crv = crv_share |
|
my_last_ratio = ratio |
|
|
|
print(datetime.datetime.now()) |
|
print("\tPending crv: {0}".format(crv_pending)) |
|
print("\t\tMy share of vault: {0}".format(ratio)) |
|
print("\t\tMy share of crv: {0}".format(ratio * crv_pending)) |
|
time.sleep(60) |