def main(): dai = interface.Dai("0x6B175474E89094C44Da98b954EedeAC495271d0F") dai_deposit = DaiVaultPermitDeposit.at( "0xF6f4526a05a38198dBEddFc226d30dbb5419951F") dai_vault = interface.Vault("0xBFa4D8AA6d8a379aBFe7793399D3DdaCC5bBECBB") user = accounts.load( click.prompt("Account", type=click.Choice(accounts.load()))) signer = Account.from_key(user.private_key) balance = dai.balanceOf(user) print("DAI balance:", balance.to("ether")) amount = click.prompt("Deposit amount", type=click.FloatRange(min=0)) amount = min(Wei(f"{amount} ether"), balance) permit = build_permit(str(user), str(dai_deposit), dai) signed = signer.sign_message(permit) if click.confirm("Send transaction?"): dai_deposit.deposit( amount, [user, dai_deposit, 0, 0, True, signed.v, signed.r, signed.s], {"from": user}, ) vault_balance = dai_vault.balanceOf(user) print("yvDAI balance", vault_balance.to("ether"))
"performanceFee": self.vault.performanceFee(), "strategies": {}, } except ValueError as e: print("rekt", e) info = {"strategies": {}} for strat in self.strategies: info["strategies"][strat.name] = strat.describe() return info VAULTS = [ VaultV2( name="CRV", vault=interface.Vault("0x2832817633520BF0da1b57E2Fb7bb2Fba95014F9"), strategies=[ strategies.Strategy("0xACb5eBaa9bAc72581b269077Ef4D0BA3Eefac2b7", interface.StrategyCreamCRV), ], ), VaultV2( name="DAI", vault=interface.Vault("0x9B142C2CDAb89941E9dcd0B6C1cf6dEa378A8D7C"), strategies=[ strategies.LeveragedDaiCompStrategyV2( "0x4C6e9d7E5d69429100Fcc8afB25Ea980065e2773"), ], ), VaultV2( name="WETH",
def get_vaults(): # TODO: read from registry return [ VaultV2(name=name, vault=interface.Vault(vault), strategies=[]) for name, vault in vaults.items() ]
def __init__(self, strategy, strategy_interface): self.strategy = strategy_interface(strategy) self.vault = interface.Vault(self.strategy.vault())
def get_vaults(): return [ VaultV2(name=name, vault=interface.Vault(vault), strategies=[]) for name, vault in vaults.items() ]
"performanceFee": self.vault.performanceFee(), "strategies": {}, } except ValueError as e: print("rekt", e) info = {"strategies": {}} for strat in self.strategies: info["strategies"][strat.name] = strat.describe() return info VAULTS = [ VaultV2( name="CRV", vault=interface.Vault("0x2832817633520BF0da1b57E2Fb7bb2Fba95014F9"), strategies=[ strategies.Strategy("0xACb5eBaa9bAc72581b269077Ef4D0BA3Eefac2b7", interface.StrategyCreamCRV), ], ), VaultV2( name="DAI", vault=interface.Vault("0x9B142C2CDAb89941E9dcd0B6C1cf6dEa378A8D7C"), strategies=[ strategies.LeveragedDaiCompStrategyV2( "0x4C6e9d7E5d69429100Fcc8afB25Ea980065e2773"), ], ), VaultV2( name="WETH",