daomoon / BadgerStratUpToTesting

Had to try and create a blank repo to push to
GNU Affero General Public License v3.0
0 stars 0 forks source link

New unit test dump post commit 3/14 passing #2

Closed St4rgarden closed 3 years ago

St4rgarden commented 3 years ago

tests/test_profitable.py F [ 7%] tests/examples/test_are_you_trying.py F [ 14%] tests/examples/test_basic.py . [ 21%] tests/examples/test_harvest_flow.py FF.FF [ 57%] tests/examples/test_strategy_permissions.py F.FFFF [100%]

========================================================================== FAILURES ========================================================================== _ test_isprofitable

deployed = DotMap(deployer=<Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, controller=<Controller Contract '0x8F37Fb31d61...9ff58f4fFB29fA2266Ab25e75e2A8b3503311656'>, rewardToken=<IERC20 Contract '0x4da27a545c0c5B758a6BA100e3a049001de870f5'>)

def test_is_profitable(deployed):
  deployer = deployed.deployer
  vault = deployed.vault
  controller = deployed.controller
  strategy = deployed.strategy
  want = deployed.want
  randomUser = accounts[6]

  initial_balance = want.balanceOf(deployer)

  settKeeper = accounts.at(vault.keeper(), force=True)

  snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot")

  # Deposit
  assert want.balanceOf(deployer) > 0

  depositAmount = int(want.balanceOf(deployer) * 0.8)
  assert depositAmount > 0

  want.approve(vault.address, MaxUint256, {"from": deployer})

  snap.settDeposit(depositAmount, {"from": deployer})

  # Earn
  with brownie.reverts("onlyAuthorizedActors"):
      vault.earn({"from": randomUser})

  min = vault.min()
  max = vault.max()
  remain = max - min

  snap.settEarn({"from": settKeeper})

  chain.sleep(15)
  chain.mine(1)
snap.settWithdrawAll({"from": deployer})

../daomoon/tests/test_profitable.py:47:


