Skip to content

Commit

Permalink
Merge pull request #2301 from KomodoPlatform/rm-bad-gas
Browse files Browse the repository at this point in the history
remove matic gas urls, make param optional
  • Loading branch information
smk762 committed Jun 21, 2023
2 parents 87a453f + a55e94f commit d08ab51
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
20 changes: 18 additions & 2 deletions src/core/atomicdex/api/mm2/rpc.enable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ namespace atomic_dex::mm2
}
case CoinType::Matic:
{
j["gas_station_url"] = cfg.is_testnet ? cfg.testnet_matic_gas_station_url : cfg.matic_gas_station_url;
j["gas_station_decimals"] = cfg.matic_gas_station_decimals;
if (cfg.is_testnet)
{
if (cfg.testnet_matic_gas_station_url.has_value())
{
j["gas_station_url"] = cfg.testnet_matic_gas_station_url.value();
}
}
else
{
if (cfg.matic_gas_station_url.has_value())
{
j["gas_station_url"] = cfg.matic_gas_station_url.value();
}
}
if (cfg.matic_gas_station_decimals.has_value())
{
j["gas_station_decimals"] = cfg.matic_gas_station_decimals.value();
}
}
default:
j["urls"] = cfg.urls;
Expand Down
8 changes: 4 additions & 4 deletions src/core/atomicdex/api/mm2/rpc.enable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace atomic_dex::mm2
bool is_testnet{false};
const std::string swap_contract_address;
std::optional<std::string> fallback_swap_contract_address{std::nullopt};
const std::size_t matic_gas_station_decimals{9};
std::optional<std::size_t> matic_gas_station_decimals{9};
std::string gas_station_url{"https://ethgasstation.info/json/ethgasAPI.json"};
std::string matic_gas_station_url{"https://gasstation-mainnet.matic.network/"};
std::string testnet_matic_gas_station_url{"https://gasstation-mumbai.matic.today/"};
std::string type; ///< QRC-20 ?
std::optional<std::string> matic_gas_station_url{std::nullopt};
std::optional<std::string> testnet_matic_gas_station_url{std::nullopt};
std::optional<std::string> type; ///< QRC-20 ?
bool with_tx_history{true};
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/atomicdex/config/coins.cfg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace atomic_dex
struct coin_config
{
static constexpr const char* erc_gas_stations = "https://ethgasstation.info/json/ethgasAPI.json";
static constexpr const char* matic_gas_stations = "https://gasstation-mainnet.matic.network/";
std::optional<std::string> matic_gas_stations{std::nullopt};
using electrum_servers = std::vector<electrum_server>;
using nodes = std::vector<node>;
using url_list = std::vector<std::string>;
Expand Down

0 comments on commit d08ab51

Please sign in to comment.