예제 #1
0
def test_can_withdraw(staked_3pool, tripool_rewards):
    dai = Contract("dai")
    staked_3pool.unape_balanced(Contract("3pool"))
    assert dai.balanceOf(staked_3pool) > 0
예제 #2
0
def strategy_ecrv_live_old():
    yield Contract("0xB5F6747147990c4ddCeBbd0d4ef25461a967D079")
예제 #3
0
def voter_proxy():
    yield Contract("0x9a165622a744C20E3B2CB443AeD98110a33a231b")
예제 #4
0
def token():
    token_address = "0x8888801af4d980682e47f1a9036e589479e835c5"  # this should be the address of the ERC-20 used by the strategy/vault (DAI)
    yield Contract(token_address)
예제 #5
0
def weth():
    token_address = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
    yield Contract(token_address)
예제 #6
0
def xdai():
    acct = accounts.load("curve-deploy")
    for addr in XDAI:
        streamer = Contract(addr)
        token = streamer.reward_tokens(0)
        streamer.notify_reward_amount(token, {"from": acct})
예제 #7
0
def test_no_emissions(chain, usdc, whale, gov, strategist, rando, vault,
                      Strategy, strategy, GenericAave, aUsdc):
    # Clone magic
    vault = Contract("0xa5cA62D95D24A4a350983D5B8ac4EB8638887396"
                     )  # using SUSD vault (it is not in the LP program)

    tx = strategy.clone(vault)
    cloned_strategy = Strategy.at(tx.return_value)
    cloned_strategy.setWithdrawalThreshold(strategy.withdrawalThreshold(),
                                           {"from": vault.governance()})
    cloned_strategy.setDebtThreshold(strategy.debtThreshold(),
                                     {"from": vault.governance()})
    cloned_strategy.setProfitFactor(strategy.profitFactor(),
                                    {"from": vault.governance()})
    cloned_strategy.setMaxReportDelay(strategy.maxReportDelay(),
                                      {"from": vault.governance()})

    assert cloned_strategy.numLenders() == 0
    aSUSD = interface.IAToken(
        "0x6c5024cd4f8a59110119c56f8933403a539555eb")  # aSUSD
    # Clone the aave lender
    original_aave = GenericAave.at(strategy.lenders(strategy.numLenders() - 1))
    tx = original_aave.cloneAaveLender(cloned_strategy, "ClonedAaveSUSD",
                                       aSUSD, False,
                                       {"from": vault.governance()})
    cloned_lender = GenericAave.at(tx.return_value)
    assert cloned_lender.lenderName() == "ClonedAaveSUSD"

    cloned_strategy.addLender(cloned_lender, {"from": vault.governance()})
    currency = interface.ERC20(
        "0x57ab1ec28d129707052df4df418d58a2d46d5f51")  #sUSD
    susd_whale = "0x49be88f0fcc3a8393a59d3688480d7d253c37d2a"
    currency.transfer(strategist, 100e18, {'from': susd_whale})
    starting_balance = currency.balanceOf(strategist)

    decimals = currency.decimals()

    currency.approve(vault, 2**256 - 1, {"from": whale})
    currency.approve(vault, 2**256 - 1, {"from": strategist})

    deposit_limit = 1_000_000_000 * (10**(decimals))
    debt_ratio = 10_000
    vault.updateStrategyDebtRatio(vault.withdrawalQueue(0), 0,
                                  {'from': vault.governance()})
    vault.updateStrategyDebtRatio(vault.withdrawalQueue(1), 0,
                                  {'from': vault.governance()})
    vault.addStrategy(cloned_strategy, debt_ratio, 0, 2**256 - 1, 500,
                      {"from": vault.governance()})
    vault.setDepositLimit(deposit_limit, {"from": vault.governance()})

    assert deposit_limit == vault.depositLimit()
    with brownie.reverts():
        cloned_lender.setIsIncentivised(True, {'from': strategist})
    # ------------------ set up proposal ------------------

    # chain.sleep(12 * 3600) # to be able to execute
    # chain.mine(1)
    # print("executing proposal 11") # to be able to test before the proposal is executed
    # executor = Contract.from_abi("AaveGovernanceV2", "0xec568fffba86c094cf06b22134b23074dfe2252c", executor_abi, owner="0x30fe242a69d7694a931791429815db792e24cf97")
    # tx = executor.execute(11)

    # should fail because sUSD is not incentivised
    with brownie.reverts():
        cloned_lender.setIsIncentivised(True, {'from': strategist})
