Skip to content

Commit

Permalink
handle segwit volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Nov 5, 2023
1 parent 5f00a00 commit 4b70e95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/atomicdex/pages/qt.trading.page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,8 +1374,8 @@ namespace atomic_dex
{
const auto& defi_stats_service = m_system_manager.get_system<global_defi_stats_service>();
const auto* market_selector = get_market_pairs_mdl();
const auto& base = market_selector->get_left_selected_coin().toStdString();
const auto& rel = market_selector->get_right_selected_coin().toStdString();
const auto& base = utils::retrieve_main_ticker(market_selector->get_left_selected_coin().toStdString(), true);
const auto& rel = utils::retrieve_main_ticker(market_selector->get_right_selected_coin().toStdString(), true);
QString vol = QString::fromStdString(defi_stats_service.get_volume_24h(base, rel));

if (vol != m_pair_volume_24hr)
Expand Down
13 changes: 11 additions & 2 deletions src/core/atomicdex/utilities/global.utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,18 @@ namespace atomic_dex::utils
}

std::string
retrieve_main_ticker(const std::string& ticker)
retrieve_main_ticker(const std::string& ticker, const bool segwit_only)
{
if (const auto pos = ticker.find('-'); pos != std::string::npos)
auto pos = ticker.find('-');
if (segwit_only)
{
if (ticker.find('-segwit') != std::string::npos)
{
return ticker.substr(0, pos);
}
return ticker;
}
if (pos != std::string::npos)
{
return ticker.substr(0, pos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/atomicdex/utilities/global.utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace atomic_dex::utils
ENTT_API std::filesystem::path get_themes_path();
ENTT_API std::filesystem::path get_logo_path();

std::string retrieve_main_ticker(const std::string& ticker);
std::string retrieve_main_ticker(const std::string& ticker, const bool segwit_only = false);

void to_eth_checksum(std::string& address);

Expand Down

0 comments on commit 4b70e95

Please sign in to comment.