Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat upgrade rewards harvest #150

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assistant/rewards/boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
console = Console()


def convert_balances_to_usd(sett,name, userBalances):
def convert_balances_to_usd(sett, name, userBalances):
tokenAddress = sett.address
price = prices[tokenAddress]
decimals = interface.IERC20(tokenAddress).decimals()
Expand Down
2 changes: 1 addition & 1 deletion helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
"harvest.renCrv": 1,
"native.sushiWbtcEth": 1,
"yearn.wbtc": 1,
"experimental.sushiIBbtcWbtc": 1
"experimental.sushiIBbtcWbtc": 1,
}
4 changes: 3 additions & 1 deletion scripts/permissions/grant_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from helpers.gnosis_safe import ApeSafeHelper
from scripts.systems.badger_system import connect_badger
from helpers.gas_utils import gas_strategies

gas_strategies.set_default(gas_strategies.exponentialScalingFast)

to_add = "0x872213E29C85d7e30F1C8202FC47eD1Ec124BB1D"
to_remove = "0x872213E29C85d7e30F1C8202FC47eD1Ec124BB1D"


def main():
badger = connect_badger()
safe = ApeSafe(badger.devMultisig.address)
Expand All @@ -17,4 +19,4 @@ def main():
badgerTree.revokeRole(ROOT_PROPOSER_ROLE, to_remove)

helper = ApeSafeHelper(badger, safe)
helper.publish()
helper.publish()
2 changes: 1 addition & 1 deletion scripts/systems/badger_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ def getStrategy(self, id):

def getStrategyWant(self, id):
return interface.IERC20(self.sett_system.strategies[id].want())

def getSettType(self, id):
"""
Look at the artifact type of the sett and determine it's version. Currently hardcoded.
Expand Down
57 changes: 57 additions & 0 deletions scripts/upgrade/upgrade_rewards_harvest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
Script to pass governance rewards to multisig
"""
from rich.console import Console

from config.badger_config import badger_config
from scripts.systems.badger_system import BadgerSystem, connect_badger
from helpers.time_utils import days, to_days, to_utc_date
from eth_abi import encode_abi
from brownie import *


console = Console()

## def governance_queue_transaction(self, target, signature, data, eta, eth=0) -> str:
VAULT_CONTROLLER = (
"https://etherscan.io/address/0x63cF44B2548e4493Fd099222A1eC79F3344D9682"
)

GOVERNANCE_MULTISIG_ADDRESS = "0xB65cef03b9B89f99517643226d76e286ee999e77"
FUNCTION_TO_CALL = "setRewards(address)"


def test_update_rewards(badger: BadgerSystem) -> str:
controller = badger.getController("harvest")
data = encode_abi(["address"], [GOVERNANCE_MULTISIG_ADDRESS])
delay = 2 * days(2)
eta = web3.eth.getBlock("latest")["timestamp"] + delay

result = badger.timelock_run_direct(controller.address, FUNCTION_TO_CALL, data, eta)

assert controller.rewards() == GOVERNANCE_MULTISIG_ADDRESS
console.print(
"[orange] Controller Rewards {} [/orange]".format(controller.rewards())
)
return result


def update_rewards(badger: BadgerSystem) -> str:
controller = badger.getController("harvest")
data = encode_abi(["address"], [GOVERNANCE_MULTISIG_ADDRESS])
delay = 2 * days(2)
eta = web3.eth.getBlock("latest")["timestamp"] + delay

return badger.governance_queue_transaction(
controller.address, FUNCTION_TO_CALL, data, eta
)


def main():
"""
Queue Update of Controller.rewards for controller.harvest
"""
badger = connect_badger(badger_config.prod_json)

test_update_rewards(badger)
## update_rewards(badger)