From 84638bff7c52c395e96cf912296e7c1d80e7a5cc Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 29 Sep 2022 18:56:10 +0800 Subject: [PATCH 1/6] rm deprecated testnets --- assets/config/0.5.6-coins.json | 66 ------------------- src/app/app.cpp | 7 +- src/core/atomicdex/api/mm2/rpc.enable.cpp | 10 ++- src/core/atomicdex/api/mm2/rpc.enable.hpp | 4 -- src/core/atomicdex/config/coins.cfg.cpp | 12 +++- .../atomicdex/constants/qt.coins.enums.hpp | 5 +- 6 files changed, 21 insertions(+), 83 deletions(-) diff --git a/assets/config/0.5.6-coins.json b/assets/config/0.5.6-coins.json index 89abf1a2ce..5f96d6775c 100644 --- a/assets/config/0.5.6-coins.json +++ b/assets/config/0.5.6-coins.json @@ -3702,22 +3702,6 @@ "active": false, "currently_enabled": false }, - "JSTR": { - "coin": "JSTR", - "name": "Ropsten test ERC20", - "coinpaprika_id": "test-coin", - "coingecko_id": "test-coin", - "is_testnet": true, - "nodes": [ - "https://ropsten.infura.io/v3/1d059a9aca7d49a3a380c71068bffb1c" - ], - "explorer_url": [ - "https://ropsten.etherscan.io/" - ], - "type": "ERC-20", - "active": false, - "currently_enabled": false - }, "JUMBLR": { "coin": "JUMBLR", "name": "JUMBLR", @@ -4828,56 +4812,6 @@ "type": "Arbitrum", "name": "Ethereum" }, - "ETHK-OPT20": { - "active": false, - "wallet_only": true, - "coin": "ETHK-OPT20", - "coingecko_id": "test-coin", - "coinpaprika_id": "test-coin", - "currently_enabled": false, - "is_testnet": true, - "nodes": [ - "https://kovan.optimism.io" - ], - "explorer_url": [ - "https://kovan-optimistic.etherscan.io/" - ], - "type": "Optimism", - "name": "EthKovan Optimism (Testnet)" - }, - "ETHR-ARB20": { - "active": false, - "wallet_only": true, - "coin": "ETHR-ARB20", - "coingecko_id": "test-coin", - "coinpaprika_id": "test-coin", - "currently_enabled": false, - "is_testnet": true, - "nodes": [ - "https://rinkeby.arbitrum.io/rpc" - ], - "explorer_url": [ - "https://rinkeby-explorer.arbitrum.io/#/" - ], - "type": "Arbitrum", - "name": "EthRinkeby Arbitrum (Testnet)" - }, - "ETHR": { - "active": false, - "coin": "ETHR", - "coingecko_id": "test-coin", - "coinpaprika_id": "test-coin", - "currently_enabled": false, - "is_testnet": true, - "nodes": [ - "https://ropsten.infura.io/v3/1d059a9aca7d49a3a380c71068bffb1c" - ], - "explorer_url": [ - "https://ropsten.etherscan.io/" - ], - "type": "ERC-20", - "name": "Ethereum Ropsten (Testnet)" - }, "UIS": { "coin": "UIS", "name": "Unitus", diff --git a/src/app/app.cpp b/src/app/app.cpp index e89940c508..0039b0e072 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -85,9 +85,12 @@ namespace atomic_dex !coins.contains(QString::fromStdString(coin_info.fees_ticker))) { auto coin_parent_info = mm2.get_coin_info(coin_info.fees_ticker); - if (!coin_parent_info.currently_enabled && !coin_parent_info.active && extra_coins.insert(coin_parent_info.ticker).second) + if (coin_parent_info.ticker != "") { - SPDLOG_INFO("Adding extra coin: {} to enable", coin_parent_info.ticker); + if (!coin_parent_info.currently_enabled && !coin_parent_info.active && extra_coins.insert(coin_parent_info.ticker).second) + { + SPDLOG_INFO("Adding extra coin: {} to enable", coin_parent_info.ticker); + } } } coins_std.push_back(coin.toStdString()); diff --git a/src/core/atomicdex/api/mm2/rpc.enable.cpp b/src/core/atomicdex/api/mm2/rpc.enable.cpp index ab6f52c8c8..0722bb9c23 100644 --- a/src/core/atomicdex/api/mm2/rpc.enable.cpp +++ b/src/core/atomicdex/api/mm2/rpc.enable.cpp @@ -51,17 +51,15 @@ namespace atomic_dex::mm2 case CoinType::Optimism: { j["urls"] = cfg.urls; - j["swap_contract_address"] = cfg.is_testnet ? cfg.optimism_erc_testnet_swap_contract_address : cfg.optimism_erc_swap_contract_address; - j["fallback_swap_contract"] = - cfg.is_testnet ? cfg.optimism_erc_testnet_fallback_swap_contract_address : cfg.optimism_erc_fallback_swap_contract_address; + j["swap_contract_address"] = cfg.optimism_erc_swap_contract_address; + j["fallback_swap_contract"] = cfg.optimism_erc_fallback_swap_contract_address; break; } case CoinType::Arbitrum: { j["urls"] = cfg.urls; - j["swap_contract_address"] = cfg.is_testnet ? cfg.arbitrum_erc_testnet_swap_contract_address : cfg.arbitrum_erc_swap_contract_address; - j["fallback_swap_contract"] = - cfg.is_testnet ? cfg.arbitrum_erc_testnet_fallback_swap_contract_address : cfg.arbitrum_erc_fallback_swap_contract_address; + j["swap_contract_address"] = cfg.arbitrum_erc_swap_contract_address; + j["fallback_swap_contract"] = cfg.arbitrum_erc_fallback_swap_contract_address; break; } case CoinType::BEP20: diff --git a/src/core/atomicdex/api/mm2/rpc.enable.hpp b/src/core/atomicdex/api/mm2/rpc.enable.hpp index c28fdf75e4..2b7d3274e3 100644 --- a/src/core/atomicdex/api/mm2/rpc.enable.hpp +++ b/src/core/atomicdex/api/mm2/rpc.enable.hpp @@ -77,12 +77,8 @@ namespace atomic_dex::mm2 const std::string matic_erc_testnet_fallback_swap_contract_address{"0x73c1Dd989218c3A154C71Fc08Eb55A24Bd2B3A10"}; const std::string optimism_erc_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; const std::string optimism_erc_fallback_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; - const std::string optimism_erc_testnet_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; - const std::string optimism_erc_testnet_fallback_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; const std::string arbitrum_erc_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; const std::string arbitrum_erc_fallback_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; - const std::string arbitrum_erc_testnet_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; - const std::string arbitrum_erc_testnet_fallback_swap_contract_address{"0x9130b257d37a52e52f21054c4da3450c72f595ce"}; const std::string sbch_erc_swap_contract_address{"0x25bF2AAB8749AD2e4360b3e0B738f3Cd700C4D68"}; const std::string sbch_erc_fallback_swap_contract_address{"0x25bF2AAB8749AD2e4360b3e0B738f3Cd700C4D68"}; const std::string sbch_erc_testnet_swap_contract_address{"0x25bF2AAB8749AD2e4360b3e0B738f3Cd700C4D68"}; diff --git a/src/core/atomicdex/config/coins.cfg.cpp b/src/core/atomicdex/config/coins.cfg.cpp index 94cc9d72ae..47daeb0a25 100644 --- a/src/core/atomicdex/config/coins.cfg.cpp +++ b/src/core/atomicdex/config/coins.cfg.cpp @@ -109,7 +109,9 @@ namespace { return CoinType::ZHTLC; } - throw std::invalid_argument{"Undefined given coin type."}; + SPDLOG_INFO("Invalid coin type: {}", coin_type); + return CoinType::Invalid; + // throw std::invalid_argument{"Undefined given coin type."}; } } @@ -222,12 +224,12 @@ namespace atomic_dex break; case CoinType::Optimism: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "ETHK-OPT20" : "ETH-OPT20"; + cfg.fees_ticker = "ETH-OPT20"; cfg.is_erc_family = true; break; case CoinType::Arbitrum: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "ETHR-ARB20" : "ETH-ARB20"; + cfg.fees_ticker = "ETH-ARB20"; cfg.is_erc_family = true; break; case CoinType::AVX20: @@ -294,6 +296,10 @@ namespace atomic_dex cfg.is_zhtlc_family = true; cfg.fees_ticker = cfg.ticker; break; + case CoinType::Invalid: + cfg.has_parent_fees_ticker = false; + cfg.fees_ticker = cfg.ticker; + break; default: cfg.has_parent_fees_ticker = false; cfg.fees_ticker = cfg.ticker; diff --git a/src/core/atomicdex/constants/qt.coins.enums.hpp b/src/core/atomicdex/constants/qt.coins.enums.hpp index 11231a9f2d..83f70bcc5e 100644 --- a/src/core/atomicdex/constants/qt.coins.enums.hpp +++ b/src/core/atomicdex/constants/qt.coins.enums.hpp @@ -53,8 +53,9 @@ namespace atomic_dex RSK = 19, ZHTLC = 20, Disabled = 21, - All = 22, - Size = 23 + Invalid = 22, + All = 23, + Size = 24 }; Q_ENUM(CoinTypeEnum) From f5ad091277fa557d115656c5728907441498de25 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 29 Sep 2022 21:06:09 +0800 Subject: [PATCH 2/6] fix chart from bestorders bug --- atomic_defi_design/Dex/Exchange/ProView/Chart.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml index 890898328e..73fe5e0a44 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml @@ -182,9 +182,9 @@ Item Connections { target: app - function onPairChanged() + function onPairChanged(left, right) { - root.loadChart(left_ticker, right_ticker) + root.loadChart(left, right) } } From 704c9429e006bcf2cc2706f2eac1f0bc0e514885 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 29 Sep 2022 23:22:38 +0800 Subject: [PATCH 3/6] surround bug --- atomic_defi_design/Dex/Exchange/ProView/Chart.qml | 10 +++++++++- .../Dex/Exchange/Trade/BestOrder/ListDelegate.qml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml index 73fe5e0a44..4dbc9dc49d 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml @@ -6,6 +6,7 @@ import QtWebEngine 1.8 import "../../Components" import "../../Constants" import Dex.Themes 1.0 as Dex +import AtomicDEX.MarketMode 1.0 Item { @@ -184,7 +185,14 @@ Item target: app function onPairChanged(left, right) { - root.loadChart(left, right) + if (API.app.trading_pg.market_mode == MarketMode.Sell) + { + root.loadChart(left, right) + } + else + { + root.loadChart(right, left) + } } } diff --git a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml index 5834c977af..08cccfba5a 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml @@ -170,7 +170,7 @@ Item placeOrderForm.visible = General.flipFalse(placeOrderForm.visible) if (API.app.trading_pg.market_mode == MarketMode.Buy) { - app.pairChanged(rel_ticker, coin) + app.pairChanged(coin, rel_ticker) } else { From 2055a5a462228c6003bcfe09ebdb7ef0134a85cb Mon Sep 17 00:00:00 2001 From: cipig Date: Thu, 29 Sep 2022 23:05:53 +0000 Subject: [PATCH 4/6] add coingecko_id for NYAN --- assets/config/0.5.6-coins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/config/0.5.6-coins.json b/assets/config/0.5.6-coins.json index 89abf1a2ce..17e65de2a1 100644 --- a/assets/config/0.5.6-coins.json +++ b/assets/config/0.5.6-coins.json @@ -5821,7 +5821,7 @@ "coin": "NYAN", "name": "Nyancoin", "coinpaprika_id": "nyan-nyancoin", - "coingecko_id": "test-coin", + "coingecko_id": "nyancoin", "nomics_id": "NYAN", "electrum": [ { From 26e043ac288cce24272fcedb327cd1d24a23f10f Mon Sep 17 00:00:00 2001 From: cipig Date: Fri, 30 Sep 2022 00:11:02 +0000 Subject: [PATCH 5/6] fix coingecko_id for PRCY --- assets/config/0.5.6-coins.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/config/0.5.6-coins.json b/assets/config/0.5.6-coins.json index 17e65de2a1..5bbc379c62 100644 --- a/assets/config/0.5.6-coins.json +++ b/assets/config/0.5.6-coins.json @@ -9858,7 +9858,7 @@ "coin": "PRCY-BEP20", "name": "PRivaCY Coin", "coinpaprika_id": "prcy-privacy-coin", - "coingecko_id": "privacy-coin", + "coingecko_id": "prcy-coin", "nomics_id": "PRCY", "nodes": [ "http://bsc1.cipig.net:8655", @@ -9876,7 +9876,7 @@ "coin": "PRCY-ERC20", "name": "PRivaCY Coin", "coinpaprika_id": "prcy-privacy-coin", - "coingecko_id": "privacy-coin", + "coingecko_id": "prcy-coin", "nomics_id": "PRCY", "nodes": [ "http://eth1.cipig.net:8555", @@ -9894,7 +9894,7 @@ "coin": "PRCY-PLG20", "name": "PRivaCY Coin", "coinpaprika_id": "prcy-privacy-coin", - "coingecko_id": "privacy-coin", + "coingecko_id": "prcy-coin", "nomics_id": "PRCY", "nodes": [ "https://polygon-rpc.com", From 9fc8d3111a29dfdb7b76200d32986c865a62f0c0 Mon Sep 17 00:00:00 2001 From: cipig Date: Sat, 1 Oct 2022 13:19:37 +0000 Subject: [PATCH 6/6] add coinpaprika_id for PGX --- assets/config/0.5.6-coins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/config/0.5.6-coins.json b/assets/config/0.5.6-coins.json index 5bbc379c62..9ab202cf20 100644 --- a/assets/config/0.5.6-coins.json +++ b/assets/config/0.5.6-coins.json @@ -5880,7 +5880,7 @@ "PGX-PLG20": { "coin": "PGX-PLG20", "name": "Pegaxy Stone", - "coinpaprika_id": "test-coin", + "coinpaprika_id": "pgx-pegaxy-stone", "coingecko_id": "pegaxy-stone", "nomics_id": "PGX", "nodes": [