diff --git a/CHANGELOG.md b/CHANGELOG.md index ebed6c03..bc49bbdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Current - Add: TokenSniffer API wrapper with a persistent cache +- Add: Enzyme vault deployments on Arbitrum # 0.26 diff --git a/contracts/terms-of-service b/contracts/terms-of-service index ac990734..0df22e88 160000 --- a/contracts/terms-of-service +++ b/contracts/terms-of-service @@ -1 +1 @@ -Subproject commit ac9907344de7a29c864e5a7dc72ea75cd45f03d3 +Subproject commit 0df22e8898717fd68b00807ccd06e1f563eb00a1 diff --git a/eth_defi/aave_v3/constants.py b/eth_defi/aave_v3/constants.py index 9e6eced9..d0e52c68 100644 --- a/eth_defi/aave_v3/constants.py +++ b/eth_defi/aave_v3/constants.py @@ -105,15 +105,22 @@ class AaveToken(NamedTuple): }, ), # Arbitrum Mainnet (XXX TODO - add more tokens) + # https://docs.aave.com/developers/deployed-contracts/v3-mainnet/arbitrum "arbitrum": AaveNetwork( name="Arbitrum", pool_address="0x794a61358D6845594F94dc1DB02A252b5b4814aD", pool_configurator_address="0x8145eddDf43f50276641b55bd3AD95944510021E", pool_created_at_block=7742429, # https://arbiscan.io/tx/0xf73ad5eb856faaf2eaf6e8a0823d2964e80ca4ad7cc2031f0606b158d236b5a9 + # https://github.com/bgd-labs/aave-address-book/blob/main/src/AaveV3Arbitrum.sol token_contracts={ # Aave token contracts defined in the Arbitrum network "AAVE": AaveToken(token_address="0xba5DdD1f9d7F570dc94a51479a000E3BCE967196", deposit_address="0xf329e36C7bF6E5E86ce2150875a84Ce77f477375", variable_borrow_address="0xE80761Ea617F66F96274eA5e8c37f03960ecC679", stable_borrow_address="0xfAeF6A702D15428E588d4C0614AEFb4348D83D48", token_created_at_block=7410775), # https://arbiscan.io/address/0xba5ddd1f9d7f570dc94a51479a000e3bce967196 "WETH": AaveToken(token_address="0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", deposit_address="0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", variable_borrow_address="0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351", stable_borrow_address="0xD8Ad37849950903571df17049516a5CD4cbE55F6", token_created_at_block=55), # https://arbiscan.io/address/0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 + "USDT": AaveToken(token_address="0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", deposit_address="0x6ab707Aca953eDAeFBc4fD23bA73294241490620", variable_borrow_address="0xfb00AC187a8Eb5AFAE4eACE434F493Eb62672df7", stable_borrow_address="0x70eFfc565DB6EEf7B927610155602d31b670e802", token_created_at_block=1), + # USDC native (not bridged) + "USDC": AaveToken(token_address="0xaf88d065e77c8cC2239327C5EDb3A432268e5831", deposit_address="0x724dc807b04555b71ed48a6896b6F41593b8C637", variable_borrow_address="0xf611aEb5013fD2c0511c9CD55c7dc5C1140741A6", stable_borrow_address="0xDC1fad70953Bb3918592b6fCc374fe05F5811B6a", token_created_at_block=1), + # USDC bridged + "USDC.e": AaveToken(token_address="0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", deposit_address="0x625E7708f30cA75bfd92586e17077590C60eb4cD", variable_borrow_address="0xFCCf3cAbbe80101232d343252614b6A3eE81C989", stable_borrow_address="0x307ffe186F84a3bc2613D1eA417A5737D69A7007", token_created_at_block=1), }, ), # Fantom Mainnet (XXX TODO - add more tokens) diff --git a/eth_defi/enzyme/deployment.py b/eth_defi/enzyme/deployment.py index 1cdd8ad6..7ad79dfd 100644 --- a/eth_defi/enzyme/deployment.py +++ b/eth_defi/enzyme/deployment.py @@ -59,6 +59,27 @@ "allowed_external_position_types_policy": "0x5A739da3099fd4fC954BD764099Fc000Da76D8e7", } +#: Enzyme deployment details for Arbitrum +#: +#: See :py:meth:`EnzymeDeployment.fetch_deployment` +#: +#: See https://docs.enzyme.finance/general-info/codebase/contracts/arbitrum +#: +ARBITRUM_DEPLOYMENT = { + "comptroller_lib": "0x3868c0fc34b6ece124c6ab122f6f29e978be6661", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", # USDC (bridged) + "usdt": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", # USDT + "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "arb": "0x912ce59144191c1204e64559fe8253a0e49e6548", + "fund_value_calculator": "0xea609eeb38d1ee8e8719597d47cc9276df9f8707", + "deployed_at": 23_0330_758, # When comptroller lib was deployed + "cumulative_slippage_tolerance_policy": "0x487f6a8a93c2be5a296ead2c3fbc3fceed4ac599", + "allowed_adapters_policy": "0x1768b813d17f82a8d70bd8b80a8c8c1562878337", + "only_remove_dust_external_position_policy": "0xe4453105be9e579896a3ed73df9a1e285c8c95c2", + "only_untrack_dust_or_priceless_assets_policy": "0xa482f4ab637cd5ca00084d511b3ca9aa8d8f475e", + "allowed_external_position_types_policy": "0x3c441b696bd451d0ba95ebb73cf1b23c20873e14", +} + #: Enzyme deployment details for Ethereum #: #: See :py:meth:`EnzymeDeployment.fetch_deployment` diff --git a/eth_defi/enzyme/generic_adapter_vault.py b/eth_defi/enzyme/generic_adapter_vault.py index 9ab895af..4c8a7c4b 100644 --- a/eth_defi/enzyme/generic_adapter_vault.py +++ b/eth_defi/enzyme/generic_adapter_vault.py @@ -24,7 +24,7 @@ from web3 import Web3 from web3.contract import Contract -from eth_defi.aave_v3.constants import AAVE_V3_DEPLOYMENTS +from eth_defi.aave_v3.constants import AAVE_V3_DEPLOYMENTS, AAVE_V3_NETWORKS from eth_defi.aave_v3.deployment import fetch_deployment as fetch_aave_deployment from eth_defi.enzyme.deployment import EnzymeDeployment from eth_defi.enzyme.policy import ( @@ -245,6 +245,9 @@ def deploy_vault_with_generic_adapter( deployer.sync_nonce(web3) if terms_of_service is not None: + assert denomination_asset.address + assert comptroller.address + assert terms_of_service.address payment_forwarder, tx_hash = deploy_contract_with_forge( web3, CONTRACTS_ROOT / "in-house", @@ -411,8 +414,13 @@ def deploy_guard( case 1: uniswap_v2_router = UNISWAP_V2_DEPLOYMENTS["ethereum"]["router"] uniswap_v3_router = UNISWAP_V3_DEPLOYMENTS["ethereum"]["router"] + case 42161: + if uniswap_v2: + raise NotImplementedError(f"Uniswap v2 not configured for Arbitrum yet") + uniswap_v2_router = None + uniswap_v3_router = UNISWAP_V3_DEPLOYMENTS["arbitrum"]["router"] case _: - logger.info("Uniswap not supported for chain %d", web3.eth.chain_id) + logger.error("Uniswap not supported for chain %d", web3.eth.chain_id) uniswap_v2_router = None uniswap_v3_router = None @@ -463,12 +471,35 @@ def deploy_guard( tx_hash = guard.functions.whitelistAaveV3(aave_pool_address, note).transact({"from": deployer.address}) assert_transaction_success_with_explanation(web3, tx_hash) - assert web3.eth.chain_id == 1, "TODO: Add support for non-mainnet chains" - ausdc_address = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c" - logger.info("Aave whitelisting for pool %s, aUSDC %s", aave_pool_address, ausdc_address) + match web3.eth.chain_id: + case 1: + assert web3.eth.chain_id == 1, "TODO: Add support for non-mainnet chains" + ausdc_address = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c" + logger.info("Aave whitelisting for pool %s, aUSDC %s", aave_pool_address, ausdc_address) + + note = f"Aave v3 pool whitelisting for USDC" + tx_hash = guard.functions.whitelistToken(ausdc_address, note).transact({"from": deployer.address}) + + case 42161: + # Arbitrum + aave_tokens = AAVE_V3_NETWORKS["arbitrum"].token_contracts + + # TODO: We automatically list all main a tokens as allowed assets + # we should limit here only to what the strategy needs, + # as these tokens may have their liquidity to dry up in the future + for symbol, token in aave_tokens.items(): + logger.info( + "Aave whitelisting for pool %s, atoken:%s address: %s", + symbol, + aave_pool_address, + token.token_address, + ) + note = f"Whitelisting Aave {symbol}" + tx_hash = guard.functions.whitelistToken(token.token_address, note).transact({"from": deployer.address}) + assert_transaction_success_with_explanation(web3, tx_hash) + case _: + raise NotImplementedError(f"TODO: Add support for non-mainnet chains, got {web3.eth.chain_id}") - note = f"Aave v3 pool whitelisting for USDC" - tx_hash = guard.functions.whitelistToken(ausdc_address, note).transact({"from": deployer.address}) assert_transaction_success_with_explanation(web3, tx_hash) deployer.sync_nonce(web3) diff --git a/eth_defi/foundry/forge.py b/eth_defi/foundry/forge.py index e8449e52..81e200f7 100644 --- a/eth_defi/foundry/forge.py +++ b/eth_defi/foundry/forge.py @@ -191,6 +191,8 @@ def deploy_contract_with_forge( assert type(contract_name) == str assert isinstance(deployer, HotWallet), f"Got deployer: {type(deployer)}" + assert deployer.private_key is not None, f"Deployer missing private key: {deployer}" + if constructor_args is None: constructor_args = [] @@ -236,7 +238,11 @@ def deploy_contract_with_forge( for arg in constructor_args: cmd_line.append(arg) - censored_command = " ".join(cmd_line) + try: + censored_command = " ".join(cmd_line) + except TypeError as e: + # Be helpful with None error + raise TypeError(f"Could not splice command line: {cmd_line}") from e logger.info( "Deploying a contract with forge. Working directory %s, forge command: %s", diff --git a/tests/enzyme/test_arbitrum_deployment.py b/tests/enzyme/test_arbitrum_deployment.py new file mode 100644 index 00000000..7c5dcb0f --- /dev/null +++ b/tests/enzyme/test_arbitrum_deployment.py @@ -0,0 +1,30 @@ +"""Get Enzyme deployment on Arbitrum. + +- Use Arbitrum live RPC for testing. + +""" +import os + +import pytest +from web3 import Web3 + +from eth_defi.enzyme.deployment import EnzymeDeployment, ARBITRUM_DEPLOYMENT +from eth_defi.provider.multi_provider import create_multi_provider_web3 + +JSON_RPC_ARBITRUM = os.environ.get("JSON_RPC_ARBITRUM") +pytestmark = pytest.mark.skipif(not JSON_RPC_ARBITRUM, reason="Set JSON_RPC_ARBITRUM to run this test") + + +@pytest.fixture() +def web3(): + web3 = create_multi_provider_web3(JSON_RPC_ARBITRUM) + return web3 + + +def test_fetch_enzyme_on_arbitrum( + web3: Web3, +): + """Fetch Enzyme deployment.""" + deployment = EnzymeDeployment.fetch_deployment(web3, ARBITRUM_DEPLOYMENT) + assert deployment.mln.functions.symbol().call() == "MLN" + assert deployment.weth.functions.symbol().call() == "WETH" diff --git a/tests/enzyme/test_arbitrum_trade.py b/tests/enzyme/test_arbitrum_trade.py new file mode 100644 index 00000000..cc47ff58 --- /dev/null +++ b/tests/enzyme/test_arbitrum_trade.py @@ -0,0 +1,345 @@ +"""Enzyme trade on Arbitrum. + +- Use Arbitrum mainnet fork for testing + +- Deploy a vault with a guard + +- Do swap and credit supply tests +""" +import os + +import pytest + +from eth_account import Account +from eth_account.signers.local import LocalAccount +from eth_typing import HexAddress + +from web3 import Web3 +from web3.contract import Contract + +from eth_defi.aave_v3.constants import AAVE_V3_NETWORKS, AAVE_V3_DEPLOYMENTS +from eth_defi.aave_v3.deployment import AaveV3Deployment +from eth_defi.aave_v3.loan import supply +from eth_defi.abi import get_deployed_contract, encode_function_call +from eth_defi.enzyme.deployment import ARBITRUM_DEPLOYMENT +from eth_defi.enzyme.generic_adapter import execute_calls_for_generic_adapter +from eth_defi.provider.anvil import AnvilLaunch, launch_anvil +from eth_defi.enzyme.deployment import EnzymeDeployment +from eth_defi.enzyme.generic_adapter_vault import deploy_vault_with_generic_adapter +from eth_defi.enzyme.uniswap_v3 import prepare_swap +from eth_defi.enzyme.vault import Vault +from eth_defi.hotwallet import HotWallet +from eth_defi.middleware import construct_sign_and_send_raw_middleware_anvil +from eth_defi.token import TokenDetails, fetch_erc20_details +from eth_defi.trace import ( + assert_transaction_success_with_explanation, +) +from eth_defi.uniswap_v3.constants import UNISWAP_V3_DEPLOYMENTS +from eth_defi.uniswap_v3.deployment import ( + UniswapV3Deployment, fetch_deployment, +) +from eth_defi.uniswap_v3.pool import PoolDetails, fetch_pool_details +from eth_defi.aave_v3.deployment import fetch_deployment as fetch_aave_v3_deployment + +JSON_RPC_ARBITRUM = os.environ.get("JSON_RPC_ARBITRUM") +pytestmark = pytest.mark.skipif(not JSON_RPC_ARBITRUM, reason="Set JSON_RPC_ARBITRUM to run this test") + + +@pytest.fixture() +def usdt_whale() -> HexAddress: + """A random account picked, holds a lot of stablecoin""" + # https://arbiscan.io/token/0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9#balances + return HexAddress("0x8f9c79B9De8b0713dCAC3E535fc5A1A92DB6EA2D") + + +@pytest.fixture() +def anvil(usdt_whale) -> AnvilLaunch: + """Launch Polygon fork.""" + + anvil = launch_anvil( + fork_url=JSON_RPC_ARBITRUM, + unlocked_addresses=[usdt_whale], + ) + try: + yield anvil + finally: + anvil.close() + + +@pytest.fixture +def deployer(web3) -> Account: + return web3.eth.accounts[0] + + +@pytest.fixture +def vault_owner(web3) -> Account: + return web3.eth.accounts[1] + + +@pytest.fixture +def asset_manager(web3) -> Account: + return web3.eth.accounts[2] + + +@pytest.fixture +def user_1(web3) -> Account: + return web3.eth.accounts[3] + + +@pytest.fixture +def usdt(web3) -> TokenDetails: + details = fetch_erc20_details(web3, "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9") + return details + + +@pytest.fixture +def ausdt(web3) -> TokenDetails: + details = fetch_erc20_details(web3, AAVE_V3_NETWORKS["arbitrum"].token_contracts["USDT"].deposit_address) + return details + + +@pytest.fixture +def weth(web3) -> TokenDetails: + # https://arbiscan.io/token/0x82af49447d8a07e3bd95bd0d56f35241523fbab1 + details = fetch_erc20_details(web3, "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1") + return details + + +@pytest.fixture +def wbtc(web3) -> TokenDetails: + details = fetch_erc20_details(web3, "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f") + return details + + +@pytest.fixture() +def enzyme( + web3, +) -> EnzymeDeployment: + """Deploy Enzyme protocol with few Chainlink feeds mocked with a static price.""" + deployment = EnzymeDeployment.fetch_deployment(web3, ARBITRUM_DEPLOYMENT) + return deployment + + +@pytest.fixture() +def terms_of_service(web3) -> Contract: + tos = get_deployed_contract( + web3, + "terms-of-service/TermsOfService.json", + "0xDCD7C644a6AA72eb2f86781175b18ADc30Aa4f4d", # https://github.com/tradingstrategy-ai/terms-of-service + ) + return tos + + +@pytest.fixture() +def vault( + web3: Web3, + deployer: HexAddress, + asset_manager: HexAddress, + enzyme: EnzymeDeployment, + weth: TokenDetails, + wbtc: TokenDetails, + usdt: TokenDetails, + terms_of_service: Contract, +) -> Vault: + """Deploy an Enzyme vault. + + Set up a forge compatible deployer account. + + - GuardV0 + - GuardedGenericAdapter + - TermsOfService + - TermedVaultUSDCPaymentForwarder + """ + + # Note that the only way to deploy vault is with a local private key, + # because we call external foundry processes + local_signer: LocalAccount = Account.create() + stash = web3.eth.get_balance(deployer) + tx_hash = web3.eth.send_transaction({"from": deployer, "to": local_signer.address, "value": stash // 2}) + assert_transaction_success_with_explanation(web3, tx_hash) + + hot_wallet = HotWallet(local_signer) + hot_wallet.sync_nonce(web3) + + # TODO: Hack + enzyme.deployer = hot_wallet.address + + web3.middleware_onion.add(construct_sign_and_send_raw_middleware_anvil(local_signer)) + + return deploy_vault_with_generic_adapter( + enzyme, + deployer=hot_wallet, + asset_manager=asset_manager, + owner=deployer, + denomination_asset=usdt.contract, + terms_of_service=terms_of_service, + whitelisted_assets=[weth, wbtc, usdt], + uniswap_v3=True, + uniswap_v2=False, + one_delta=False, + aave=True, + ) + + +@pytest.fixture() +def uniswap_v3( + web3: Web3, +) -> UniswapV3Deployment: + addresses = UNISWAP_V3_DEPLOYMENTS["arbitrum"] + uniswap = fetch_deployment( + web3, + addresses["factory"], + addresses["router"], + addresses["position_manager"], + addresses["quoter"], + ) + return uniswap + + +@pytest.fixture() +def aave_v3(web3) -> AaveV3Deployment: + deployment_info = AAVE_V3_DEPLOYMENTS["arbitrum"] + return fetch_aave_v3_deployment( + web3, + pool_address=deployment_info["pool"], + data_provider_address=deployment_info["data_provider"], + oracle_address=deployment_info["oracle"], + ) + + +@pytest.fixture() +def weth_usdt_pool(web3) -> PoolDetails: + # https://tradingstrategy.ai/trading-view/arbitrum/uniswap-v3/eth-usdt-fee-5 + return fetch_pool_details(web3, "0x641c00a822e8b671738d32a431a4fb6074e5c79d") + + +def test_enzyme_uniswap_v3_arbitrum( + web3: Web3, + deployer: HexAddress, + asset_manager: HexAddress, + user_1, + usdt_whale, + enzyme: EnzymeDeployment, + vault: Vault, + weth: TokenDetails, + usdt: TokenDetails, + wbtc: TokenDetails, + uniswap_v3: UniswapV3Deployment, + weth_usdt_pool: PoolDetails, +): + """Make a vault swap USDT->WETH.""" + + # Check that all the assets are supported on the Enzyme protocol level + # (Separate from our guard whitelist) + assert vault.is_supported_asset(usdt.address) + assert vault.is_supported_asset(weth.address) + assert vault.is_supported_asset(wbtc.address) + + assert usdt.fetch_balance_of(usdt_whale) > 500, f"Whale balance is {usdt.fetch_balance_of(usdt_whale)}" + + # Get USDT, to the initial shares buy + tx_hash = usdt.contract.functions.transfer(user_1, 500 * 10 ** 6,).transact({"from": usdt_whale}) + assert_transaction_success_with_explanation(web3, tx_hash) + tx_hash = usdt.contract.functions.approve(vault.comptroller.address, 500 * 10 ** 6).transact({"from": user_1}) + assert_transaction_success_with_explanation(web3, tx_hash) + tx_hash = vault.comptroller.functions.buyShares(500 * 10 ** 6, 1).transact({"from": user_1}) + assert_transaction_success_with_explanation(web3, tx_hash) + + assert vault.get_gross_asset_value() == 500 * 10**6 # Vault has been funded + + pool_fee_raw = 500 # 5 BPS + + # Vault swaps USDC->ETH for both users + # Buy ETH worth of 200 USD + prepared_tx = prepare_swap( + enzyme, + vault, + uniswap_v3, + vault.generic_adapter, + token_in=usdt.contract, + token_out=weth.contract, + pool_fees=[pool_fee_raw], + token_in_amount=200 * 10**6, # 200 USD + ) + + tx_hash = prepared_tx.transact({"from": asset_manager, "gas": 1_000_000}) + assert_transaction_success_with_explanation(web3, tx_hash) + + # Bought ETH landed in the vault + assert 0.01 < weth.fetch_balance_of(vault.address) < 1 + + +def test_enzyme_aave_arbitrum( + web3: Web3, + deployer: HexAddress, + asset_manager: HexAddress, + user_1, + usdt_whale, + enzyme: EnzymeDeployment, + vault: Vault, + weth: TokenDetails, + usdt: TokenDetails, + ausdt: TokenDetails, + aave_v3: AaveV3Deployment, +): + """Make a Aave deposit USDT -> aUSDT that goes through a vault.""" + + # Check that all the assets are supported on the Enzyme protocol level + # (Separate from our guard whitelist) + assert vault.is_supported_asset(usdt.address) + assert vault.is_supported_asset(weth.address) + + assert usdt.fetch_balance_of(usdt_whale) > 500, f"Whale balance is {usdt.fetch_balance_of(usdt_whale)}" + + # Get USDT, to the initial shares buy + tx_hash = usdt.contract.functions.transfer(user_1, 500 * 10 ** 6, ).transact({"from": usdt_whale}) + assert_transaction_success_with_explanation(web3, tx_hash) + tx_hash = usdt.contract.functions.approve(vault.comptroller.address, 500 * 10 ** 6).transact({"from": user_1}) + assert_transaction_success_with_explanation(web3, tx_hash) + tx_hash = vault.comptroller.functions.buyShares(500 * 10 ** 6, 1).transact({"from": user_1}) + assert_transaction_success_with_explanation(web3, tx_hash) + + assert vault.get_gross_asset_value() == 500 * 10 ** 6 # Vault has been funded + + # Deposit $100 USDT + raw_amount = 100 * 10 ** 6 + + # Supply to USDT reserve + vault_delivery_address = vault.generic_adapter.address + approve_fn, supply_fn = supply( + aave_v3_deployment=aave_v3, + wallet_address=vault_delivery_address, + token=usdt.contract, + amount=raw_amount, + ) + + # The vault performs a swap on Uniswap v3 + encoded_approve = encode_function_call( + approve_fn, + approve_fn.arguments, + ) + + encoded_supply = encode_function_call( + supply_fn, + supply_fn.arguments, + ) + + prepared_tx = execute_calls_for_generic_adapter( + comptroller=vault.comptroller, + external_calls=( + (usdt.contract, encoded_approve), + (aave_v3.pool, encoded_supply), + ), + generic_adapter=vault.generic_adapter, + incoming_assets=[ausdt.address], + integration_manager=enzyme.contracts.integration_manager, + min_incoming_asset_amounts=[raw_amount], + spend_asset_amounts=[raw_amount], + spend_assets=[usdt.address], + ) + + tx_hash = prepared_tx.transact({"from": asset_manager, "gas": 1_000_000}) + assert_transaction_success_with_explanation(web3, tx_hash) + + # Supplied aUSDT landed in the vault + assert ausdt.fetch_balance_of(vault.address) == 100 diff --git a/tests/enzyme/test_polygon.py b/tests/enzyme/test_polygon.py index 302120d4..f4f7e699 100644 --- a/tests/enzyme/test_polygon.py +++ b/tests/enzyme/test_polygon.py @@ -34,4 +34,4 @@ def test_fetch_enzyme_on_polygon( """Fetch Enzyme deployment on Polygon.""" deployment = EnzymeDeployment.fetch_deployment(web3, POLYGON_DEPLOYMENT) assert deployment.mln.functions.symbol().call() == "MLN" - assert deployment.weth.functions.symbol().call() == "WMATIC" + assert deployment.weth.functions.symbol().call() == "WPOL" diff --git a/tests/guard/test_guard_simple_vault_aave_v3.py b/tests/guard/test_guard_simple_vault_aave_v3.py index e0585c16..2c07fefb 100644 --- a/tests/guard/test_guard_simple_vault_aave_v3.py +++ b/tests/guard/test_guard_simple_vault_aave_v3.py @@ -14,6 +14,7 @@ from eth_account.signers.local import LocalAccount from eth_tester.exceptions import TransactionFailed from eth_typing import HexAddress, HexStr +from flaky import flaky from web3 import EthereumTesterProvider, Web3 from web3._utils.events import EventLogErrorFlags from web3.contract import Contract @@ -276,6 +277,11 @@ def test_guard_can_do_aave_supply( assert_transaction_success_with_explanation(web3, tx_hash, tracing=True) +# FAILED tests/guard/test_guard_simple_vault_one_delta.py::test_guard_can_short - assert 2000000002537484976 == 1000000000000000000 ± 1.0e+12 +# comparison failed +# Obtained: 2000000002537484976 +# Expected: 1000000000000000000 ± 1.0e+12 +@flaky def test_guard_can_do_aave_withdraw( web3: Web3, aave_v3_deployment: AaveV3Deployment,