From 6898a3d06fec2ef103763bf6a44e9f9a41b9679c Mon Sep 17 00:00:00 2001 From: milerius Date: Wed, 24 Mar 2021 12:04:43 +0100 Subject: [PATCH] feat(proxy): use smartcontract in the proxy --- src/core/atomicdex/config/raw.mm2.coins.cfg.hpp | 3 +++ src/core/atomicdex/services/mm2/mm2.service.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp b/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp index d67c708d76..57ce6fa18f 100644 --- a/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp +++ b/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp @@ -110,6 +110,7 @@ namespace atomic_dex std::optional consensus_branch_id{std::nullopt}; std::optional avg_blocktime{std::nullopt}; std::optional dust{std::nullopt}; + nlohmann::json protocol; }; using coins = std::vector; @@ -177,6 +178,7 @@ namespace atomic_dex x.consensus_branch_id = atomic_dex::get_optional(j, "consensus_branch_id"); x.dust = atomic_dex::get_optional(j, "dust"); x.avg_blocktime = atomic_dex::get_optional(j, "avg_blocktime"); + x.protocol = j.at("protocol"); } inline void @@ -221,6 +223,7 @@ namespace atomic_dex to_json_functor("consensus_branch_id", x.consensus_branch_id); to_json_functor("dust", x.dust); to_json_functor("avg_blocktime", x.avg_blocktime); + j["protocol"] = x.protocol; } inline t_mm2_raw_coins_registry diff --git a/src/core/atomicdex/services/mm2/mm2.service.cpp b/src/core/atomicdex/services/mm2/mm2.service.cpp index 49299dd8a8..395b625c73 100644 --- a/src/core/atomicdex/services/mm2/mm2.service.cpp +++ b/src/core/atomicdex/services/mm2/mm2.service.cpp @@ -1059,7 +1059,8 @@ namespace atomic_dex } else { - out = "/api/v1/erc_tx_history/" + ticker + "/" + address; + const std::string contract_address = get_raw_mm2_ticker_cfg(ticker).at("protocol").at("protocol_data").at("contract_address"); + out = "/api/v1/erc_tx_history/" + contract_address + "/" + address; } break; case CoinTypeGadget::BEP20: @@ -1069,7 +1070,8 @@ namespace atomic_dex } else { - out = "/api/v1/bep_tx_history/" + ticker + "/" + address; + const std::string contract_address = get_raw_mm2_ticker_cfg(ticker).at("protocol").at("protocol_data").at("contract_address"); + out = "/api/v1/bep_tx_history/" + contract_address + "/" + address; } default: break;