Exemplo n.º 1
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    account_name = input(f"What account to use?: ")
    dev = accounts.load(account_name)
    print(f"You are using: 'dev' [{dev.address}]")
    token = Token.at(get_address("ERC20 Token: "))
    #token = Token.at("0x6B175474E89094C44Da98b954EedeAC495271d0F")
    #gov = get_address("yEarn Governance: ")
    gov = dev
    #rewards = get_address("Rewards contract: ")
    rewards = dev
    #name = input(f"Set description ['yearn {token.name()}']: ") or ""
    name = "yDAI Test Vault V2"
    #symbol = input(f"Set symbol ['y{token.symbol()}']: ") or ""
    symbol = 'ytDAI'
    print(f"""
    Vault Parameters

   version: {PACKAGE_VERSION}
     token: {token.address}
  governer: {gov}
   rewards: {rewards}
      name: '{name or 'yearn ' + token.name()}'
    symbol: '{symbol or 'y' + token.symbol()}'
    """)
    if input("Deploy New Vault? y/[N]: ").lower() != "y":
        return
    print("Deploying Vault...")
    vault = Vault.deploy(token, gov, rewards, name, symbol, {
        'from': dev,
        'gas_price': Wei("15 gwei")
    })
Exemplo n.º 2
0
def main():
    deployer = accounts.load(input("deployer account: "))

    if input("deploy vault? y/n: ") == "y":
        gov = get_address("gov")
        rewards = get_address("rewards")
        vault = Vault.deploy(
            "0x59A19D8c652FA0284f44113D0ff9aBa70bd46fB4",
            gov,
            rewards,
            "Balancer BAL-WETH 80-20 Pool yVault",
            "yvBal-BAL-WETH-80-20",
            {"from": deployer},
        )
    else:
        vault = Vault.at(get_address("vault"))

    strategy = StrategyBalancerLP.deploy(vault, {"from": deployer})

    deposit_limit = Wei('50 ether')
    vault.setDepositLimit(deposit_limit, {"from": deployer})
    vault.addStrategy(strategy, deposit_limit, deposit_limit, 0,
                      {"from": deployer})

    secho(
        f"deployed {config['symbol']}\nvault: {vault}\nstrategy: {strategy}\n",
        fg="green",
    )
Exemplo n.º 3
0
def main():
    configurations = json.load(open("configurations.json"))
    for i, config in enumerate(configurations["vaults"]):
        print(f"[{i}] {config['name']}")
    config = configurations["vaults"][int(
        input("choose configuration to deploy: "))]
    deployer = accounts.load(input("deployer account: "))

    if input('deploy vault? y/n: ') == 'y':
        gov = get_address("gov")
        rewards = get_address("rewards")
        vault = Vault.deploy(
            config["want"],
            gov,
            rewards,
            config["name"],
            config["symbol"],
            {"from": deployer},
        )
    else:
        vault = Vault.at(get_address('vault'))

    strategy = StrategyUniswapPairPickle.deploy(vault, config["jar"],
                                                config["pid"],
                                                {"from": deployer})
    secho(
        f"deployed {config['symbol']}\nvault: {vault}\nstrategy: {strategy}\n",
        fg="green",
    )
Exemplo n.º 4
0
def main():
    guest = "0xcB16133a37Ef19F90C570B426292BDcca185BF47"
    gov = "0x9b5f6921302cc0560fE2eE72E8fcED9D5D26123d"
    rewards = "0x93A62dA5a14C80f265DAbC077fCEE437B1a0Efde"
    configurations = json.load(open("configurations.json"))
    for i, config in enumerate(configurations["vaults"]):
        print(f"[{i}] {config['name']}")
    config = configurations["vaults"][int(
        input("choose configuration to deploy: "))]
    deployer = accounts.load(input("deployer account: "))

    if input("deploy vault? y/n: ") == "y":
        # gov = get_address("gov")
        # rewards = get_address("rewards")
        vault = Vault.deploy(
            config["want"],
            gov,
            rewards,
            config["name"],
            config["symbol"],
            {
                "from": deployer,
                "gas_price": Wei("25 gwei")
            },
        )
    else:
        vault = Vault.at(get_address("vault"))

    strategy = StrategySushiswapPair.deploy(vault, config["pid"], {
        "from": deployer,
        "gas_price": Wei("25 gwei")
    })

    deposit_limit = Wei('10 ether')
    vault.setDepositLimit(deposit_limit, {
        "from": deployer,
        "gas_price": Wei("25 gwei")
    })
    vault.addStrategy(strategy, deposit_limit, deposit_limit, 1000, {
        "from": deployer,
        "gas_price": Wei("25 gwei")
    })

    gov = "0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52"

    vault.setGovernance(gov, {"from": deployer, "gas_price": Wei("25 gwei")})

    secho(
        f"deployed {config['symbol']}\nvault: {vault}\nstrategy: {strategy}\n",
        fg="green",
    )
