def main(): """ Add contracts manually to guest list. They will now be approved regardless of merkle root situation """ badger = connect_badger() safe = ApeSafe(badger.testMultisig.address) helper = ApeSafeHelper(badger, safe) for strategy_key in strategies_to_approve: strategy_address = badger.getStrategy(strategy_key).address source = helper.contract_from_abi( badger.getStrategy(strategy_key).address, "StrategyConvexStakingOptimizer", StrategyConvexStakingOptimizer.abi, ) for guest_list_key in guest_lists_by_id: guestList = helper.contract_from_abi( badger.getGuestList(guest_list_key).address, "VipCappedGuestListBbtcUpgradeable", VipCappedGuestListBbtcUpgradeable.abi, ) console.print( f"Approve [green]{strategy_address}[/green] on Guest list [yellow]{guest_list_key} ({guestList.address})[/yellow]" ) guestList.setGuests([strategy_address], [True]) assert guestList.guests(strategy_address) == True helper.publish()
def main(): badger = connect_badger(load_deployer=True) safe = ApeSafe(badger.opsMultisig.address) helper = ApeSafeHelper(badger, safe) logger = helper.contract_from_abi(badger.rewardsLogger.address, "RewardsLogger", RewardsLogger.abi) schedules = [] # Concat schedules for all vaults for key in vaults_to_run: vault = badger.getSett(key) start = 1625158800 duration = days(7) end = start + duration badger_amount = Wei("360 ether") schedules.append( LoggerUnlockSchedule(( vault, badger.token.address, badger_amount, start, end, duration, )), ) # Add all schedules to logger for i in range(0, len(schedules)): schedule = schedules[i] logger.setUnlockSchedule( schedule.beneficiary, schedule.token, schedule.amount, schedule.start, schedule.end, schedule.duration, ) # Print for key in vaults_to_run: vault = badger.getSett(key) badger.print_logger_unlock_schedules(vault, name=vault.name()) helper.publish()
def main(): badger = connect_badger(load_deployer=True) safe = ApeSafe(badger.opsMultisig.address) helper = ApeSafeHelper(badger, safe) logger = helper.contract_from_abi(badger.rewardsLogger.address, "RewardsLogger", RewardsLogger.abi) schedules = build_weekly_schedules(badger, start, duration) console.print(schedules) set_schedules(logger, schedules) for key in badger.getAllSettIds(): sett = badger.getSett(key) badger.print_logger_unlock_schedules(sett.address, name=sett.name()) helper.publish()
def main(): badger = connect_badger() safe = ApeSafe(badger.testMultisig.address) helper = ApeSafeHelper(badger, safe) for source_key in to_approve: source = badger.getStrategy(source_key).address # source = helper.contract_from_abi(badger.getStrategy(source_key), "StrategyConvexStakingOptimizer", StrategyConvexStakingOptimizer.abi) for dest_key in destination_setts: destination = helper.contract_from_abi( badger.getSett(dest_key).address, "SettV3", SettV3.abi) console.print( f"Approve [green]{source}[/green] on Sett [yellow]{dest_key} ({destination.address})" ) destination.approveContractAccess(source) helper.publish()
def main(): """ Add contracts manually to guest list. They will now be approved regardless of merkle root situation """ badger = connect_badger() safe = ApeSafe(badger.testMultisig.address) helper = ApeSafeHelper(badger, safe) for sett_key in setts: sett = helper.contract_from_abi( badger.getSett(sett_key).address, "SettV4", SettV4.abi) guestList = badger.getGuestList(sett_key) old_state = { "guestList": sett.guestList(), "guestRoot": guestList.guestRoot(), "totalCap": guestList.totalDepositCap(), "userCap": guestList.userDepositCap(), "wrapper": guestList.wrapper(), } sett.setGuestList(guestList) print("proxyAdmin", badger.getProxyAdmin(guestList)) new_state = { "guestList": sett.guestList(), "guestRoot": guestList.guestRoot(), "totalCap": guestList.totalDepositCap(), "userCap": guestList.userDepositCap(), "wrapper": guestList.wrapper(), } assert new_state["guestList"] != old_state["guestList"] assert new_state["guestList"] == guestList assert new_state["guestRoot"] == old_state["guestRoot"] assert new_state["totalCap"] == old_state["totalCap"] assert new_state["userCap"] == old_state["userCap"] assert new_state["wrapper"] == old_state["wrapper"] helper.publish()
def main(): """ Add contracts manually to guest list. They will now be approved regardless of merkle root situation """ badger = connect_badger() safe = ApeSafe(badger.testMultisig.address) helper = ApeSafeHelper(badger, safe) for guest_list_key in guest_lists_by_id: guestList = helper.contract_from_abi( badger.getGuestList(guest_list_key).address, "VipCappedGuestListBbtcUpgradeable", VipCappedGuestListBbtcUpgradeable.abi, ) console.print( f"Set guest root to [green]{root}[/green] on Guest list [yellow]{guest_list_key} ({guestList.address})[/yellow]" ) guestList.setGuestRoot(root) assert guestList.guestRoot() == root helper.publish()
def main(): """ First, swap half of the USDC into DAI Deposit USDC portion in to Yearn USDC Vault V2 Deposit DAI portion in to Yearn DAI Vault V2 For the deposits, create small test transactions first """ badger = connect_badger() expectedMultisig = "0xB65cef03b9B89f99517643226d76e286ee999e77" assert badger.devMultisig == expectedMultisig safe = ApeSafe(badger.devMultisig.address) helper = ApeSafeHelper(badger, safe) # Fetch tokens for snap + interactions usdc = safe.contract("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") dai = safe.contract("0x6B175474E89094C44Da98b954EedeAC495271d0F") yDai = safe.contract("0x19D3364A399d251E894aC732651be8B0E4e85001") yUsdc = safe.contract("0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9") usdc_to_deposit = "1500000000000" usdc_to_swap = "1500000000000" ## 1.5 * 10^6 (Million) * 10^6 (Decimals) # TODO: Track the balances of the tokens representing your position here: AAVE USDC (aUSDC), Compound USDC (cUSDC), y3Crv Vault Position (y3Crv) snap = BalanceSnapshotter( [usdc, dai, yDai, yUsdc], [ badger.devMultisig, ], ) snap.snap() current_dai_balance = dai.balanceOf(badger.devMultisig.address) ## NOTE: Swap to DAI with Curve ## Coins[0] == DAI ## Coins[1] == UDC curve_pool = safe.contract("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7") dai_out = curve_pool.get_dy(1, 0, usdc_to_swap) with_slippage = dai_out * 0.99 print("With slippage") print(with_slippage) usdc.approve(curve_pool.address, usdc_to_swap) curve_pool.exchange(1, 0, usdc_to_swap, with_slippage) post_swap_balance = dai.balanceOf(badger.devMultisig.address) dai_to_deposit = post_swap_balance - current_dai_balance print("dai_to_deposit") print(dai_to_deposit) snap.snap() snap.diff_last_two() ## NOTE: Deposit DAI to Yearn ## TODO: Get balance of DAI to determine how to deposit yDaiVault = helper.contract_from_abi( "0x19D3364A399d251E894aC732651be8B0E4e85001", "yDaiVault", interface.VaultAPI.abi, ) dai.approve(yDaiVault.address, dai_to_deposit) yDaiVault.deposit(dai_to_deposit) snap.snap() snap.diff_last_two() ## NOTE: Deposit USDC to Yearn yUsdcVault = helper.contract_from_abi( "0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9", "yUsdcVault", iinterface.VaultAPI.abi, ) usdc.approve(yUsdcVault.address, usdc_to_deposit) yUsdcVault.deposit(usdc_deposit_amount) ## DONE snap.snap() snap.diff_last_two() ## Publish all Txs helper.publish()
def main(): """ Transfer badger to recipient, ensuring they are approved as recipient first Use test tx, full tx model Can convert from dollar value Assumes each token is a safeContract """ badger = connect_badger() digg = badger.digg multisig = badger.devMultisig safe = ApeSafe(multisig.address) helper = ApeSafeHelper(badger, safe) rewardsEscrow = helper.contract_from_abi(badger.rewardsEscrow.address, "RewardsEscrow", RewardsEscrow.abi) vesting = helper.contract_from_abi(badger.digg.daoDiggTimelock.address, "SimpleTimelock", SimpleTimelock.abi) # dfd = helper.contract_from_abi(registry.token_address_by_key("dfd"), "IERC20", interface.IERC20.abi) diggToken = helper.contract_from_abi(badger.digg.token.address, "IERC20", interface.IERC20.abi) transfers = [ TransferOp(badger.paymentsMultisig, badger.token, Wei("51222 ether")), # TransferOp(badger.badgerTree, badger.token, Wei("20000 ether")), # TransferOp(badger.badgerTree, dfd, Wei("200000 ether")), # TransferOp(badger.badgerRewardsManager, badger.token, Wei("10000 ether")), # TransferOp(badger.badgerRewardsManager, diggToken, Wei("2 gwei")), ] snap = BalanceSnapshotter( [badger.token, badger.digg.token], [ badger.badgerTree, badger.badgerRewardsManager, badger.devMultisig, badger.rewardsEscrow, badger.paymentsMultisig, ], ) snap.snap() rewards_escrow_tokens = [badger.token] for transfer in transfers: recipient = transfer.recipient token = transfer.token amount = transfer.amount console.print("Transfer", recipient, token, amount) # Transfer from rewards escrow if token.address in rewards_escrow_tokens: if not rewardsEscrow.isApproved(recipient): rewardsEscrow.approveRecipient(recipient) rewardsEscrow.transfer(token, recipient, amount) # Default: Transfer from treasury else: # Unlock from vesting if token.address == badger.digg.token.address: vesting.release(amount) token.transfer(recipient, amount) snap.snap() snap.diff_last_two() helper.publish()