# our humble strategist deposits some test funds
    depositAmount = 50 * (10**(decimals))
    vault.deposit(depositAmount, {"from": strategist})

    assert cloned_strategy.estimatedTotalAssets() == 0
    chain.mine(1)
    assert cloned_strategy.harvestTrigger(1) == True

    cloned_strategy.harvest({"from": strategist})

    assert (cloned_strategy.estimatedTotalAssets() >= depositAmount * 0.999999
            )  # losing some dust is ok

    assert cloned_strategy.harvestTrigger(1) == False

    assert cloned_lender.harvestTrigger(1) == False  # harvest is unavailable

    with brownie.reverts():
        cloned_lender.harvest({'from':
                               strategist})  # if called, it does not revert

    assert cloned_lender.harvestTrigger(1) == False

    chain.sleep(10 * 3600 * 24 + 1)  # we wait 10 days for the cooldown period
    chain.mine(1)

    assert cloned_lender.harvestTrigger(1) == False  # always unavailable

    cloned_strategy.harvest({'from': strategist})
    chain.sleep(6 * 3600)
    chain.mine(1)
    vault.withdraw({"from": strategist})
예제 #8
0
def pool_token():
    yield Contract("0x0cec1a9154ff802e7934fc916ed7ca50bde6844e")
예제 #9
0
def comp_bonus():  # making uni the bonus for this test, since comp is the want
    yield Contract("0x1f9840a85d5af5bf1d1762f925bdaddc4201f984")
예제 #10
0
def comp_want_pool():
    yield Contract("0xBC82221e131c082336cf698F0cA3EBd18aFd4ce7")
예제 #11
0
def uni_want_pool():
    yield Contract("0x0650d780292142835F6ac58dd8E2a336e87b4393")
예제 #12
0
def uni():
    yield Contract("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D")