helpers/SnapshotManager.py:150: in settWithdrawAll self.resolver.confirm_withdraw( helpers/StrategyCoreResolver.py:247: in confirm_withdraw self.hook_after_confirm_withdraw(before, after, params)


self = <config.StrategyResolver.StrategyResolver object at 0x10a3640d0>, before = <helpers.snapshot.snap.Snap object at 0x109f0af40> after = <helpers.snapshot.snap.Snap object at 0x109b668b0>, params = {'amount': 24195022, 'user': '0x33A4622B82D4c04a53e170c638B944ce27cffce3'}

def hook_after_confirm_withdraw(self, before, after, params):
    """
        Specifies extra check for ordinary operation on withdrawal
        Use this to verify that balances in the get_strategy_destinations are properly set
    """
  assert after.balances("want", "aToken") < before.balance("want", "aToken")

E AttributeError: 'Snap' object has no attribute 'balance'

config/StrategyResolver.py:12: AttributeError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- init_resolver wBTC-AAVE-Rewards snap snap === Compare Deposit === === Compare: StrategySnapshot Sett 12731292 -> 12731293 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 2.4195e-11 | 2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 3.02438e-11 | 6.04876e-12 | -2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 3.02438e-11 | 6.04876e-12 | -2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 2.4195e-11 | 2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 2.4195e-11 | 2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 2.4195e-11 | 2.4195e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 2.29853e-11 | 2.29853e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 2.4195e-11 | 2.4195e-11 | +--------------------------+-------------+-------------+--------------+ 24195022 24195022 1 24195022 24195022 1 6048756 6048756 1 24195022 24195022 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12731294 -> 12731295 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 2.4195e-11 | 1.20975e-12 | -2.29853e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.93237e-06 | 3.9324e-06 | 2.29853e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 2.29853e-11 | 1.14926e-12 | -2.1836e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 2.29853e-11 | 2.29853e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 2.29853e-11 | 2.29853e-11 | +------------------------+-------------+-------------+--------------+ snap snap === Compare Withdraw === === Compare: StrategySnapshot Sett 12731296 -> 12731297 === +---------------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +=================================+=============+=============+==============+ | balances.want.sett | 1.20975e-12 | 0 | -1.20975e-12 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governance | 0 | 1.72389e-13 | 1.72389e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governanceRewards | 0 | 1.72389e-13 | 1.72389e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.strategist | 6.04876e-12 | 3.00714e-11 | 2.40226e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.9324e-06 | 3.93237e-06 | -2.29853e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.user | 6.04876e-12 | 3.00714e-11 | 2.40226e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 2.4195e-11 | 0 | -2.4195e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.user | 2.4195e-11 | 0 | -2.4195e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.balance | 2.4195e-11 | 0 | -2.4195e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.available | 1.14926e-12 | 0 | -1.14926e-12 | +---------------------------------+-------------+-------------+--------------+ | sett.totalSupply | 2.4195e-11 | 0 | -2.4195e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 2.29853e-11 | 0 | -2.29853e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 2.29853e-11 | 0 | -2.29853e-11 | +---------------------------------+-------------+-------------+--------------+ 22985270 22985270 1 ____ test_are_youtrying ____

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xC2f2042DA65Eb5dEE6990C31E1F1659Fd39f1c81'> strategy = <MyStrategy Contract '0x84DC387Ab90D57C7c687aaCaf4423c671D418aE5'>, want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_are_you_trying(deployer, sett, strategy, want):
  """
    Verifies that you set up the Strategy properly
  """
  # Setup
  startingBalance = want.balanceOf(deployer)

  depositAmount = startingBalance // 2
  assert startingBalance >= depositAmount
  assert startingBalance >= 0
  # End Setup

  # Deposit
  assert want.balanceOf(sett) == 0

  want.approve(sett, MaxUint256, {"from": deployer})
  sett.deposit(depositAmount, {"from": deployer})

  available = sett.available()
  assert available > 0

  sett.earn({"from": deployer})

  chain.mine(10000) # Mine so we get some interest

  ## TEST 1: Does the want get used in any way?
  assert want.balanceOf(sett) == depositAmount - available

  # Did the strategy do something with the asset?
  assert want.balanceOf(strategy) < available

  # Use this if it should invest all
  # assert want.balanceOf(strategy) == 0

  # Change to this if the strat is supposed to hodl and do nothing
  #assert strategy.balanceOf(want) = depositAmount

  ## TEST 2: Is the Harvest profitable?
harvest = strategy.harvest({"from": deployer})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_are_you_trying.py:43: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ___ test_deposit_withdraw_single_user_flow ___

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, vault = <SettV3 Contract '0xC0c35bf24000f6e926F4C84Bb000Df4521D47a4E'> controller = <Controller Contract '0xC305ED0d53263a3D205C4F4ab352BC1EbA334901'>, strategy = <MyStrategy Contract '0x67a6034EE0674B35Aa903C683D1f641440987d74'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>, settKeeper = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>

def test_deposit_withdraw_single_user_flow(deployer, vault, controller, strategy, want, settKeeper):
    # Setup
    snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot")
    randomUser = accounts[6]
    #End Setup

    # Deposit
    assert want.balanceOf(deployer) > 0

    depositAmount = int(want.balanceOf(deployer) * 0.8)
    assert depositAmount > 0

    want.approve(vault.address, MaxUint256, {"from": deployer})

    snap.settDeposit(depositAmount, {"from": deployer})

    shares = vault.balanceOf(deployer)

    # Earn
    with brownie.reverts("onlyAuthorizedActors"):
        vault.earn({"from": randomUser})

    snap.settEarn({"from": settKeeper})

    chain.sleep(15)
    chain.mine(1)
  snap.settWithdraw(shares // 2, {"from": deployer})

../daomoon/tests/examples/test_harvest_flow.py:34:


helpers/SnapshotManager.py:137: in settWithdraw self.resolver.confirm_withdraw( helpers/StrategyCoreResolver.py:247: in confirm_withdraw self.hook_after_confirm_withdraw(before, after, params)


self = <config.StrategyResolver.StrategyResolver object at 0x115e82df0>, before = <helpers.snapshot.snap.Snap object at 0x109d49fa0> after = <helpers.snapshot.snap.Snap object at 0x10ce47eb0>, params = {'amount': 36237209, 'user': '0x33A4622B82D4c04a53e170c638B944ce27cffce3'}

def hook_after_confirm_withdraw(self, before, after, params):
    """
        Specifies extra check for ordinary operation on withdrawal
        Use this to verify that balances in the get_strategy_destinations are properly set
    """
  assert after.balances("want", "aToken") < before.balance("want", "aToken")

E AttributeError: 'Snap' object has no attribute 'balance'

config/StrategyResolver.py:12: AttributeError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- init_resolver wBTC-AAVE-Rewards snap snap === Compare Deposit === === Compare: StrategySnapshot Sett 12741335 -> 12741336 === +--------------------------+------------+-------------+--------------+ | metric | before | after | diff | +==========================+============+=============+==============+ | balances.want.sett | 0 | 7.24744e-11 | 7.24744e-11 | +--------------------------+------------+-------------+--------------+ | balances.want.strategist | 9.0593e-11 | 1.81186e-11 | -7.24744e-11 | +--------------------------+------------+-------------+--------------+ | balances.want.user | 9.0593e-11 | 1.81186e-11 | -7.24744e-11 | +--------------------------+------------+-------------+--------------+ | balances.sett.strategist | 0 | 7.24744e-11 | 7.24744e-11 | +--------------------------+------------+-------------+--------------+ | balances.sett.user | 0 | 7.24744e-11 | 7.24744e-11 | +--------------------------+------------+-------------+--------------+ | sett.balance | 0 | 7.24744e-11 | 7.24744e-11 | +--------------------------+------------+-------------+--------------+ | sett.available | 0 | 6.88507e-11 | 6.88507e-11 | +--------------------------+------------+-------------+--------------+ | sett.totalSupply | 0 | 7.24744e-11 | 7.24744e-11 | +--------------------------+------------+-------------+--------------+ 72474419 72474419 1 72474419 72474419 1 18118605 18118605 1 72474419 72474419 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12741337 -> 12741338 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 7.24744e-11 | 3.62372e-12 | -6.88507e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.9324e-06 | 3.93247e-06 | 6.88507e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 6.88507e-11 | 3.44253e-12 | -6.54082e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 6.88507e-11 | 6.88507e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 6.88507e-11 | 6.88507e-11 | +------------------------+-------------+-------------+--------------+ snap snap === Compare Withdraw === === Compare: StrategySnapshot Sett 12741339 -> 12741340 === +---------------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +=================================+=============+=============+==============+ | balances.want.sett | 3.62372e-12 | 0 | -3.62372e-12 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governance | 1.72389e-13 | 4.1699e-13 | 2.44601e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governanceRewards | 1.72389e-13 | 4.1699e-13 | 2.44601e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.strategist | 1.81186e-11 | 5.41112e-11 | 3.59926e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.93247e-06 | 3.93244e-06 | -3.26135e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.user | 1.81186e-11 | 5.41112e-11 | 3.59926e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 7.24744e-11 | 3.62372e-11 | -3.62372e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.user | 7.24744e-11 | 3.62372e-11 | -3.62372e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.balance | 7.24744e-11 | 3.62372e-11 | -3.62372e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.available | 3.44253e-12 | 0 | -3.44253e-12 | +---------------------------------+-------------+-------------+--------------+ | sett.totalSupply | 7.24744e-11 | 3.62372e-11 | -3.62372e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 6.88507e-11 | 3.62372e-11 | -3.26135e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 6.88507e-11 | 3.62372e-11 | -3.26135e-11 | +---------------------------------+-------------+-------------+--------------+ 68850698 68850698 1 ___ test_single_user_harvest_flow ____

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, vault = <SettV3 Contract '0xbe3108e9f07f65ACCA19DDC8D30DDc69f3a64b5F'> sett = <SettV3 Contract '0xbe3108e9f07f65ACCA19DDC8D30DDc69f3a64b5F'>, controller = <Controller Contract '0x2095176807471770C1909BeFaFA4501456282E0E'> strategy = <MyStrategy Contract '0x5e3b4fc31076198DbaeA1450C73839c8aF044639'>, want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'> settKeeper = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, strategyKeeper = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>

def test_single_user_harvest_flow(deployer, vault, sett, controller, strategy, want, settKeeper, strategyKeeper):
    # Setup
    snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot")
    randomUser = accounts[6]
    tendable = strategy.isTendable()
    startingBalance = want.balanceOf(deployer)
    depositAmount = startingBalance // 2
    assert startingBalance >= depositAmount
    assert startingBalance >= 0
    # End Setup

    # Deposit
    want.approve(sett, MaxUint256, {"from": deployer})
    snap.settDeposit(depositAmount, {"from": deployer})
    shares = vault.balanceOf(deployer)

    assert want.balanceOf(sett) > 0
    print("want.balanceOf(sett)", want.balanceOf(sett))

    # Earn
    snap.settEarn({"from": settKeeper})

    if tendable:
        with brownie.reverts("onlyAuthorizedActors"):
            strategy.tend({"from": randomUser})
      snap.settTend({"from": strategyKeeper})

../daomoon/tests/examples/test_harvest_flow.py:70:


helpers/SnapshotManager.py:86: in settTend self.resolver.confirm_tend(before, after, tx) config/StrategyResolver.py:62: in confirm_tend assert after.get("strategy.isTendable") == True


self = <helpers.snapshot.snap.Snap object at 0x112391e80>, key = 'strategy.isTendable'

def get(self, key):
    if key not in self.data.keys():
      raise Exception("Key {} not found in snap data".format(key))

E Exception: Key strategy.isTendable not found in snap data

helpers/snapshot/snap.py:17: Exception ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- init_resolver wBTC-AAVE-Rewards snap snap === Compare Deposit === === Compare: StrategySnapshot Sett 12741352 -> 12741353 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 4.21586e-11 | 4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 8.43171e-11 | 4.21586e-11 | -4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 8.43171e-11 | 4.21586e-11 | -4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 4.21586e-11 | 4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 4.21586e-11 | 4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 4.21586e-11 | 4.21586e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 4.00506e-11 | 4.00506e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 4.21586e-11 | 4.21586e-11 | +--------------------------+-------------+-------------+--------------+ 42158551 42158551 1 42158551 42158551 1 42158552 42158552 1 42158551 42158551 1 want.balanceOf(sett) 42158551 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12741353 -> 12741354 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 4.21586e-11 | 2.10793e-12 | -4.00506e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.93244e-06 | 3.93248e-06 | 4.00506e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 4.00506e-11 | 2.00253e-12 | -3.80481e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 4.00506e-11 | 4.00506e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 4.00506e-11 | 4.00506e-11 | +------------------------+-------------+-------------+--------------+ snap snap ____ test_withdrawother ____

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xEA54B24Bd41Ec0F5992dD4A15b7BE3bE416cd1B7'> controller = <Controller Contract '0xdaddFcFbC948B1fC65B68cB124341B6a5B7f0139'>, strategy = <MyStrategy Contract '0x53eeB4990d95d523fCd7dC363635763B5EB050b6'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_withdraw_other(deployer, sett, controller, strategy, want):
    """
    - Controller should be able to withdraw other tokens
    - Controller should not be able to withdraw core tokens
    - Non-controller shouldn't be able to do either
    """
    # Setup
    randomUser = accounts[6]
    startingBalance = want.balanceOf(deployer)
    depositAmount = startingBalance // 2
    assert startingBalance >= depositAmount
    # End Setup

    # Deposit
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(15)
    chain.mine()

    sett.earn({"from": deployer})

    chain.sleep(days(0.5))
    chain.mine()

    if strategy.isTendable():
        strategy.tend({"from": deployer})
  strategy.harvest({"from": deployer})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_harvestflow.py:219: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ____ test_single_user_harvest_flow_remove_fees __

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, vault = <SettV3 Contract '0x1731462dd05558682410D6f305Cb33CB10D4dE5A'> sett = <SettV3 Contract '0x1731462dd05558682410D6f305Cb33CB10D4dE5A'>, controller = <Controller Contract '0x8c1580CDc8f2224f014C509F77da72f8E07b7c2e'> strategy = <MyStrategy Contract '0x5E94592a9092abbDF5Ca88E4AE2087b0FdECD441'>, want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_single_user_harvest_flow_remove_fees(deployer, vault, sett, controller, strategy, want):
    # Setup
    randomUser = accounts[6]
    snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot")
    startingBalance = want.balanceOf(deployer)
    tendable = strategy.isTendable()
    startingBalance = want.balanceOf(deployer)
    depositAmount = startingBalance // 2
    assert startingBalance >= depositAmount
    # End Setup

    # Deposit
    want.approve(sett, MaxUint256, {"from": deployer})
    snap.settDeposit(depositAmount, {"from": deployer})

    # Earn
    snap.settEarn({"from": deployer})

    chain.sleep(days(0.5))
    chain.mine()

    if tendable:
      snap.settTend({"from": deployer})

../daomoon/tests/examples/test_harvest_flow.py:269:


helpers/SnapshotManager.py:86: in settTend self.resolver.confirm_tend(before, after, tx) config/StrategyResolver.py:62: in confirm_tend assert after.get("strategy.isTendable") == True


self = <helpers.snapshot.snap.Snap object at 0x1144ced90>, key = 'strategy.isTendable'

def get(self, key):
    if key not in self.data.keys():
      raise Exception("Key {} not found in snap data".format(key))

E Exception: Key strategy.isTendable not found in snap data

helpers/snapshot/snap.py:17: Exception ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- init_resolver wBTC-AAVE-Rewards snap snap === Compare Deposit === === Compare: StrategySnapshot Sett 12741406 -> 12741407 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 3.16799e-11 | 3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 6.33598e-11 | 3.16799e-11 | -3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 6.33598e-11 | 3.16799e-11 | -3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 3.16799e-11 | 3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 3.16799e-11 | 3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 3.16799e-11 | 3.16799e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 3.00959e-11 | 3.00959e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 3.16799e-11 | 3.16799e-11 | +--------------------------+-------------+-------------+--------------+ 31679876 31679876 1 31679876 31679876 1 31679876 31679876 1 31679876 31679876 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12741407 -> 12741408 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 3.16799e-11 | 1.58399e-12 | -3.00959e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.93251e-06 | 3.93254e-06 | 3.00959e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 3.00959e-11 | 1.50479e-12 | -2.85911e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 3.00959e-11 | 3.00959e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 3.00959e-11 | 3.00959e-11 | +------------------------+-------------+-------------+--------------+ snap snap __ test_strategy_action_permissions __

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0x265E4904BfC9B2b7763309bF085598593DDA2201'> controller = <Controller Contract '0xd5e81841374E92ED6f76761818130ed7F935F338'>, strategy = <MyStrategy Contract '0xF1909dE26Bc1B7D941DF9329CAA04311e9394001'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_strategy_action_permissions(deployer, sett, controller, strategy, want):
  state_setup(deployer, sett, controller, strategy, want)

../daomoon/tests/examples/test_strategy_permissions.py:46:


deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0x265E4904BfC9B2b7763309bF085598593DDA2201'> controller = <Controller Contract '0xd5e81841374E92ED6f76761818130ed7F935F338'>, strategy = <MyStrategy Contract '0xF1909dE26Bc1B7D941DF9329CAA04311e9394001'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def state_setup(deployer, sett, controller, strategy, want):
    startingBalance = want.balanceOf(deployer)

    settKeeper = accounts.at(sett.keeper(), force=True)
    strategyKeeper = accounts.at(strategy.keeper(), force=True)

    tendable = strategy.isTendable()

    startingBalance = want.balanceOf(deployer)
    depositAmount = int(startingBalance * 0.8)
    assert startingBalance >= depositAmount
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(days(1))
    chain.mine()

    sett.earn({"from": settKeeper})

    chain.sleep(days(1))
    chain.mine()

    if tendable:
        strategy.tend({"from": strategyKeeper})
  strategy.harvest({"from": strategyKeeper})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_strategypermissions.py:32: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ____ test_strategy_pausing_permissions __

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xaC54ca15dFe1fb5097369CE6E36827Dd740C3872'> controller = <Controller Contract '0xf2b1dfE9b2bAAaEE6938A9C60b6B46ADCb0E12B5'>, strategy = <MyStrategy Contract '0x5c605cE0e1BBb9f9AdB641FbAB767362fFb919E5'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_strategy_pausing_permissions(deployer, sett, controller, strategy, want):
    # Setup
  state_setup(deployer, sett, controller, strategy, want)

../daomoon/tests/examples/test_strategy_permissions.py:162:


deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xaC54ca15dFe1fb5097369CE6E36827Dd740C3872'> controller = <Controller Contract '0xf2b1dfE9b2bAAaEE6938A9C60b6B46ADCb0E12B5'>, strategy = <MyStrategy Contract '0x5c605cE0e1BBb9f9AdB641FbAB767362fFb919E5'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def state_setup(deployer, sett, controller, strategy, want):
    startingBalance = want.balanceOf(deployer)

    settKeeper = accounts.at(sett.keeper(), force=True)
    strategyKeeper = accounts.at(strategy.keeper(), force=True)

    tendable = strategy.isTendable()

    startingBalance = want.balanceOf(deployer)
    depositAmount = int(startingBalance * 0.8)
    assert startingBalance >= depositAmount
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(days(1))
    chain.mine()

    sett.earn({"from": settKeeper})

    chain.sleep(days(1))
    chain.mine()

    if tendable:
        strategy.tend({"from": strategyKeeper})
  strategy.harvest({"from": strategyKeeper})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_strategy_permissions.py:32: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... _ test_sett_pausing_permissions __

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xD681b81d9d1DA8B71a58bb19f3001a9c27B3D67B'> controller = <Controller Contract '0x22a200d92f5fa9193E8A07931651cD0b71336661'>, strategy = <MyStrategy Contract '0xab4Ac13dE8c18bffb7F7Bd7b6457d430662B7e72'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_sett_pausing_permissions(deployer, sett, controller, strategy, want):
    # Setup
  state_setup(deployer, sett, controller, strategy, want)

../daomoon/tests/examples/test_strategy_permissions.py:216:


deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xD681b81d9d1DA8B71a58bb19f3001a9c27B3D67B'> controller = <Controller Contract '0x22a200d92f5fa9193E8A07931651cD0b71336661'>, strategy = <MyStrategy Contract '0xab4Ac13dE8c18bffb7F7Bd7b6457d430662B7e72'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def state_setup(deployer, sett, controller, strategy, want):
    startingBalance = want.balanceOf(deployer)

    settKeeper = accounts.at(sett.keeper(), force=True)
    strategyKeeper = accounts.at(strategy.keeper(), force=True)

    tendable = strategy.isTendable()

    startingBalance = want.balanceOf(deployer)
    depositAmount = int(startingBalance * 0.8)
    assert startingBalance >= depositAmount
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(days(1))
    chain.mine()

    sett.earn({"from": settKeeper})

    chain.sleep(days(1))
    chain.mine()

    if tendable:
        strategy.tend({"from": strategyKeeper})
  strategy.harvest({"from": strategyKeeper})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_strategy_permissions.py:32: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ____ test_sett_config_permissions ____

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0x3a0DA51FA65559e9101B91EC91dD814CBAb18afD'> controller = <Controller Contract '0x8a692067Bc515F4DF588b8e4C6745E250628ab7b'>, strategy = <MyStrategy Contract '0x39920c4998c91Ee73Afa8f9cB33D597975FcD3B1'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_sett_config_permissions(deployer, sett, controller, strategy, want):
  state_setup(deployer, sett, controller, strategy, want)

../daomoon/tests/examples/test_strategy_permissions.py:271:


deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0x3a0DA51FA65559e9101B91EC91dD814CBAb18afD'> controller = <Controller Contract '0x8a692067Bc515F4DF588b8e4C6745E250628ab7b'>, strategy = <MyStrategy Contract '0x39920c4998c91Ee73Afa8f9cB33D597975FcD3B1'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def state_setup(deployer, sett, controller, strategy, want):
    startingBalance = want.balanceOf(deployer)

    settKeeper = accounts.at(sett.keeper(), force=True)
    strategyKeeper = accounts.at(strategy.keeper(), force=True)

    tendable = strategy.isTendable()

    startingBalance = want.balanceOf(deployer)
    depositAmount = int(startingBalance * 0.8)
    assert startingBalance >= depositAmount
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(days(1))
    chain.mine()

    sett.earn({"from": settKeeper})

    chain.sleep(days(1))
    chain.mine()

    if tendable:
        strategy.tend({"from": strategyKeeper})
  strategy.harvest({"from": strategyKeeper})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_strategypermissions.py:32: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ____ test_sett_earnpermissions ____

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xbdbC2375a4A5f73c15D8a0c0e24851f6e2d5c437'> controller = <Controller Contract '0x84aDE08e38F48b083b275958F8CC7126039C3644'>, strategy = <MyStrategy Contract '0x25e642A40e91EA583cCC1e588bb4DD035706e78f'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def test_sett_earn_permissions(deployer, sett, controller, strategy, want):
    # Setup
  state_setup(deployer, sett, controller, strategy, want)

../daomoon/tests/examples/test_strategy_permissions.py:310:


deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, sett = <SettV3 Contract '0xbdbC2375a4A5f73c15D8a0c0e24851f6e2d5c437'> controller = <Controller Contract '0x84aDE08e38F48b083b275958F8CC7126039C3644'>, strategy = <MyStrategy Contract '0x25e642A40e91EA583cCC1e588bb4DD035706e78f'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

def state_setup(deployer, sett, controller, strategy, want):
    startingBalance = want.balanceOf(deployer)

    settKeeper = accounts.at(sett.keeper(), force=True)
    strategyKeeper = accounts.at(strategy.keeper(), force=True)

    tendable = strategy.isTendable()

    startingBalance = want.balanceOf(deployer)
    depositAmount = int(startingBalance * 0.8)
    assert startingBalance >= depositAmount
    want.approve(sett, MaxUint256, {"from": deployer})
    sett.deposit(depositAmount, {"from": deployer})

    chain.sleep(days(1))
    chain.mine()

    sett.earn({"from": settKeeper})

    chain.sleep(days(1))
    chain.mine()

    if tendable:
        strategy.tend({"from": strategyKeeper})
  strategy.harvest({"from": strategyKeeper})

E brownie.exceptions.VirtualMachineError: revert: STF E Trace step -1, program counter 3405: E File "contracts/MyStrategy.sol", line 169, in MyStrategy.harvest:
E 0 E ); E
E ISwapRouter(ROUTER).exactInputSingle(fromRewardToAAVEParams); E
E bytes memory path = abi.encodePacked(AAVE_TOKEN, uint24(10000), WETH_TOKEN, uint24(10000), want); E ISwapRouter.ExactInputParams memory fromAAVETowBTCParams = ISwapRouter.ExactInputParams(

../daomoon/tests/examples/test_strategy_permissions.py:32: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ====================================================================== warnings summary ====================================================================== tests/test_profitable.py: 1 warning tests/examples/test_are_you_trying.py: 1 warning tests/examples/test_basic.py: 1 warning tests/examples/test_harvest_flow.py: 5 warnings tests/examples/test_strategy_permissions.py: 6 warnings /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:779: BrownieEnvironmentWarning: 'SettV3' defines a 'balance' function, 'SettV3.balance' is available as SettV3.wei_balance warnings.warn(

tests/test_profitable.py: 1 warning tests/examples/test_are_you_trying.py: 1 warning tests/examples/test_basic.py: 1 warning tests/examples/test_harvest_flow.py: 5 warnings tests/examples/test_strategy_permissions.py: 6 warnings /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D: Locally compiled and on-chain bytecode do not match! warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html ================================================================== short test summary info =================================================================== FAILED tests/test_profitable.py::test_is_profitable - AttributeError: 'Snap' object has no attribute 'balance' FAILED tests/examples/test_are_you_trying.py::test_are_you_trying - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_harvest_flow.py::test_deposit_withdraw_single_user_flow - AttributeError: 'Snap' object has no attribute 'balance' FAILED tests/examples/test_harvest_flow.py::test_single_user_harvest_flow - Exception: Key strategy.isTendable not found in snap data FAILED tests/examples/test_harvest_flow.py::test_withdraw_other - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_harvest_flow.py::test_single_user_harvest_flow_remove_fees - Exception: Key strategy.isTendable not found in snap data FAILED tests/examples/test_strategy_permissions.py::test_strategy_action_permissions - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_strategy_permissions.py::test_strategy_pausing_permissions - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_strategy_permissions.py::test_sett_pausing_permissions - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_strategy_permissions.py::test_sett_config_permissions - brownie.exceptions.VirtualMachineError: revert: STF FAILED tests/examples/test_strategy_permissions.py::test_sett_earn_permissions - brownie.exceptions.VirtualMachineError: revert: STF =================================================== 11 failed, 3 passed, 28 warnings in 651.74s (0:10:51) ==================================================== Terminating local RPC client...