From 02eb43d57359ae90bfba9bafdb2352d4c98afc25 Mon Sep 17 00:00:00 2001 From: Lesigh-3100 Date: Fri, 5 Jan 2024 09:06:42 +0200 Subject: [PATCH 1/2] Fix Sushi default fee in multichain_addresses.csv --- fastlane_bot/data/multichain_addresses.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane_bot/data/multichain_addresses.csv b/fastlane_bot/data/multichain_addresses.csv index 876287aa0..575f80501 100644 --- a/fastlane_bot/data/multichain_addresses.csv +++ b/fastlane_bot/data/multichain_addresses.csv @@ -28,8 +28,8 @@ uniswap_v3,binance_smart_chain,uniswap_v3,FACTORY_ADDRESS,0xdB1d10011AD0Ff90774D uniswap_v3,binance_smart_chain,uniswap_v3,ROUTER_ADDRESS,0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2,NA, uniswap_v3,coinbase_base,uniswap_v3,FACTORY_ADDRESS,0x33128a8fC17869897dcE68Ed026d694621f6FDfD,NA,1371680 uniswap_v3,coinbase_base,uniswap_v3,ROUTER_ADDRESS,0x2626664c2603336E57B271c5C0b26F421741e481,NA, -sushiswap_v2,ethereum,uniswap_v2,FACTORY_ADDRESS,0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac,0.0025,10794229 -sushiswap_v2,ethereum,uniswap_v2,ROUTER_ADDRESS,0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F,0.0025, +sushiswap_v2,ethereum,uniswap_v2,FACTORY_ADDRESS,0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac,0.003,10794229 +sushiswap_v2,ethereum,uniswap_v2,ROUTER_ADDRESS,0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F,0.003, sushiswap_v2,coinbase_base,uniswap_v2,FACTORY_ADDRESS,0x71524B4f93c58fcbF659783284E38825f0622859,0.003,2631214 sushiswap_v2,coinbase_base,uniswap_v2,ROUTER_ADDRESS,0x6BDED42c6DA8FBf0d2bA55B2fa120C5e0c8D7891,0.003, sushiswap_v2,arbitrum_one,uniswap_v2,FACTORY_ADDRESS,0xc35DADB65012eC5796536bD9864eD8773aBc74C4,0.003,70 From f5f1e9e2263ba63d71cdf0a93284be1d7a72652c Mon Sep 17 00:00:00 2001 From: Lesigh-3100 Date: Fri, 5 Jan 2024 09:18:28 +0200 Subject: [PATCH 2/2] Add test for multichain addresses default fees for Uni, Sushi, and Pancake --- ...NBTest_059_TestNetworkInfoMultichain.ipynb | 48 +++++++++++++++++-- .../NBTest_059_TestNetworkInfoMultichain.py | 23 +++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.ipynb b/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.ipynb index ce354f10f..3c4e4583c 100644 --- a/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.ipynb +++ b/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.ipynb @@ -83,11 +83,11 @@ "name": "stderr", "output_type": "stream", "text": [ - "2023-12-18 12:00:34,144 [fastlane:INFO] - \n", - "2023-12-18 12:00:34,145 [fastlane:INFO] - **********************************************\n", - "2023-12-18 12:00:34,145 [fastlane:INFO] - The logging path is set to: logs/20231218-120034\\bot.log\n", - "2023-12-18 12:00:34,146 [fastlane:INFO] - **********************************************\n", - "2023-12-18 12:00:34,146 [fastlane:INFO] - \n" + "2024-01-05 09:16:40,349 [fastlane:INFO] - \n", + "2024-01-05 09:16:40,349 [fastlane:INFO] - **********************************************\n", + "2024-01-05 09:16:40,350 [fastlane:INFO] - The logging path is set to: logs/20240105-091640\\bot.log\n", + "2024-01-05 09:16:40,351 [fastlane:INFO] - **********************************************\n", + "2024-01-05 09:16:40,351 [fastlane:INFO] - \n" ] } ], @@ -161,6 +161,44 @@ "get_router_for_ex_test = get_router_address_for_exchange(exchange_name=\"aerodrome_v2\", fork=\"solidly_v2\", df=exchange_df)\n", "assert type(get_router_for_ex_test) == str" ] + }, + { + "cell_type": "markdown", + "id": "a99b3597", + "metadata": {}, + "source": [ + "## Test_default_fees_uni_v2_forks" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "37bb2ea4", + "metadata": {}, + "outputs": [], + "source": [ + "multichain_address_path = os.path.normpath(\n", + " \"fastlane_bot/data/multichain_addresses.csv\"\n", + " )\n", + "chain_addresses_df = pd.read_csv(multichain_address_path)\n", + "\n", + "for idx, row in chain_addresses_df.iterrows():\n", + " exchange_name = row[\"exchange_name\"]\n", + " fork = row[\"fork\"]\n", + " fee = row[\"fee\"]\n", + " if exchange_name in [\"uniswap_v2\", \"sushiswap_v2\"]:\n", + " assert float(fee) == 0.003, f\"[NBTest_059_TestNetworkInfoMultichain] Wrong default set for {exchange_name}. Expected 0.003, found {fee}\"\n", + " elif exchange_name in [\"pancakeswap_v2\"]:\n", + " assert float(fee) == 0.0025, f\"[NBTest_059_TestNetworkInfoMultichain] Wrong default set for {exchange_name}. Expected 0.0025, found {fee}\" " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3901e286", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.py b/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.py index 9de7ca3c7..87bf189e3 100644 --- a/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.py +++ b/resources/NBTest/NBTest_059_TestNetworkInfoMultichain.py @@ -14,6 +14,7 @@ # name: python3 # --- +# + # coding=utf-8 """ This module contains the tests for the exchanges classes @@ -47,6 +48,7 @@ plt.rcParams['figure.figsize'] = [12,6] from fastlane_bot import __VERSION__ require("3.0", __VERSION__) +# - # # Multichain Network Configuration Test [NBTest059] @@ -91,3 +93,24 @@ get_router_for_ex_test = get_router_address_for_exchange(exchange_name="aerodrome_v2", fork="solidly_v2", df=exchange_df) assert type(get_router_for_ex_test) == str +# - + +# ## Test_default_fees_uni_v2_forks + +# + +multichain_address_path = os.path.normpath( + "fastlane_bot/data/multichain_addresses.csv" + ) +chain_addresses_df = pd.read_csv(multichain_address_path) + +for idx, row in chain_addresses_df.iterrows(): + exchange_name = row["exchange_name"] + fork = row["fork"] + fee = row["fee"] + if exchange_name in ["uniswap_v2", "sushiswap_v2"]: + assert float(fee) == 0.003, f"[NBTest_059_TestNetworkInfoMultichain] Wrong default set for {exchange_name}. Expected 0.003, found {fee}" + elif exchange_name in ["pancakeswap_v2"]: + assert float(fee) == 0.0025, f"[NBTest_059_TestNetworkInfoMultichain] Wrong default set for {exchange_name}. Expected 0.0025, found {fee}" +# - + +