예제 #13
0
def test_operation(pm, chain):
    dai_liquidity = accounts.at("0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",
                                force=True)  # using curve pool (lots of dai)

    crv3_liquidity = accounts.at("0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
                                 force=True)  # yearn treasury (lots of crv3)

    altCRV_liquidity = accounts.at(
        "0xe6e6e25efda5f69687aa9914f8d750c523a1d261",
        force=True)  # giant amount

    rewards = accounts[2]
    gov = accounts[3]
    guardian = accounts[4]
    bob = accounts[5]
    alice = accounts[6]
    strategist = accounts[7]
    tinytim = accounts[8]

    dai = Contract("0x6b175474e89094c44da98b954eedeac495271d0f",
                   owner=gov)  # DAI token

    dai.approve(dai_liquidity, Wei("1000000 ether"), {"from": dai_liquidity})
    dai.transferFrom(dai_liquidity, gov, Wei("300000 ether"),
                     {"from": dai_liquidity})

    crv3 = Contract("0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
                    owner=gov)  # crv3 token address (threePool)

    altCRV = Contract("0x1AEf73d49Dedc4b1778d0706583995958Dc862e6",
                      owner=gov)  # altCRV token (mUSDCrv)

    crv3.approve(crv3_liquidity, Wei("1000000 ether"),
                 {"from": crv3_liquidity})
    crv3.transferFrom(crv3_liquidity, gov, Wei("100 ether"),
                      {"from": crv3_liquidity})

    altCRV.approve(altCRV_liquidity, Wei("1000000 ether"),
                   {"from": altCRV_liquidity})
    altCRV.transferFrom(altCRV_liquidity, gov, Wei("1000 ether"),
                        {"from": altCRV_liquidity})

    # config dai vault.
    Vault = pm(config["dependencies"][0]).Vault
    yDAI = Vault.deploy({"from": gov})
    yDAI.initialize(dai, gov, rewards, "", "", {"from": gov})
    yDAI.setDepositLimit(Wei("1000000 ether"))

    threePool = Contract("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
                         owner=gov)  # crv3 pool address (threePool)
    altCrvPool = Contract("0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6",
                          owner=gov)  # atlCrvPool pool address (musdCrv)
    targetVault = Contract("0x0FCDAeDFb8A7DfDa2e9838564c5A1665d856AFDF",
                           owner=gov)  # target vault (musdCrv)
    targetVaultStrat = Contract("0xBA0c07BBE9C22a1ee33FE988Ea3763f21D0909a0",
                                owner=gov)  # targetVault strat (threePool)
    targetVaultStratOwner = Contract(
        "0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52",
        owner=gov)  # targetVault stratOwner (threePool)

    strategy = guardian.deploy(StrategyDAImUSDv2, yDAI, dai, threePool,
                               targetVault, crv3, altCRV, altCrvPool)
    strategy.setStrategist(strategist)

    yDAI.addStrategy(strategy, 10_000, 0, 0, {"from": gov})

    dai.approve(gov, Wei("1000000 ether"), {"from": gov})
    dai.transferFrom(gov, bob, Wei("1000 ether"), {"from": gov})
    dai.transferFrom(gov, alice, Wei("4000 ether"), {"from": gov})
    dai.transferFrom(gov, tinytim, Wei("10 ether"), {"from": gov})
    dai.approve(yDAI, Wei("1000000 ether"), {"from": bob})
    dai.approve(yDAI, Wei("1000000 ether"), {"from": alice})
    dai.approve(yDAI, Wei("1000000 ether"), {"from": tinytim})
    crv3.approve(gov, Wei("1000000 ether"), {"from": gov})
    yDAI.approve(gov, Wei("1000000 ether"), {"from": gov})
    targetVault.approve(gov, Wei("1000000 ether"), {"from": gov})
    altCRV.approve(gov, Wei("1000000 ether"), {"from": gov})
    dai.approve(threePool, Wei("1000000 ether"), {"from": gov})
    crv3.approve(altCrvPool, Wei("1000000 ether"), {"from": gov})

    targetVaultStrat.setStrategistReward(0, {"from": targetVaultStratOwner})
    targetVaultStrat.setTreasuryFee(0, {"from": targetVaultStratOwner})
    targetVaultStrat.setWithdrawalFee(0, {"from": targetVaultStratOwner})

    # users deposit to vault
    yDAI.deposit(Wei("1000 ether"), {"from": bob})
    yDAI.deposit(Wei("4000 ether"), {"from": alice})
    yDAI.deposit(Wei("10 ether"), {"from": tinytim})

    a = yDAI.pricePerShare()

    chain.mine(1)

    strategy.harvest({"from": gov})

    assert targetVault.balanceOf(strategy) > 0
    chain.sleep(3600 * 24 * 7 * 10)
    chain.mine(1)
    a = yDAI.pricePerShare()

    # small profit
    t = targetVault.getPricePerFullShare()
    c = strategy.estimatedTotalAssets()
    targetVaultStrat.harvest({"from": targetVaultStratOwner})
    s = targetVault.getPricePerFullShare()
    d = strategy.estimatedTotalAssets()
    assert t < s
    assert d > c

    assert yDAI.strategies(strategy).dict()['totalDebt'] < d

    strategy.harvest({"from": gov})
    chain.mine(1)

    b = yDAI.pricePerShare()

    assert b > a

    #withdrawals have a slippage protection parameter, defaults to 1 = 0.01%.
    #overwriting here to be 1.5%, to account for slippage from multiple hops.
    #slippage also counts "beneficial" slippage, such as DAI being overweight in these pools
    #d = yUSDT3.balanceOf(alice)

    c = yDAI.balanceOf(alice)

    yDAI.withdraw(c, alice, 150, {"from": alice})

    assert dai.balanceOf(alice) > 0
    assert dai.balanceOf(strategy) == 0
    assert dai.balanceOf(bob) == 0
    assert targetVault.balanceOf(strategy) > 0

    d = yDAI.balanceOf(bob)
    yDAI.withdraw(d, bob, 150, {"from": bob})

    assert dai.balanceOf(bob) > 0
    assert dai.balanceOf(strategy) == 0

    e = yDAI.balanceOf(tinytim)
    yDAI.withdraw(e, tinytim, 150, {"from": tinytim})

    assert dai.balanceOf(tinytim) > 0
    assert dai.balanceOf(strategy) == 0

    # We should have made profit
    assert yDAI.pricePerShare() > 1

    #print("\ntinytim", dai.balanceOf(tinytim)/1e18)
    #print("\nbob", dai.balanceOf(bob)/1e18)
    #print("\nalice", dai.balanceOf(alice)/1e18)
    #print("\nvault", targetVault.balanceOf(strategy)/1e18)

    pass
예제 #14
0
 def __init__(self, name, vault):
     self.name = name
     self.vault = Contract(vault)
     self.token = self.vault.token()
     self.scale = 10**self.vault.decimals()