Exemplo n.º 5
0
def main():
    click.echo(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load())))
    click.echo(f"You are using: 'dev' [{dev.address}]")

    registry = Registry.at(
        get_address("Vault Registry", default="v2.registry.ychad.eth")
    )

    latest_release = Version(registry.latestRelease())
    num_releases = registry.numReleases() - 1
    target_release_index = num_releases
    release_delta = 0
    click.echo(
        f"""
        Release Information

        latest release version: {latest_release}
          latest release index: {num_releases}
         local package version: {PACKAGE_VERSION}
        """
    )
    use_proxy = False  # NOTE: Use a proxy to save on gas for experimental Vaults
    if Version(PACKAGE_VERSION) <= latest_release:
        click.echo(
            f"""
        Recommended Releases

        DO NOT USE => 0-2
        0.3.2 => 3
        0.3.3 => 4
        0.3.4 => 5 (DO NOT USE) 
        0.3.5 => 6
        0.4.0 => 7 (DO NOT USE)
        0.4.1 => 8
        """
        )
        target_release_index = click.prompt(
            "Please select a target release index from options or press enter for latest release:",
            type=click.Choice([str(i) for i in range(num_releases + 1)]),
            default=num_releases,
        )
        if click.confirm("Deploy a Proxy Vault", default="Y"):
            use_proxy = True
    elif Version(PACKAGE_VERSION) > latest_release:
        target_release_index = num_releases + 1
        if not click.confirm(f"Deploy {PACKAGE_VERSION} as new release"):
            return

    token = Token.at(get_address("ERC20 Token"))

    if use_proxy:
        gov_default = (
            "0x16388463d60FFE0661Cf7F1f31a7D658aC790ff7"  # strategist msig, no ENS
        )
    else:
        gov_default = "ychad.eth"
    gov = get_address("Yearn Governance", default=dev.address)

    rewards = get_address("Rewards contract", default="treasury.ychad.eth")
    guardian = get_address("Vault Guardian", default="dev.ychad.eth")
    management = get_address("Vault Management", default="brain.ychad.eth")
    name = click.prompt(f"Set description", default=DEFAULT_VAULT_NAME(token))
    symbol = click.prompt(f"Set symbol", default=DEFAULT_VAULT_SYMBOL(token))
    release_delta = num_releases - target_release_index
    target_release = (
        Vault.at(registry.releases(target_release_index)).apiVersion()
        if release_delta >= 0
        else PACKAGE_VERSION
    )

    click.echo(
        f"""
    Vault Deployment Parameters

         use proxy: {use_proxy}
    target release: {target_release}
     release delta: {release_delta}
     token address: {token.address}
      token symbol: {DEFAULT_VAULT_SYMBOL(token)}
        governance: {gov}
        management: {management}
           rewards: {rewards}
          guardian: {guardian}
              name: '{name}'
            symbol: '{symbol}'
    """
    )

    if click.confirm("Deploy New Vault"):
        args = [
            token,
            gov,
            rewards,
            # NOTE: Empty string `""` means no override (don't use click default tho)
            name if name != DEFAULT_VAULT_NAME(token) else "",
            symbol if symbol != DEFAULT_VAULT_SYMBOL(token) else "",
        ]
        if use_proxy:
            # NOTE: Must always include guardian, even if default
            args.insert(2, guardian)
            args.append(release_delta)
            txn_receipt = registry.newExperimentalVault(*args, {"from": dev, "gas_price": Wei('9 gwei'), "required_confs": 0})
            vault = Vault.at(txn_receipt.events["NewExperimentalVault"]["vault"])
            click.echo(f"Experimental Vault deployed [{vault.address}]")
            click.echo("    NOTE: Vault is not registered in Registry!")
        else:
            args.append(guardian)
            args.append(management)
            vault = Vault.deploy({"from": dev, "gas_price": Wei('9 gwei'), "required_confs": 0})
            vault.initialize(*args)
            click.echo(f"New Vault Release deployed [{vault.address}]")
            click.echo(
                "    NOTE: Vault is not registered in Registry, please register!"
            )