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

Test suite failures complete dump 2/9 passing #1

Closed St4rgarden closed 3 years ago

St4rgarden commented 3 years ago

(venv) Drak:daomoon StarGard3n$ brownie test Brownie v1.14.5 - Python development framework for Ethereum

Compiling contracts... Solc version: 0.6.12 Optimizer: Enabled Runs: 200 EVM Version: Istanbul Generating build data...

==================================================================== test session starts ===================================================================== platform darwin -- Python 3.9.5, pytest-6.0.1, py-1.10.0, pluggy-0.13.1 rootdir: /Users/StarGard3n/Desktop/Repos/defi/daomoon plugins: eth-brownie-1.14.5, hypothesis-5.41.3, xdist-1.34.0, web3-5.11.1, forked-1.3.0 collected 14 items

Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie --fork https://mainnet.infura.io/v3/c90f634444864c768b5aa3ab18ee0685 --chainId 1'...

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 FEEEEE [100%]

=========================================================================== ERRORS =========================================================================== _____ ERROR at setup of test_strategy_configpermissions ____

@pytest.fixture
def deployed():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
return deploy()

tests/conftest.py:24:


def deploy():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
  deployer = accounts[0]

  strategist = deployer
  keeper = deployer
  guardian = deployer

  governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})

E ValueError: Returned error: project ID does not have access to archive state

scripts/deploy.py:28: ValueError ____ ERROR at setup of test_strategy_pausingpermissions ____

@pytest.fixture
def deployed():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
return deploy()

tests/conftest.py:24:


def deploy():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
  deployer = accounts[0]

  strategist = deployer
  keeper = deployer
  guardian = deployer

  governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})

E ValueError: Returned error: project ID does not have access to archive state

scripts/deploy.py:28: ValueError __ ERROR at setup of test_sett_pausing_permissions ___

@pytest.fixture
def deployed():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
return deploy()

tests/conftest.py:24:


def deploy():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
  deployer = accounts[0]

  strategist = deployer
  keeper = deployer
  guardian = deployer

  governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})

E ValueError: Returned error: project ID does not have access to archive state

scripts/deploy.py:28: ValueError ___ ERROR at setup of test_sett_config_permissions ___

@pytest.fixture
def deployed():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
return deploy()

tests/conftest.py:24:


def deploy():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
  deployer = accounts[0]

  strategist = deployer
  keeper = deployer
  guardian = deployer

  governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})

E ValueError: Returned error: project ID does not have access to archive state

scripts/deploy.py:28: ValueError ____ ERROR at setup of test_sett_earn_permissions ____

@pytest.fixture
def deployed():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
return deploy()

tests/conftest.py:24:


def deploy():
  """
    Deploys, vault, controller and strats and wires them up for you to test
  """
  deployer = accounts[0]

  strategist = deployer
  keeper = deployer
  guardian = deployer

  governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})

E ValueError: Returned error: project ID does not have access to archive state

scripts/deploy.py:28: ValueError ========================================================================== FAILURES ========================================================================== _ test_isprofitable