def test_fee_distribution():

    alice = accounts[0]
    lp_tripool = Contract("0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490")

    # get list of active pools
    provider = Contract("0x0000000022D53366457F9d5E68Ec105046FC4383")
    registry = Contract(provider.get_registry())
    pool_list = [
        Contract(registry.pool_list(i)) for i in range(registry.pool_count())
    ]

    # deploy new pool proxy
    proxy = PoolProxy.deploy(alice, alice, alice, {"from": alice})

    # transfer ownership of all pools to new pool proxy
    for pool in pool_list:
        owner = pool.owner()
        pool.commit_transfer_ownership(proxy, {"from": owner})

    chain.sleep(86400 * 3)

    for pool in pool_list:
        owner = pool.owner()
        pool.apply_transfer_ownership({"from": owner})

    # yes, we are traveling back in time here
    # this is necessary so that SNX oracle data is not considered outdated
    chain.mine(timestamp=history[0].timestamp)

    # deploy the fee distributor
    distributor = FeeDistributor.deploy(
        "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",  # VotingEscrow
        chain.time(),
        lp_tripool,
        alice,
        alice,
        {"from": alice},
    )

    # deploy the burners
    underlying_burner = UnderlyingBurner.deploy(distributor, alice, alice,
                                                alice, {"from": alice})
    MetaBurner.deploy(distributor, alice, alice, alice, {"from": alice})
    usdn_burner = USDNBurner.deploy(proxy, distributor, alice, alice, alice,
                                    {"from": alice})

    btc_burner = BTCBurner.deploy(underlying_burner, alice, alice, alice,
                                  {"from": alice})
    ETHBurner.deploy(underlying_burner, alice, alice, alice, {"from": alice})
    EuroBurner.deploy(underlying_burner, alice, alice, alice, {"from": alice})

    ABurner.deploy(underlying_burner, alice, alice, alice, {"from": alice})
    CBurner.deploy(underlying_burner, alice, alice, alice, {"from": alice})
    YBurner.deploy(underlying_burner, alice, alice, alice, {"from": alice})

    lp_burner = LPBurner.deploy(alice, alice, alice, {"from": alice})

    # set LP burner to unwrap sbtcCRV -> sBTC and transfer to BTC burner
    lp_burner.set_swap_data(
        "0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3",
        "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6",
        btc_burner,
    )

    # set the burners within pool proxy
    to_set = [(k[-1], x) for k, v in BURNERS.items() for x in v]
    burners = [i[0] for i in to_set] + [ZERO_ADDRESS] * (40 - len(to_set))
    coins = [i[1] for i in to_set] + [ZERO_ADDRESS] * (40 - len(to_set))

    coin_list = [Contract(x) for v in BURNERS.values() for x in v]
    burner_list = [k[-1] for k in BURNERS.keys()]

    proxy.set_many_burners(coins[:20], burners[:20], {"from": alice})
    proxy.set_many_burners(coins[20:], burners[20:], {"from": alice})
    proxy.set_burner(lp_tripool, distributor, {"from": alice})

    # approve USDN burner to donate to USDN pool
    proxy.set_donate_approval("0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1",
                              usdn_burner, True, {"from": alice})

    # withdraw pool fees to pool proxy
    proxy.withdraw_many(pool_list[:20], {"from": alice})
    proxy.withdraw_many(
        pool_list[20:] + [ZERO_ADDRESS] * (20 - len(pool_list[20:])),
        {"from": alice})

    # individually execute the burners for each coin
    for coin in coin_list + [lp_tripool]:
        if coin == "0x57ab1ec28d129707052df4df418d58a2d46d5f51":
            # for sUSD we settle manually to avoid a ganache bug
            chain.sleep(700)
            Contract("0x0bfDc04B38251394542586969E2356d0D731f7DE").settle(
                underlying_burner,
                "0x7355534400000000000000000000000000000000000000000000000000000000",
                {"from": alice},
            )
        proxy.burn(coin, {"from": alice})

    # call execute on underlying burner
    underlying_burner.execute({"from": alice})

    # verify zero-balances for all tokens in all contracts
    for coin in coin_list:
        for burner in burner_list:
            assert coin.balanceOf(burner) < 2
        assert coin.balanceOf(proxy) < 2
        assert coin.balanceOf(alice) < 2
        assert coin.balanceOf(distributor) < 2

    # verify zero-balance for 3CRV
    for burner in burner_list:
        assert lp_tripool.balanceOf(burner) == 0
    assert lp_tripool.balanceOf(proxy) == 0
    assert lp_tripool.balanceOf(alice) == 0

    # verify that fee distributor has received 3CRV
    amount = lp_tripool.balanceOf(distributor)
    assert amount > 0
    print(f"Success! Final 3CRV balance in distributor: {amount/1e18:.4f}")
