From 22df4dd9d32a7b3484f7a6b71e3631fbf1c9f052 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 1 Apr 2024 23:57:24 +0800 Subject: [PATCH 1/4] allow testcoins through filter in simple dex view --- src/core/atomicdex/models/qt.orderbook.proxy.model.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp index 28b47ab518..f41ae7dfd8 100644 --- a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp +++ b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp @@ -167,6 +167,10 @@ namespace atomic_dex { return false; } + if (coin_info.is_testnet) + { + break; + } if (is_cex_id_available && (rates > 100 || fiat_price <= 0 || ((safe_float(volume) < limit) && coin_info.coin_type != CoinType::SmartChain))) { return false; From cc7ba3e74f4b8e0cd3eee408b0e4a56934a590aa Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 2 Apr 2024 17:25:49 +0800 Subject: [PATCH 2/4] isolate testcoins in bestorders --- .../Exchange/Trade/BestOrder/ListDelegate.qml | 7 ++-- src/core/atomicdex/config/coins.cfg.cpp | 32 +++++++++---------- .../models/qt.orderbook.proxy.model.cpp | 25 +++++++++------ .../atomicdex/services/mm2/mm2.service.cpp | 2 +- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml index e5893f2e31..bcf1fa9c30 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml @@ -14,8 +14,7 @@ import AtomicDEX.MarketMode 1.0 Item { id: _control - - property bool coinEnable: API.app.portfolio_pg.global_cfg_mdl.get_coin_info(coin).is_enabled + property bool _isCoinEnabled: API.app.portfolio_pg.global_cfg_mdl.get_coin_info(coin).is_enabled property bool isAsk AnimatedRectangle @@ -46,7 +45,7 @@ Item height: 24 anchors.verticalCenter: parent.verticalCenter source: General.coinIcon(coin) - opacity: !_control.coinEnable? .1 : 1 + opacity: !_control._isCoinEnabled? .1 : 1 } Dex.Text @@ -137,7 +136,7 @@ Item { if (API.app.enable_coins([coin]) === true) { - _control.coinEnable = true; + _control._isCoinEnabled = true; _tooltip.close(); } else { diff --git a/src/core/atomicdex/config/coins.cfg.cpp b/src/core/atomicdex/config/coins.cfg.cpp index 1f846b5376..18aa67a1d5 100644 --- a/src/core/atomicdex/config/coins.cfg.cpp +++ b/src/core/atomicdex/config/coins.cfg.cpp @@ -286,21 +286,21 @@ namespace atomic_dex { case CoinType::QRC20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "tQTUM" : "QTUM"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "tQTUM" : "QTUM"; break; case CoinType::ERC20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "ETHR" : "ETH"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ETHR" : "ETH"; cfg.is_erc_family = true; break; case CoinType::BEP20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "BNBT" : "BNB"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "BNBT" : "BNB"; cfg.is_erc_family = true; break; case CoinType::PLG20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "MATICTEST" : "MATIC"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "MATICTEST" : "MATIC"; cfg.is_erc_family = true; break; case CoinType::Optimism: @@ -320,62 +320,62 @@ namespace atomic_dex break; case CoinType::AVX20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "AVAXT" : "AVAX"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "AVAXT" : "AVAX"; cfg.is_erc_family = true; break; case CoinType::FTM20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "FTMT" : "FTM"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "FTMT" : "FTM"; cfg.is_erc_family = true; break; case CoinType::HRC20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "ONET" : "ONE"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ONET" : "ONE"; cfg.is_erc_family = true; break; case CoinType::Ubiq: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "UBQT" : "UBQ"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "UBQT" : "UBQ"; cfg.is_erc_family = true; break; case CoinType::KRC20: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "KCST" : "KCS"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "KCST" : "KCS"; cfg.is_erc_family = true; break; case CoinType::Moonriver: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "MOVRT" : "MOVR"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "MOVRT" : "MOVR"; cfg.is_erc_family = true; break; case CoinType::Moonbeam: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "GLMRT" : "GLMR"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "GLMRT" : "GLMR"; cfg.is_erc_family = true; break; case CoinType::HecoChain: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "HTT" : "HT"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "HTT" : "HT"; cfg.is_erc_family = true; break; case CoinType::SmartBCH: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "SBCHT" : "SBCH"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "SBCHT" : "SBCH"; cfg.is_erc_family = true; break; case CoinType::EthereumClassic: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "ETCT" : "ETC"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ETCT" : "ETC"; cfg.is_erc_family = true; break; case CoinType::RSK: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "RBTCT" : "RBTC"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "RBTCT" : "RBTC"; cfg.is_erc_family = true; break; case CoinType::SLP: cfg.has_parent_fees_ticker = true; - cfg.fees_ticker = cfg.is_testnet.value() ? "tBCH" : "BCH"; + cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "tBCH" : "BCH"; break; case CoinType::TENDERMINT: cfg.has_parent_fees_ticker = true; diff --git a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp index f41ae7dfd8..6117bf3eb9 100644 --- a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp +++ b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp @@ -155,27 +155,34 @@ namespace atomic_dex case orderbook_model::kind::bids: break; case orderbook_model::kind::best_orders: - t_float_50 rates = safe_float(this->sourceModel()->data(idx, orderbook_model::CEXRatesRole).toString().toStdString()); - t_float_50 fiat_price = safe_float(this->sourceModel()->data(idx, orderbook_model::PriceFiatRole).toString().toStdString()); - std::string ticker = this->sourceModel()->data(idx, orderbook_model::CoinRole).toString().toStdString(); - const auto& provider = this->m_system_mgr.get_system(); - const auto coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(ticker); t_float_50 limit("10000"); + t_float_50 rates = safe_float(this->sourceModel()->data(idx, orderbook_model::CEXRatesRole).toString().toStdString()); + t_float_50 fiat_price = safe_float(this->sourceModel()->data(idx, orderbook_model::PriceFiatRole).toString().toStdString()); bool is_cex_id_available = this->sourceModel()->data(idx, orderbook_model::HaveCEXIDRole).toBool(); - const auto volume = provider.get_total_volume(utils::retrieve_main_ticker(ticker)); + const auto& provider = this->m_system_mgr.get_system(); + std::string ticker = this->sourceModel()->data(idx, orderbook_model::CoinRole).toString().toStdString(); + const auto coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(ticker); + const auto volume = provider.get_total_volume(utils::retrieve_main_ticker(ticker)); + std::string left_ticker = this->m_system_mgr.get_system().get_market_pairs_mdl()->get_left_selected_coin().toStdString(); + const auto left_coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(left_ticker); + if (coin_info.ticker.empty() || coin_info.wallet_only) //< this means it's not present in our cfg - skipping { return false; } - if (coin_info.is_testnet) + if (left_coin_info.is_testnet.value_or(false)) { - break; + if (coin_info.is_testnet.value_or(false)) + { + return true; + } + return false; } if (is_cex_id_available && (rates > 100 || fiat_price <= 0 || ((safe_float(volume) < limit) && coin_info.coin_type != CoinType::SmartChain))) { return false; } - break; + return true; } } diff --git a/src/core/atomicdex/services/mm2/mm2.service.cpp b/src/core/atomicdex/services/mm2/mm2.service.cpp index cccedaed77..aac8b30293 100644 --- a/src/core/atomicdex/services/mm2/mm2.service.cpp +++ b/src/core/atomicdex/services/mm2/mm2.service.cpp @@ -3019,7 +3019,7 @@ namespace atomic_dex const coin_config_t cfg = this->get_coin_info(ticker); if (cfg.coin_type == CoinType::QRC20) { - if (cfg.is_testnet.value()) + if (cfg.is_testnet.value_or(false)) { SPDLOG_INFO("{} is from testnet picking tQTUM electrum", ticker); servers = std::move(get_coin_info("tQTUM").electrum_urls.value()); From 624b9c7d2c3706b9cad8c9b99ccfd59a26b2abb3 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 5 Apr 2024 15:45:44 +0800 Subject: [PATCH 3/4] rm gitlab ci --- .gitlab-ci.yml | 112 ------------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1c25541055..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,112 +0,0 @@ -image: smk762/qt-ci:latest - -stages: - - build - - upload_linux_zip - - upload_linux_tar - - upload_linux_appimage - - test - -variables: - GIT_SUBMODULE_STRATEGY: recursive - DOCKER_DRIVER: overlay2 - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - VCPKG_DEFAULT_BINARY_CACHE: "$CI_PROJECT_DIR/.cache/vcpkg" - QT_VERSION: "5.15.2" - CMAKE_VERSION: "3.20.5" - -cache: - - key: $CI_COMMIT_REF_SLUG - paths: - - komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip - - komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst - - komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage - - key: $CI_PROJECT_NAME - paths: - - "$CI_PROJECT_DIR/.cache/vcpkg" - - -linux:build: - stage: build - before_script: - - cd $CI_PROJECT_DIR - - mkdir -p .cache/pip - - mkdir -p .cache/vcpkg - - script: - # Job Variables - - echo $CI_COMMIT_REF_SLUG - - echo $CI_COMMIT_AUTHOR - - echo $CI_COMMIT_BRANCH - - echo $CI_COMMIT_SHA - - echo $CI_COMMIT_SHORT_SHA - - echo $CI_PROJECT_PATH - - echo $CI_PROJECT_NAME - - echo $QT_VERSION - - echo $CMAKE_VERSION - - # Job Path/Env variables - - export DEBIAN_FRONTEND=noninteractive - - export QT_INSTALL_CMAKE_PATH=/opt/Qt/$QT_VERSION/gcc_64/lib/cmake - - export QT_ROOT=/opt/Qt/$QT_VERSION - - export Qt5_DIR=/opt/Qt/$QT_VERSION/gcc_64/lib/cmake/Qt5 - - export PATH=/opt/Qt/$QT_VERSION/gcc_64/bin:$PATH - - export PATH=${PATH}:/cmake-$CMAKE_VERSION-linux-x86_64/bin; - - export APPIMAGE_EXTRACT_AND_RUN=1 - - # Update tar - - export FORCE_UNSAFE_CONFIGURE=1 - - wget https://ftp.wayne.edu/gnu/tar/tar-1.34.tar.gz && tar -xvf tar-1.34.tar.gz - - cd tar-1.34 && ./configure && make && make install - - cp src/tar $(which tar) - - # Bootstrap Vcpkg - - cd $CI_PROJECT_DIR; ./ci_tools_atomic_dex/vcpkg-repo/bootstrap-vcpkg.sh - - # NINJA - - cd $CI_PROJECT_DIR - - rm -rf build_ninja || echo "no build_ninja folder to rm" - - mkdir build_ninja && cd $_ - - cmake -DCMAKE_BUILD_TYPE=Release -GNinja ../ - - ninja install - - ninja komodo-wallet - - cd $CI_PROJECT_DIR - - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip . - - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst . - - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage . - -AtomicDex-linux-zip: - stage: upload_linux_zip - allow_failure: true - script: - - echo "Uploading AppImage..." - artifacts: - name: "AtomicDex-linux-${CI_COMMIT_SHA::9}.zip" - paths: - - $CI_PROJECT_DIR/komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip - when: always - expire_in: 3 days - -AtomicDex-linux-AppImage: - stage: upload_linux_appimage - allow_failure: true - script: - - echo "Uploading AppImage..." - artifacts: - name: "AtomicDex-linux-${CI_COMMIT_SHA::9}-AppImage" - paths: - - $CI_PROJECT_DIR/komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage - when: always - expire_in: 3 days - -AtomicDex-linux-tar: - stage: upload_linux_tar - allow_failure: true - script: - - echo "Uploading tar..." - artifacts: - name: "AtomicDex-linux-${CI_COMMIT_SHA::9}.tar.zst" - paths: - - $CI_PROJECT_DIR/komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst - when: always - expire_in: 3 days From d2fe9440c8370f158bf21f13b169c6d9bd53d813 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 5 Apr 2024 15:48:09 +0800 Subject: [PATCH 4/4] tweak ci workflows --- .github/workflows/atomicdex-desktop-ci.yml | 1 + .github/workflows/sync_mirror.yml | 26 ---------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 .github/workflows/sync_mirror.yml diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 8cdaa94d95..5891f093e6 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -8,6 +8,7 @@ on: - master schedule: - cron: '0 0 * * 1' + workflow_dispatch: env: DEX_API: "mm2_kmd" diff --git a/.github/workflows/sync_mirror.yml b/.github/workflows/sync_mirror.yml deleted file mode 100644 index 57010e03dd..0000000000 --- a/.github/workflows/sync_mirror.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: GitlabSync - -on: - push: - branches: - - 'none' - pull_request: - branches: - - none - delete: - branches: - - '*' - -jobs: - sync: - runs-on: ubuntu-latest - name: Git Repo Sync - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: wangchucheng/git-repo-sync@v0.1.0 - with: - target-url: ${{ secrets.GITLAB_URL }} - target-username: ${{ secrets.GITLAB_USERNAME }} - target-token: ${{ secrets.GITLAB_TOKEN }}