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

fix test_single_user_harvest_flow_remove_fees #7

Closed St4rgarden closed 3 years ago

St4rgarden commented 3 years ago

_____ test_single_user_harvest_flow_remove_fees __

deployer = <Account '0x33A4622B82D4c04a53e170c638B944ce27cffce3'>, vault = <SettV3 Contract '0xAE7f7F645261c33e45cD9261B8a6753901563cdf'> sett = <SettV3 Contract '0xAE7f7F645261c33e45cD9261B8a6753901563cdf'>, controller = <Controller Contract '0x079DC4fc0f2abB72Ccf99ea130436F93dD2FcB15'> strategy = <MyStrategy Contract '0xe15854D3842e2f537d01793cA10b5E5dEFFCb5Df'>, 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 0x10922ca60>, 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 12741623 -> 12741624 === +--------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +==========================+=============+=============+==============+ | balances.want.sett | 0 | 3.4055e-11 | 3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.strategist | 6.81099e-11 | 3.4055e-11 | -3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | balances.want.user | 6.81099e-11 | 3.4055e-11 | -3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.strategist | 0 | 3.4055e-11 | 3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | balances.sett.user | 0 | 3.4055e-11 | 3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | sett.balance | 0 | 3.4055e-11 | 3.4055e-11 | +--------------------------+-------------+-------------+--------------+ | sett.available | 0 | 3.23522e-11 | 3.23522e-11 | +--------------------------+-------------+-------------+--------------+ | sett.totalSupply | 0 | 3.4055e-11 | 3.4055e-11 | +--------------------------+-------------+-------------+--------------+ 34054963 34054963 1 34054963 34054963 1 34054964 34054964 1 34054963 34054963 1 snap snap === Compare Earn === === Compare: StrategySnapshot Sett 12741624 -> 12741625 === +------------------------+-------------+-------------+--------------+ | metric | before | after | diff | +========================+=============+=============+==============+ | balances.want.sett | 3.4055e-11 | 1.70275e-12 | -3.23522e-11 | +------------------------+-------------+-------------+--------------+ | balances.want.aToken | 3.93309e-06 | 3.93312e-06 | 3.23522e-11 | +------------------------+-------------+-------------+--------------+ | sett.available | 3.23522e-11 | 1.61761e-12 | -3.07346e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOfPool | 0 | 3.23522e-11 | 3.23522e-11 | +------------------------+-------------+-------------+--------------+ | strategy.balanceOf | 0 | 3.23522e-11 | 3.23522e-11 | +------------------------+-------------+-------------+--------------+ snap snap

St4rgarden commented 3 years ago

Fixed by making the isTendable() flag properly set based on logic

St4rgarden commented 3 years ago

Fixed by making the isTendable() flag properly set based on logic