예제 #16
0
def uni_bonus():
    yield Contract("0xc00e94cb662c3520282e6f5717214004a7f26888")
예제 #17
0
def polygon():
    acct = accounts.load("curve-deploy")
    for addr in POLYGON:
        streamer = Contract(addr)
        token = streamer.reward_tokens(0)
        streamer.notify_reward_amount(token, {"from": acct, "gas_price": "30 gwei"})
예제 #18
0
def comp_faucet():
    yield Contract("0x72F06a78bbAac0489067A1973B0Cef61841D58BC")
예제 #19
0
def test_aave_rewards(chain, usdc, whale, gov, strategist, rando, vault,
                      Strategy, strategy, GenericAave, aUsdc):
    # Clone magic
    tx = strategy.clone(vault)
    cloned_strategy = Strategy.at(tx.return_value)
    cloned_strategy.setWithdrawalThreshold(strategy.withdrawalThreshold(),
                                           {"from": gov})
    cloned_strategy.setDebtThreshold(strategy.debtThreshold(), {"from": gov})
    cloned_strategy.setProfitFactor(strategy.profitFactor(), {"from": gov})
    cloned_strategy.setMaxReportDelay(strategy.maxReportDelay(), {"from": gov})

    assert cloned_strategy.numLenders() == 0

    # Clone the aave lender
    original_aave = GenericAave.at(strategy.lenders(strategy.numLenders() - 1))
    tx = original_aave.cloneAaveLender(cloned_strategy, "ClonedAaveUSDC",
                                       aUsdc, False, {"from": gov})
    cloned_lender = GenericAave.at(tx.return_value)
    assert cloned_lender.lenderName() == "ClonedAaveUSDC"

    cloned_strategy.addLender(cloned_lender, {"from": gov})
    starting_balance = usdc.balanceOf(strategist)
    currency = usdc
    decimals = currency.decimals()

    usdc.approve(vault, 2**256 - 1, {"from": whale})
    usdc.approve(vault, 2**256 - 1, {"from": strategist})

    deposit_limit = 1_000_000_000 * (10**(decimals))
    debt_ratio = 10_000
    vault.addStrategy(cloned_strategy, debt_ratio, 0, 2**256 - 1, 500,
                      {"from": gov})
    vault.setDepositLimit(deposit_limit, {"from": gov})

    assert deposit_limit == vault.depositLimit()

    # ------------------ set up proposal ------------------

    # chain.sleep(12 * 3600) # to be able to execute
    # chain.mine(1)
    # print("executing proposal 11") # to be able to test before the proposal is executed
    # executor = Contract.from_abi("AaveGovernanceV2", "0xec568fffba86c094cf06b22134b23074dfe2252c", executor_abi, owner="0x30fe242a69d7694a931791429815db792e24cf97")
    # tx = executor.execute(11)

    incentives_controller = Contract(aUsdc.getIncentivesController())
    assert incentives_controller.getDistributionEnd() > 0
    # ------------------ test starts ------------------
    # turning on claiming incentives logic
    cloned_lender.setIsIncentivised(True, {'from': strategist})

    # our humble strategist deposits some test funds
    depositAmount = 50000 * (10**(decimals))
    vault.deposit(depositAmount, {"from": strategist})

    assert cloned_strategy.estimatedTotalAssets() == 0
    chain.mine(1)
    assert cloned_strategy.harvestTrigger(1) == True

    cloned_strategy.harvest({"from": strategist})

    assert (cloned_strategy.estimatedTotalAssets() >= depositAmount * 0.999999
            )  # losing some dust is ok

    assert cloned_strategy.harvestTrigger(1) == False

    assert cloned_lender.harvestTrigger(1) == True  # first harvest

    with brownie.reverts():  ## should fail for any non-management account
        cloned_lender.harvest({'from': whale})

    with brownie.reverts():  ## not in management so should revert
        cloned_lender.setKeep3r(whale, {'from': whale})

    cloned_lender.setKeep3r(whale, {'from': strategist})

    cloned_lender.harvest({'from': whale})

    assert cloned_lender.harvestTrigger(1) == False

    chain.sleep(10 * 3600 * 24 + 1)  # we wait 10 days for the cooldown period
    chain.mine(1)

    assert cloned_lender.harvestTrigger(1) == True
    assert incentives_controller.getRewardsBalance([aUsdc], cloned_lender) > 0
    previousBalance = aUsdc.balanceOf(cloned_lender)

    cloned_lender.harvest({
        'from': strategist
    })  # redeem staked tokens, sell them, deposit them, claim rewards

    assert incentives_controller.getRewardsBalance([aUsdc], cloned_lender) == 0
    assert aUsdc.balanceOf(
        cloned_lender) > previousBalance  # deposit sold rewards

    cloned_strategy.harvest({'from': strategist})

    status = cloned_strategy.lendStatuses()
    form = "{:.2%}"
    formS = "{:,.0f}"
    for j in status:
        print(
            f"Lender: {j[0]}, Deposits: {formS.format(j[1]/1e6)}, APR: {form.format(j[2]/1e18)}"
        )
    chain.sleep(6 * 3600)
    chain.mine(1)
    vault.withdraw({"from": strategist})
