Skip to content

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
cipig committed Mar 22, 2024
1 parent 5866314 commit 9e90bb6
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/core/atomicdex/services/price/global.provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,6 @@
#include "atomicdex/pages/qt.settings.page.hpp"
#include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp"

namespace
{
web::http::client::http_client_config g_openrates_cfg{[]()
{
web::http::client::http_client_config cfg;
cfg.set_validate_certificates(false);
cfg.set_timeout(std::chrono::seconds(5));
return cfg;
}()};
t_http_client_ptr g_openrates_client = std::make_unique<web::http::client::http_client>(FROM_STD_STR("https://defi-stats.komodo.earth"), g_openrates_cfg);
pplx::cancellation_token_source g_token_source;

pplx::task<web::http::http_response>
async_fetch_fiat_rates()
{
web::http::http_request req;
req.set_method(web::http::methods::GET);
req.set_request_uri(FROM_STD_STR("api/v3/rates/fixer_io"));
//SPDLOG_INFO("req: {}", TO_STD_STR(req.to_string()));
return g_openrates_client->request(req, g_token_source.get_token());
}

nlohmann::json
process_fetch_fiat_answer(web::http::http_response resp)
{
nlohmann::json answer;
if (resp.status_code() == 200)
{
answer = nlohmann::json::parse(TO_STD_STR(resp.extract_string(true).get()));
return answer;
}

SPDLOG_WARN("unable to fetch last open rates");
return answer;
}
} // namespace

namespace
{
std::string
Expand Down Expand Up @@ -92,7 +55,6 @@ namespace
}
} // namespace


namespace atomic_dex
{
global_price_service::global_price_service(entt::registry& registry, ag::ecs::system_manager& system_manager, atomic_dex::cfg& cfg) :
Expand Down

0 comments on commit 9e90bb6

Please sign in to comment.