Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menubar currency change #2454

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/atomicdex/models/qt.portfolio.model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ namespace atomic_dex
bool
portfolio_model::update_activation_status()
{
// This feels a bit heavy handed. There should be a better way to do this.
// Function may be unused.
const auto& mm2_system = this->m_system_manager.get_system<mm2_service>();
const auto coins = this->m_system_manager.get_system<portfolio_page>().get_global_cfg()->get_enabled_coins();

Expand Down
2 changes: 1 addition & 1 deletion src/core/atomicdex/pages/qt.wallet.page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ namespace atomic_dex

nlohmann::json json_data = mm2::template_request("withdraw", true);
mm2::to_json(json_data, withdraw_req);
SPDLOG_DEBUG("final json: {}", json_data.dump(4));

batch.push_back(json_data);

std::string amount_std = amount.toStdString();
Expand Down
23 changes: 13 additions & 10 deletions src/core/atomicdex/services/price/global.provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ namespace atomic_dex
global_price_service::refresh_other_coins_rates(
const std::string& quote_id, const std::string& ticker, bool with_update_providers, std::atomic_uint16_t nb_try)
{
// nb_try += 1;
// TODO: Paprika price conversion removed, needs to be replaced
nb_try = 10;
SPDLOG_INFO("refresh_other_coins_rates - try {}", nb_try.load());
if (nb_try == 10)
t_float_50 price = safe_float(get_rate_conversion("USD", ticker, true));
if (price <= 0)
{
SPDLOG_WARN("refresh other coins rates max try reached, skipping");
return;
SPDLOG_ERROR("Price is 0 for ticker: {}", ticker);
this->m_coin_rate_providers[ticker] = "0.00";
}
else
{
t_float_50 rate = 1 / price;
this->m_coin_rate_providers[ticker] = rate.str();
}

}

global_price_service::global_price_service(entt::registry& registry, ag::ecs::system_manager& system_manager, atomic_dex::cfg& cfg) :
Expand Down Expand Up @@ -140,14 +143,14 @@ namespace atomic_dex
{
if (fiat == utils::retrieve_main_ticker(ticker_in))
{
return "1";
return "1.00";
}
std::string ticker = utils::retrieve_main_ticker(ticker_in);
try
{
//! FIXME: fix zatJum crash report, frontend QML try to retrieve price before program is even launched
if (ticker.empty())
return "0";
return "0.00";
auto& provider = m_system_manager.get_system<komodo_prices_provider>();
std::string current_price = provider.get_rate_conversion(ticker);

Expand Down Expand Up @@ -182,7 +185,7 @@ namespace atomic_dex
{
if (current_price_f < 1.0)
{
default_precision = 5;
default_precision = 8;
}
}
//! Trick: If there conversion in a fixed representation is 0.00 then use a default precision to 2 without fixed ios flags
Expand Down
Loading