def test_bank(token, bank): alice = accounts[1] uniswap_spell = UniswapV2SpellV1.at( '0xc671B7251a789de0835a2fa33c83c8D4afB39092') mint_tokens(token, alice) token.approve(bank, 2**256 - 1, {'from': alice}) weth = interface.IERC20Ex('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2') amt = 100 * 10**(token.decimals() - 4) borrow_amt = 1 * 10**(token.decimals() - 4) prevTokenAlice = token.balanceOf(alice) bank.execute( 0, uniswap_spell, uniswap_spell.addLiquidityWERC20.encode_input( token, weth, [amt, 0, 0, borrow_amt, 10**10, 0, 0, 0]), {'from': alice}) curTokenAlice = token.balanceOf(alice) assert almostEqual(curTokenAlice - prevTokenAlice, -amt), 'incorrect input amt'
def main(): deployer = accounts.at('0xB593d82d53e2c187dc49673709a6E9f806cdC835', force=True) # deployer = accounts.load('gh') werc20 = WERC20.at('0xe28D9dF7718b0b5Ba69E01073fE82254a9eD2F98') wmas = WMasterChef.at('0x373ae78a14577682591E088F2E78EF1417612c68') wliq = WLiquidityGauge.at('0xfdB4f97953150e47C8606758C13e70b5a789a7ec') wsindex = WStakingRewards.at('0x713df2DDDA9C7d7bDa98A9f8fCd82c06c50fbd90') wsperp = WStakingRewards.at('0xC4635854480ffF80F742645da0310e9e59795c63') uni_kp3r_oracle = ERC20KP3ROracle.at( '0x8E2A3777AB22e1c5f6d1fF2BcC6C4aA6aB1DeA14') sushi_kp3r_oracle = ERC20KP3ROracle.at( '0xC331687FD71bb1D7f2e237091F8888dDcaD50C9a') core_oracle = CoreOracle.at('0x1E5BDdd0cDF8839d6b27b34927869eF0AD7bf692') uni_oracle = UniswapV2Oracle.at( '0x910aD02D355c2966e8dD8E32C890cD50DB29C3B9') bal_oracle = BalancerPairOracle.at( '0x8F93B0AA2643bf74ab38d6a5910fA82D2da02134') crv_oracle = CurveOracle.at('0x04DE0E42B3b0483248deafE86C4F5428613b76Ff') proxy_oracle = ProxyOracle.at('0x43c425fB2b00a991A51b18c217D749E393bF1AB2') # pair token with oracle from .tokens import Tokens # re-set oracles oracle_params = [ # lp tokens [Tokens.bal_perp_usdc, [14886, 6718, 10250]], ] token_list_2, param_list = zip(*oracle_params) proxy_oracle.setOracles(token_list_2, param_list, {'from': deployer}) proxy_oracle.unsetOracles([Tokens.bal_dai_weth], {'from': deployer}) print('DONE') ########################################################### # test spells (UNCOMMENT TO TEST) for token in [ Tokens.weth, Tokens.dai, Tokens.usdc, Tokens.usdt, Tokens.dpi, Tokens.yfi, Tokens.snx, Tokens.susd ]: token = interface.IERC20Ex(token) deposit_safebox(token) bank = HomoraBank.at('0x5f5Cd91070960D13ee549C9CC47e7a4Cd00457bb') uniswap_spell = UniswapV2SpellV1.at( '0xc671B7251a789de0835a2fa33c83c8D4afB39092') sushiswap_spell = SushiswapSpellV1.at( '0x21Fa95485f4571A3a0d0c396561cF4D8D13D445d') balancer_spell = BalancerSpellV1.at( '0x15B79c184A6a8E19a4CA1F637081270343E4D15D') curve_spell = CurveSpellV1.at('0x42C750024E02816eE32EB2eB4DA79ff5BF343D30')
def main(): deployer = accounts.at('0xB593d82d53e2c187dc49673709a6E9f806cdC835', force=True) # deployer = accounts.load('gh') werc20 = WERC20.at('0xe28D9dF7718b0b5Ba69E01073fE82254a9eD2F98') wmas = WMasterChef.at('0x373ae78a14577682591E088F2E78EF1417612c68') wliq = WLiquidityGauge.at('0xfdB4f97953150e47C8606758C13e70b5a789a7ec') wsindex = WStakingRewards.at('0x713df2DDDA9C7d7bDa98A9f8fCd82c06c50fbd90') wsperp = WStakingRewards.at('0xC4635854480ffF80F742645da0310e9e59795c63') uni_kp3r_oracle = ERC20KP3ROracle.at('0x8E2A3777AB22e1c5f6d1fF2BcC6C4aA6aB1DeA14') sushi_kp3r_oracle = ERC20KP3ROracle.deploy( '0xf67Ab1c914deE06Ba0F264031885Ea7B276a7cDa', {'from': deployer}) core_oracle = CoreOracle.at('0x1E5BDdd0cDF8839d6b27b34927869eF0AD7bf692') uni_oracle = UniswapV2Oracle.at('0x910aD02D355c2966e8dD8E32C890cD50DB29C3B9') bal_oracle = BalancerPairOracle.at('0x8F93B0AA2643bf74ab38d6a5910fA82D2da02134') crv_oracle = CurveOracle.at('0x04DE0E42B3b0483248deafE86C4F5428613b76Ff') proxy_oracle = ProxyOracle.at('0x43c425fB2b00a991A51b18c217D749E393bF1AB2') # pair token with oracle from .tokens import Tokens token_oracle_settings = [ # base tokens [Tokens.weth, uni_kp3r_oracle], [Tokens.dai, uni_kp3r_oracle], [Tokens.usdc, uni_kp3r_oracle], [Tokens.usdt, uni_kp3r_oracle], [Tokens.dpi, uni_kp3r_oracle], [Tokens.yfi, sushi_kp3r_oracle], [Tokens.perp, uni_kp3r_oracle], [Tokens.snx, sushi_kp3r_oracle], [Tokens.susd, sushi_kp3r_oracle], [Tokens.uni, uni_kp3r_oracle], [Tokens.sushi, sushi_kp3r_oracle], # lp tokens [Tokens.uni_eth_yfi, uni_oracle], [Tokens.sushi_eth_yfi, uni_oracle], [Tokens.uni_eth_dpi, uni_oracle], [Tokens.crv_3pool, crv_oracle], [Tokens.sushi_eth_dpi, uni_oracle], [Tokens.uni_eth_snx, uni_oracle], [Tokens.uni_eth_susd, uni_oracle], [Tokens.sushi_eth_susd, uni_oracle], [Tokens.sushi_eth_snx, uni_oracle], [Tokens.crv_susd, crv_oracle], [Tokens.sushi_eth_sushi, uni_oracle], [Tokens.uni_eth_uni, uni_oracle], [Tokens.bal_perp_usdc, bal_oracle], ] token_list, oracle_list = zip(*token_oracle_settings) # re-route to new uniswap oracle core_oracle.setRoute(token_list, oracle_list, {'from': deployer}) # re-set oracles oracle_params = [ # base tokens [Tokens.weth, [17158, 5828, 12500]], [Tokens.dai, [10790, 9268, 12500]], [Tokens.usdc, [10651, 9389, 12500]], [Tokens.usdt, [10743, 9308, 12500]], [Tokens.dpi, [16195, 6175, 12500]], [Tokens.yfi, [29155, 3430, 12500]], [Tokens.perp, [20042, 4989, 12500]], [Tokens.snx, [18162, 5506, 12500]], [Tokens.susd, [12129, 8245, 12500]], [Tokens.uni, [16022, 6241, 12500]], [Tokens.sushi, [19418, 5150, 12500]], # lp tokens [Tokens.uni_eth_dpi, [17158, 5828, 12500]], [Tokens.uni_eth_yfi, [29155, 3430, 12500]], [Tokens.uni_eth_snx, [18162, 5506, 12500]], [Tokens.uni_eth_susd, [17158, 5828, 12500]], [Tokens.uni_eth_uni, [17158, 5828, 12500]], [Tokens.sushi_eth_dpi, [17158, 5828, 12500]], [Tokens.sushi_eth_yfi, [29155, 3430, 12500]], [Tokens.sushi_eth_snx, [18162, 5506, 12500]], [Tokens.sushi_eth_susd, [17158, 5828, 12500]], [Tokens.sushi_eth_sushi, [19418, 5150, 12500]], [Tokens.bal_perp_usdc, [20042, 4989, 12500]], [Tokens.crv_3pool, [10790, 9268, 12500]], [Tokens.crv_susd, [12129, 8245, 12500]], ] token_list_2, param_list = zip(*oracle_params) proxy_oracle.setOracles(token_list_2, param_list, {'from': deployer}) print('DONE') ########################################################### # test spells (UNCOMMENT TO TEST) bank = HomoraBank.at('0x5f5Cd91070960D13ee549C9CC47e7a4Cd00457bb') uniswap_spell = UniswapV2SpellV1.at('0xc671B7251a789de0835a2fa33c83c8D4afB39092') sushiswap_spell = SushiswapSpellV1.at('0x21Fa95485f4571A3a0d0c396561cF4D8D13D445d') balancer_spell = BalancerSpellV1.at('0x15B79c184A6a8E19a4CA1F637081270343E4D15D') curve_spell = CurveSpellV1.at('0x42C750024E02816eE32EB2eB4DA79ff5BF343D30')