예제 #20
0
def uni_faucet():
    yield Contract("0xa5dddefD30e234Be2Ac6FC1a0364cFD337aa0f61")
def test_migrate_investment_vault(
    snx,
    chain,
    gov,
    vault,
    strategy,
    susd,
    susd_vault,
    susd_whale,
    snx_whale,
    bob,
    snx_oracle,
    guardian,
    pm,
    rewards,
    management,
):
    chain.snapshot()
    # Move stale period to 16 days
    resolver = Contract(strategy.resolver())
    settings = Contract(
        resolver.getAddress(encode_single("bytes32", b"SystemSettings"))
    )
    settings.setRateStalePeriod(24 * 3600 * 16, {"from": settings.owner()})
    settings.setDebtSnapshotStaleTime(24 * 3600 * 16, {"from": settings.owner()})

    snx.transfer(bob, Wei("1000 ether"), {"from": snx_whale})
    snx.approve(vault, 2 ** 256 - 1, {"from": bob})
    vault.deposit({"from": bob})

    # Invest with an SNX price of 20
    snx_oracle.updateSnxPrice(Wei("20 ether"), {"from": gov})
    strategy.harvest({"from": gov})

    chain.sleep(86400 + 1)  # just over 24h
    chain.mine()

    assert strategy.balanceOfWant() == Wei("1000 ether")
    assert strategy.balanceOfSusd() == 0
    assert strategy.balanceOfSusdInVault() > 0

    Vault = pm(config["dependencies"][0]).Vault
    new_vault = guardian.deploy(Vault)
    new_vault.initialize(susd, gov, rewards, "", "", guardian)
    new_vault.setDepositLimit(2 ** 256 - 1, {"from": gov})
    new_vault.setManagement(management, {"from": gov})
    new_vault.setPerformanceFee(0, {"from": gov})
    new_vault.setManagementFee(0, {"from": gov})

    previous_balance = strategy.balanceOfSusdInVault()

    strategy.migrateSusdVault(new_vault, 10_000, {"from": gov})

    assert previous_balance == new_vault.totalAssets()
    assert previous_balance == strategy.balanceOfSusdInVault()

    vault.withdraw({"from": bob})

    assert snx.balanceOf(vault) == 0
    assert vault.balanceOf(bob) == 0
    assert snx.balanceOf(bob) == Wei("1000 ether")
    chain.revert()
예제 #22
0
def comp_ticket():
    yield Contract("0x27b85f596feb14e4b5faa9671720a556a7608c69")
예제 #23
0
def dai():
    token_address = "0x6B175474E89094C44Da98b954EedeAC495271d0F"  # this should be the address of the ERC-20 used by the strategy/vault (DAI)
    yield Contract(token_address)
예제 #24
0
def uni_ticket():
    yield Contract("0xa92a861fc11b99b24296af880011b47f9cafb5ab")
예제 #25
0
def token_seth(interface):
    yield Contract("0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb")
예제 #26
0
def comp():
    token_address = "0xc00e94cb662c3520282e6f5717214004a7f26888"
    yield Contract(token_address)
예제 #27
0
def strategy_ecrv_live():
    yield Contract("0xdD498eB680B0CE6Cac17F7dab0C35Beb6E481a6d")
예제 #28
0
def unitoken():
    token_address = "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
    yield Contract(token_address)
예제 #29
0
def token_ecrv(interface, gov):
    yield Contract("0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c", owner=gov)
예제 #30
0
def test_earns_rewards(staked_3pool, tripool_rewards):
    minter = Contract("minter")
    crv = Contract("crv")
    chain.mine(timedelta=60 * 60 * 24)
    minter.mint(tripool_rewards, {"from": staked_3pool})
    assert crv.balanceOf(staked_3pool) > 0