diff --git a/CHANGELOG.md b/CHANGELOG.md index 0908c57e5f..20b131c0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - [#3335](https://github.com/poanetwork/blockscout/pull/3335) - MarketCap calculation: check that ETS tables exist before inserting new data or lookup from the table ### Chore +- [#3405](https://github.com/poanetwork/blockscout/pull/3405) - N/A instead of 0 for market cap if it is not fetched - [#3404](https://github.com/poanetwork/blockscout/pull/3404) - DISABLE_KNOWN_TOKENS env var - [#3403](https://github.com/poanetwork/blockscout/pull/3403) - Refactor Coingecko interaction - [#3394](https://github.com/poanetwork/blockscout/pull/3394) - Actualize docker vars list diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex index 84601a7d66..8c692a6432 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex @@ -69,12 +69,15 @@ <%= if token_bridge_supply?() do %> <% token_bridge_market_cap = total_market_cap_from_token_bridge(@exchange_rate) %> <% omni_bridge_market_cap = total_market_cap_from_omni_bridge() %> + <% formatted_total_market_cap = if Decimal.cmp(total_market_cap, 0) == :gt, do: format_usd_value(total_market_cap), else: "N/A" %> + <% formatted_token_bridge_market_cap = if Decimal.cmp(token_bridge_market_cap, 0) == :gt, do: format_usd_value(token_bridge_market_cap), else: "N/A" %> + <% formatted_omni_bridge_market_cap = if Decimal.cmp(omni_bridge_market_cap, 0) == :gt, do: format_usd_value(omni_bridge_market_cap), else: "N/A" %> + title="
<%= formatted_total_market_cap %> is a sum of assets locked in TokenBridge and OmniBridge
<%= formatted_token_bridge_market_cap %> locked in Dai in TokenBridge
<%= formatted_omni_bridge_market_cap %> locked in different assets in OmniBridge
">
<% end %> diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index d16fa400c3..8f42b9a602 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -151,7 +151,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:121 +#: lib/block_scout_web/templates/chain/show.html.eex:124 msgid "Average block time" msgstr "" @@ -236,7 +236,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:176 +#: lib/block_scout_web/templates/chain/show.html.eex:179 #: lib/block_scout_web/templates/layout/_topnav.html.eex:34 #: lib/block_scout_web/templates/layout/_topnav.html.eex:38 msgid "Blocks" @@ -776,7 +776,7 @@ msgid "Success" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:91 +#: lib/block_scout_web/templates/chain/show.html.eex:94 #: lib/block_scout_web/templates/layout/app.html.eex:34 msgid "Tx/day" msgstr "" @@ -1065,7 +1065,7 @@ msgid "More internal transactions have come in" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:237 +#: lib/block_scout_web/templates/chain/show.html.eex:240 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:12 #: lib/block_scout_web/templates/transaction/index.html.eex:18 msgid "More transactions have come in" @@ -1309,7 +1309,7 @@ msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:48 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: lib/block_scout_web/templates/block_transaction/index.html.eex:23 -#: lib/block_scout_web/templates/chain/show.html.eex:180 +#: lib/block_scout_web/templates/chain/show.html.eex:183 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:21 #: lib/block_scout_web/templates/stakes/_table.html.eex:44 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 @@ -1324,7 +1324,7 @@ msgid "Something went wrong, click to reload." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:243 +#: lib/block_scout_web/templates/chain/show.html.eex:246 msgid "Something went wrong, click to retry." msgstr "" @@ -1453,7 +1453,7 @@ msgid "Total Supply" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:151 +#: lib/block_scout_web/templates/chain/show.html.eex:154 msgid "Total blocks" msgstr "" @@ -1593,12 +1593,12 @@ msgid "Version" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:175 +#: lib/block_scout_web/templates/chain/show.html.eex:178 msgid "View All Blocks" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:233 +#: lib/block_scout_web/templates/chain/show.html.eex:236 msgid "View All Transactions" msgstr "" @@ -1640,7 +1640,7 @@ msgid "WEI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:159 +#: lib/block_scout_web/templates/chain/show.html.eex:162 msgid "Wallet addresses" msgstr "" @@ -1780,7 +1780,7 @@ msgid "Module" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:130 +#: lib/block_scout_web/templates/chain/show.html.eex:133 msgid "Total transactions" msgstr "" @@ -1867,7 +1867,7 @@ msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:15 #: lib/block_scout_web/templates/block_transaction/index.html.eex:10 #: lib/block_scout_web/templates/block_transaction/index.html.eex:18 -#: lib/block_scout_web/templates/chain/show.html.eex:234 +#: lib/block_scout_web/templates/chain/show.html.eex:237 #: lib/block_scout_web/templates/layout/_topnav.html.eex:53 #: lib/block_scout_web/views/address_view.ex:349 msgid "Transactions" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index d16fa400c3..8f42b9a602 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -151,7 +151,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:121 +#: lib/block_scout_web/templates/chain/show.html.eex:124 msgid "Average block time" msgstr "" @@ -236,7 +236,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:176 +#: lib/block_scout_web/templates/chain/show.html.eex:179 #: lib/block_scout_web/templates/layout/_topnav.html.eex:34 #: lib/block_scout_web/templates/layout/_topnav.html.eex:38 msgid "Blocks" @@ -776,7 +776,7 @@ msgid "Success" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:91 +#: lib/block_scout_web/templates/chain/show.html.eex:94 #: lib/block_scout_web/templates/layout/app.html.eex:34 msgid "Tx/day" msgstr "" @@ -1065,7 +1065,7 @@ msgid "More internal transactions have come in" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:237 +#: lib/block_scout_web/templates/chain/show.html.eex:240 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:12 #: lib/block_scout_web/templates/transaction/index.html.eex:18 msgid "More transactions have come in" @@ -1309,7 +1309,7 @@ msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:48 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: lib/block_scout_web/templates/block_transaction/index.html.eex:23 -#: lib/block_scout_web/templates/chain/show.html.eex:180 +#: lib/block_scout_web/templates/chain/show.html.eex:183 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:21 #: lib/block_scout_web/templates/stakes/_table.html.eex:44 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 @@ -1324,7 +1324,7 @@ msgid "Something went wrong, click to reload." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:243 +#: lib/block_scout_web/templates/chain/show.html.eex:246 msgid "Something went wrong, click to retry." msgstr "" @@ -1453,7 +1453,7 @@ msgid "Total Supply" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:151 +#: lib/block_scout_web/templates/chain/show.html.eex:154 msgid "Total blocks" msgstr "" @@ -1593,12 +1593,12 @@ msgid "Version" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:175 +#: lib/block_scout_web/templates/chain/show.html.eex:178 msgid "View All Blocks" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:233 +#: lib/block_scout_web/templates/chain/show.html.eex:236 msgid "View All Transactions" msgstr "" @@ -1640,7 +1640,7 @@ msgid "WEI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:159 +#: lib/block_scout_web/templates/chain/show.html.eex:162 msgid "Wallet addresses" msgstr "" @@ -1780,7 +1780,7 @@ msgid "Module" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:130 +#: lib/block_scout_web/templates/chain/show.html.eex:133 msgid "Total transactions" msgstr "" @@ -1867,7 +1867,7 @@ msgstr "" #: lib/block_scout_web/templates/address_transaction/index.html.eex:15 #: lib/block_scout_web/templates/block_transaction/index.html.eex:10 #: lib/block_scout_web/templates/block_transaction/index.html.eex:18 -#: lib/block_scout_web/templates/chain/show.html.eex:234 +#: lib/block_scout_web/templates/chain/show.html.eex:237 #: lib/block_scout_web/templates/layout/_topnav.html.eex:53 #: lib/block_scout_web/views/address_view.ex:349 msgid "Transactions" diff --git a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex b/apps/explorer/lib/explorer/chain/supply/token_bridge.ex index 59e8b43168..b459e0729e 100644 --- a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex +++ b/apps/explorer/lib/explorer/chain/supply/token_bridge.ex @@ -66,7 +66,15 @@ defmodule Explorer.Chain.Supply.TokenBridge do end end - def market_cap(_), do: Decimal.new(0) + def market_cap(_) do + total_market_cap_from_omni = total_market_cap_from_omni_bridge() + + if total_market_cap_from_omni do + total_market_cap_from_omni + else + Decimal.new(0) + end + end def token_bridge_market_cap(%{usd_value: usd_value}) when not is_nil(usd_value) do total_coins_from_token_b = total_coins_from_token_bridge()