From da2c79de7c24962b60791323147279f9f4daf69d Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Apr 2019 13:51:37 +0300 Subject: [PATCH 1/3] make coinmarketcap's number of pages configurable --- apps/explorer/config/config.exs | 3 +++ .../lib/explorer/exchange_rates/source/coin_market_cap.ex | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index dea1be2b46..cc5898c351 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -13,6 +13,9 @@ config :explorer, config :explorer, Explorer.Counters.AverageBlockTime, enabled: true +config :explorer, Explorer.ExchangeRates.Source.CoinMarketCap, + pages: String.to_integer(System.get_env("COINMARKETCAP_PAGES") || "10") + balances_update_interval = if System.get_env("ADDRESS_WITH_BALANCES_UPDATE_INTERVAL") do case Integer.parse(System.get_env("ADDRESS_WITH_BALANCES_UPDATE_INTERVAL")) do diff --git a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex b/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex index 4030eed06f..b432233cf6 100644 --- a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex +++ b/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex @@ -38,7 +38,7 @@ defmodule Explorer.ExchangeRates.Source.CoinMarketCap do "#{base_url()}/v1/ticker/?start=#{page - 1}00" end - def max_page_number, do: 10 + def max_page_number, do: config(:pages) || 10 defp base_url do config(:base_url) || "https://api.coinmarketcap.com" From 8e9529f2b6a9898050a044b221808292c6af98f0 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Apr 2019 13:54:13 +0300 Subject: [PATCH 2/3] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a2380828..aab08669f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - [#1790](https://github.com/poanetwork/blockscout/pull/1790) - fix constructor arguments verification - [#1793](https://github.com/poanetwork/blockscout/pull/1793) - fix top nav autocomplete - [#1795](https://github.com/poanetwork/blockscout/pull/1795) - fix line numbers for decompiled contracts + - [#1802](https://github.com/poanetwork/blockscout/pull/1802) - make coinmarketcap's number of pages configurable ### Chore From 480f1b6e5a1db2b1ee3e496e445b3fc6e22cb597 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 22 Apr 2019 14:53:01 +0300 Subject: [PATCH 3/3] Update coin_market_cap.ex --- .../lib/explorer/exchange_rates/source/coin_market_cap.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex b/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex index b432233cf6..03d957e305 100644 --- a/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex +++ b/apps/explorer/lib/explorer/exchange_rates/source/coin_market_cap.ex @@ -38,7 +38,7 @@ defmodule Explorer.ExchangeRates.Source.CoinMarketCap do "#{base_url()}/v1/ticker/?start=#{page - 1}00" end - def max_page_number, do: config(:pages) || 10 + def max_page_number, do: config(:pages) defp base_url do config(:base_url) || "https://api.coinmarketcap.com"