deployed = DotMap(deployer=<Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, controller=<Controller Contract '0x602C71e4DAC...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})

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 0x10fe8aca0>, before = <helpers.snapshot.snap.Snap object at 0x110b71dc0> after = <helpers.snapshot.snap.Snap object at 0x10ff4df70>, params = {'amount': 23314624, 'user': '0x66aB6D9362d4F35596279692F0251Db635165871'}

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 12722171 -> 12722172 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 2.33146e-11 | 2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 2.91433e-11 | 5.82866e-12 | -2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 2.91433e-11 | 5.82866e-12 | -2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 2.33146e-11 | 2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 2.33146e-11 | 2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 2.33146e-11 | 2.33146e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 2.21489e-11 | 2.21489e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 2.33146e-11 | 2.33146e-11 | +--------------------------+-------------+-------------+--------------+ 23314624 23314624 1 23314624 23314624 1 5828657 5828657 1 23314624 23314624 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12722173 -> 12722174 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 2.33146e-11 | 1.16573e-12 | -2.21489e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97592e-06 | 3.97594e-06 | 2.21489e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 2.21489e-11 | 1.10745e-12 | -2.10414e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 2.21489e-11 | 2.21489e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 2.21489e-11 | 2.21489e-11 | +------------------------+-------------+-------------+--------------+ snap snap === Compare Withdraw === === Compare: StrategySnapshot Sett 12722175 -> 12722176 === +---------------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +=================================+=============+=============+==============+ | balances.want.sett | 1.16573e-12 | 0 | -1.16573e-12 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governance | 0 | 1.66116e-13 | 1.66116e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governanceRewards | 0 | 1.66116e-13 | 1.66116e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.strategist | 5.82866e-12 | 2.89772e-11 | 2.31485e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97594e-06 | 3.97592e-06 | -2.21489e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.user | 5.82866e-12 | 2.89772e-11 | 2.31485e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 2.33146e-11 | 0 | -2.33146e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.user | 2.33146e-11 | 0 | -2.33146e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.balance | 2.33146e-11 | 0 | -2.33146e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.available | 1.10745e-12 | 0 | -1.10745e-12 | +---------------------------------+-------------+-------------+--------------+ | sett.totalSupply | 2.33146e-11 | 0 | -2.33146e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 2.21489e-11 | 0 | -2.21489e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 2.21489e-11 | 0 | -2.21489e-11 | +---------------------------------+-------------+-------------+--------------+ 22148892 22148892 1 ____ test_are_youtrying ____

deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, sett = <SettV3 Contract '0x26f15335BB1C6a4C0B660eDd694a0555A9F1cce3'> strategy = <MyStrategy Contract '0xDae02e4fE488952cFB8c95177154D188647a0146'>, 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 168, in MyStrategy.harvest:
E 0, E 0 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(

tests/examples/test_are_you_trying.py:43: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... -------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------- Fetching source of 0x83D055D382f25e6793099713505c68a5C7535a35 from api.etherscan.io... Fetching source of 0xC13eac3B4F9EED480045113B7af00F7B5655Ece8 from api.etherscan.io... -------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------- Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.7.5+commit.eb77ed08 100%|██████████| 35.6M/35.6M [07:03<00:00, 83.9kiB/s] solc 0.7.5 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.7.5 Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.6.10+commit.00c0fcaf 100%|██████████| 33.6M/33.6M [05:45<00:00, 97.2kiB/s] solc 0.6.10 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.6.10 Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.7.6+commit.7338295f 100%|██████████| 35.6M/35.6M [06:33<00:00, 90.4kiB/s] solc 0.7.6 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.7.6 --------------------------------------------------------------------- Captured log call ---------------------------------------------------------------------- INFO solcx:install.py:571 Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.7.5+commit.eb77ed08 INFO solcx:install.py:648 solc 0.7.5 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.7.5 INFO solcx:install.py:571 Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.6.10+commit.00c0fcaf INFO solcx:install.py:648 solc 0.6.10 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.6.10 INFO solcx:install.py:571 Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.7.6+commit.7338295f INFO solcx:install.py:648 solc 0.7.6 successfully installed at: /Users/StarGard3n/.solcx/solc-v0.7.6 ___ test_deposit_withdraw_single_user_flow ___

deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, vault = <SettV3 Contract '0xFE0F4Cf81B5c0a6Fd65a610FD9488F33aE9095cB'> controller = <Controller Contract '0x741e3E1f81041c62C2A97d0b6E567AcaB09A6232'>, strategy = <MyStrategy Contract '0x5847798CE8c89e3Fff59AE5fA30BEC0d406b5687'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>, settKeeper = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>

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})

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 0x115a6c850>, before = <helpers.snapshot.snap.Snap object at 0x1102ace50> after = <helpers.snapshot.snap.Snap object at 0x1102acf70>, params = {'amount': 34918986, 'user': '0x66aB6D9362d4F35596279692F0251Db635165871'}

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 12732214 -> 12732215 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 6.9838e-11 | 6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 8.72975e-11 | 1.74595e-11 | -6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 8.72975e-11 | 1.74595e-11 | -6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 6.9838e-11 | 6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 6.9838e-11 | 6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 6.9838e-11 | 6.9838e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 6.63461e-11 | 6.63461e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 6.9838e-11 | 6.9838e-11 | +--------------------------+-------------+-------------+--------------+ 69837972 69837972 1 69837972 69837972 1 17459494 17459494 1 69837972 69837972 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12732216 -> 12732217 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 6.9838e-11 | 3.4919e-12 | -6.63461e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97595e-06 | 3.97601e-06 | 6.63461e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 6.63461e-11 | 3.3173e-12 | -6.30288e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 6.63461e-11 | 6.63461e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 6.63461e-11 | 6.63461e-11 | +------------------------+-------------+-------------+--------------+ snap snap === Compare Withdraw === === Compare: StrategySnapshot Sett 12732218 -> 12732219 === +---------------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +=================================+=============+=============+==============+ | balances.want.sett | 3.4919e-12 | 0 | -3.4919e-12 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governance | 1.66116e-13 | 4.01819e-13 | 2.35703e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.governanceRewards | 1.66116e-13 | 4.01819e-13 | 2.35703e-13 | +---------------------------------+-------------+-------------+--------------+ | balances.want.strategist | 1.74595e-11 | 5.21428e-11 | 3.46833e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97601e-06 | 3.97598e-06 | -3.14271e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.want.user | 1.74595e-11 | 5.21428e-11 | 3.46833e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 6.9838e-11 | 3.4919e-11 | -3.4919e-11 | +---------------------------------+-------------+-------------+--------------+ | balances.sett.user | 6.9838e-11 | 3.4919e-11 | -3.4919e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.balance | 6.9838e-11 | 3.4919e-11 | -3.4919e-11 | +---------------------------------+-------------+-------------+--------------+ | sett.available | 3.3173e-12 | 0 | -3.3173e-12 | +---------------------------------+-------------+-------------+--------------+ | sett.pricePerFullShare | 1 | 1 | 2.86377e-08 | +---------------------------------+-------------+-------------+--------------+ | sett.totalSupply | 6.9838e-11 | 3.4919e-11 | -3.4919e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 6.63461e-11 | 3.4919e-11 | -3.14271e-11 | +---------------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 6.63461e-11 | 3.4919e-11 | -3.14271e-11 | +---------------------------------+-------------+-------------+--------------+ 66346073 66346074 1 ___ test_single_user_harvest_flow ____

deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, vault = <SettV3 Contract '0x70bC6D873D110Da59a9c49E7485a27B0F605E5db'> sett = <SettV3 Contract '0x70bC6D873D110Da59a9c49E7485a27B0F605E5db'>, controller = <Controller Contract '0xC6D563d5c2243b27e7294511063f563ED701EA2C'> strategy = <MyStrategy Contract '0xEfE66132727f3831AB4E020357B5Bf615076Df6A'>, want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'> settKeeper = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, strategyKeeper = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>

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})

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 0x1126eb700>, 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 12732231 -> 12732232 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 4.06251e-11 | 4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 8.12502e-11 | 4.06251e-11 | -4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 8.12502e-11 | 4.06251e-11 | -4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 4.06251e-11 | 4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 4.06251e-11 | 4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 4.06251e-11 | 4.06251e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 3.85938e-11 | 3.85938e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 4.06251e-11 | 4.06251e-11 | +--------------------------+-------------+-------------+--------------+ 40625101 40625101 1 40625101 40625101 1 40625102 40625102 1 40625101 40625101 1 want.balanceOf(sett) 40625101 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12732232 -> 12732233 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 4.06251e-11 | 2.03126e-12 | -3.85938e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97598e-06 | 3.97602e-06 | 3.85938e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 3.85938e-11 | 1.92969e-12 | -3.66642e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 3.85938e-11 | 3.85938e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 3.85938e-11 | 3.85938e-11 | +------------------------+-------------+-------------+--------------+ snap snap ____ test_withdrawother ____

deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, sett = <SettV3 Contract '0xe25EDE8b52d4DE741Bd61c30060a003f0F1151A5'> controller = <Controller Contract '0x2E51a0DB587eadCF8495B41Bf3FC9f4F706d0028'>, strategy = <MyStrategy Contract '0x741D86951a8b99159be52644e60de7826033Ee44'> 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 168, in MyStrategy.harvest:
E 0, E 0 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(

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 '0x66aB6D9362d4F35596279692F0251Db635165871'>, vault = <SettV3 Contract '0xBD01D701541D96399c338C9D66D4AE7bCAd878a2'> sett = <SettV3 Contract '0xBD01D701541D96399c338C9D66D4AE7bCAd878a2'>, controller = <Controller Contract '0xe372E377902f1872Aaa458989B229974896022D2'> strategy = <MyStrategy Contract '0xE67cf20A24c85f0417070668123102247a6cfcC1'>, 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})

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 0x116b89070>, 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 12732285 -> 12732286 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 3.05281e-11 | 3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 6.10562e-11 | 3.05281e-11 | -3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 6.10562e-11 | 3.05281e-11 | -3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 3.05281e-11 | 3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 3.05281e-11 | 3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 3.05281e-11 | 3.05281e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 2.90017e-11 | 2.90017e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 3.05281e-11 | 3.05281e-11 | +--------------------------+-------------+-------------+--------------+ 30528116 30528116 1 30528116 30528116 1 30528116 30528116 1 30528116 30528116 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12732286 -> 12732287 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 3.05281e-11 | 1.52641e-12 | -2.90017e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.97605e-06 | 3.97608e-06 | 2.90017e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 2.90017e-11 | 1.45009e-12 | -2.75516e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 2.90017e-11 | 2.90017e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 2.90017e-11 | 2.90017e-11 | +------------------------+-------------+-------------+--------------+ snap snap __ test_strategy_action_permissions __

deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, sett = <SettV3 Contract '0xeb1F9ba627D9AbAc9B3207991adfe45028714149'> controller = <Controller Contract '0xb836484F58733Eb4254dbf20B89a313D34BBEf5b'>, strategy = <MyStrategy Contract '0xd16C4788AD6D73a8f87DF3627fFBF0b124022B68'> want = <IERC20 Contract '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'>

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

tests/examples/test_strategy_permissions.py:46:


