From bfa62a849fe38092ea9d708ae7d82e91a6303244 Mon Sep 17 00:00:00 2001 From: Sam Priestley Date: Sun, 6 Dec 2020 22:37:28 +0000 Subject: [PATCH] test migration --- tests/DAI/conftest.py | 8 ++++++++ tests/DAI/test_live.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tests/DAI/conftest.py b/tests/DAI/conftest.py index 1cebeb9..1aa9682 100644 --- a/tests/DAI/conftest.py +++ b/tests/DAI/conftest.py @@ -145,6 +145,10 @@ def live_strategy_dai2(Strategy): def live_strategy_usdc3(Strategy): yield Strategy.at('0x31576ac682ee0A15c48C4baC24c567f27CA1b7cD') +@pytest.fixture +def live_strategy_usdc4(Strategy): + yield Strategy.at('0xC10363fa66d9c12724e56f269D0438B26581b2eA') + @pytest.fixture def live_vault_usdc3(Vault): yield Vault.at('0xe2F6b9773BF3A015E2aA70741Bde1498bdB9425b') @@ -154,6 +158,10 @@ def live_vault_usdc3(Vault): def live_strategy_dai3(Strategy): yield Strategy.at('0x5A9D49679319FCF3AcFe5559602Dbf31A221BaD6') +@pytest.fixture +def live_strategy_dai4(Strategy): + yield Strategy.at('0x001F751cdfee02e2F0714831bE2f8384db0F71a2') + @pytest.fixture def live_vault_dai3(Vault): yield Vault.at('0xBFa4D8AA6d8a379aBFe7793399D3DdaCC5bBECBB') diff --git a/tests/DAI/test_live.py b/tests/DAI/test_live.py index f635130..af2de38 100644 --- a/tests/DAI/test_live.py +++ b/tests/DAI/test_live.py @@ -34,7 +34,35 @@ def test_flash_loan(live_vault_dai2,live_vault_dai3,live_strategy_dai3, Contract #aave.flashLoan(live_strat, dai, 100, calldata, {'from': whale}) +def test_migration(live_vault_dai3,live_strategy_dai3,live_strategy_usdc3, live_strategy_usdc4,live_vault_usdc3, live_strategy_dai4, Contract, usdc, web3,live_gov, accounts, chain, cdai, comp, dai, live_strategy_dai2,currency, whale,samdev): + + vault = live_vault_dai3 + live_strat = live_strategy_dai4 + old_strat = live_strategy_dai3 + stateOfStrat(old_strat, dai, comp) + + vault.migrateStrategy(old_strat, live_strat, {'from': live_gov}) + + live_strat.harvest({'from':samdev}) + stateOfStrat(live_strat, dai, comp) + + print('usdc done') + vault = live_vault_usdc3 + live_strat = live_strategy_usdc4 + old_strat = live_strategy_usdc3 + stateOfStrat(old_strat, usdc, comp) + + vault.migrateStrategy(old_strat, live_strat, {'from': live_gov}) + live_strat.harvest({'from':samdev}) + stateOfStrat(live_strat, usdc, comp) + + #aave = Contract.from_explorer('0x398eC7346DcD622eDc5ae82352F02bE94C62d119') + #malicious call + #calldata = eth_abi.encode_abi(['bool', 'uint256'], [True, 1000]) + #calldata = eth_abi.encode_single('(bool,uint256)', [True, 1000]) + #print(calldata) + #aave.flashLoan(live_strat, dai, 100, calldata, {'from': whale}) def test_add_strat(live_vault_dai3, Contract,usdc, web3, accounts, chain, cdai, comp, dai, live_strategy_usdc3,live_vault_usdc3, live_strategy_dai3,live_gov, currency, whale,samdev):