deployer = <Account '0x66aB6D9362d4F35596279692F0251Db635165871'>, sett = <SettV3 Contract '0xeb1F9ba627D9AbAc9B3207991adfe45028714149'> controller = <Controller Contract '0xb836484F58733Eb4254dbf20B89a313D34BBEf5b'>, strategy = <MyStrategy Contract '0xd16C4788AD6D73a8f87DF3627fFBF0b124022B68'> 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})

E brownie.exceptions.VirtualMachineError: {'data': {'see': 'https://infura.io/dashboard'}}

tests/examples/test_strategy_permissions.py:18: VirtualMachineError ------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------- Fetching source of 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D from api.etherscan.io... ====================================================================== warnings summary ====================================================================== tests/test_profitable.py::test_is_profitable tests/examples/test_are_you_trying.py::test_are_you_trying tests/examples/test_basic.py::test_deploy_settings tests/examples/test_harvest_flow.py::test_deposit_withdraw_single_user_flow tests/examples/test_harvest_flow.py::test_single_user_harvest_flow tests/examples/test_harvest_flow.py::test_migrate_single_user tests/examples/test_harvest_flow.py::test_withdraw_other tests/examples/test_harvest_flow.py::test_single_user_harvest_flow_remove_fees tests/examples/test_strategy_permissions.py::test_strategy_action_permissions /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::test_is_profitable tests/examples/test_are_you_trying.py::test_are_you_trying tests/examples/test_basic.py::test_deploy_settings tests/examples/test_harvest_flow.py::test_deposit_withdraw_single_user_flow tests/examples/test_harvest_flow.py::test_single_user_harvest_flow tests/examples/test_harvest_flow.py::test_migrate_single_user tests/examples/test_harvest_flow.py::test_withdraw_other tests/examples/test_harvest_flow.py::test_single_user_harvest_flow_remove_fees tests/examples/test_strategy_permissions.py::test_strategy_action_permissions /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(

tests/examples/test_are_you_trying.py::test_are_you_trying /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0x83D055D382f25e6793099713505c68a5C7535a35: Locally compiled and on-chain bytecode do not match! warnings.warn(

tests/examples/test_are_you_trying.py::test_are_you_trying /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5: Locally compiled and on-chain bytecode do not match! warnings.warn(

tests/examples/test_are_you_trying.py::test_are_you_trying /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0xC2fcab14Ec1F2dFA82a23C639c4770345085a50F: Locally compiled and on-chain bytecode do not match! warnings.warn(

tests/examples/test_are_you_trying.py::test_are_you_trying /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0xe42F02713aEC989132C1755117F768DBEa523d2f: Locally compiled and on-chain bytecode do not match! warnings.warn(

tests/examples/test_are_you_trying.py::test_are_you_trying /Users/StarGard3n/Desktop/Repos/defi/daomoon/venv/lib/python3.9/site-packages/brownie/network/contract.py:1221: BrownieCompilerWarning: 0xE592427A0AEce92De3Edee1F18E0157C05861564: 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: {'data': {'see': 'https://in... ERROR tests/examples/test_strategy_permissions.py::test_strategy_config_permissions - ValueError: Returned error: project ID does not have access to archiv... ERROR tests/examples/test_strategy_permissions.py::test_strategy_pausing_permissions - ValueError: Returned error: project ID does not have access to archi... ERROR tests/examples/test_strategy_permissions.py::test_sett_pausing_permissions - ValueError: Returned error: project ID does not have access to archive s... ERROR tests/examples/test_strategy_permissions.py::test_sett_config_permissions - ValueError: Returned error: project ID does not have access to archive state ERROR tests/examples/test_strategy_permissions.py::test_sett_earn_permissions - ValueError: Returned error: project ID does not have access to archive state ============================================== 7 failed, 2 passed, 23 warnings, 5 errors in 1657.70s (0:27:37) =============================================== Terminating local RPC client... (venv) Drak:daomoon StarGard3n$ git push https://github.com/daomoon/hackmoney-strategy-v1.git Username for 'https://github.com': St4rgarden Password for 'https://St4rgarden@github.com': To https://github.com/daomoon/hackmoney-strategy-v1.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/daomoon/hackmoney-strategy-v1.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. (venv) Drak:daomoon StarGard3n$ git push https://github.com/daomoon/BadgerStratUpToTesting.git Enumerating objects: 794, done. Counting objects: 100% (794/794), done. Delta compression using up to 4 threads Compressing objects: 100% (461/461), done. Writing objects: 100% (794/794), 508.12 KiB | 33.87 MiB/s, done. Total 794 (delta 295), reused 794 (delta 295), pack-reused 0 remote: Resolving deltas: 100% (295/295), done. To https://github.com/daomoon/BadgerStratUpToTesting.git

St4rgarden commented 3 years ago

Previous test passes before commit