Merge pull request #3405 from poanetwork/vb-market-cap-na-instead-0

N/A instead of 0 for market cap if it is not fetched
pull/3406/head
Victor Baranov 4 years ago committed by GitHub
commit b21659f066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 5
      apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex
  3. 24
      apps/block_scout_web/priv/gettext/default.pot
  4. 24
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  5. 10
      apps/explorer/lib/explorer/chain/supply/token_bridge.ex

@ -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 - [#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 ### 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 - [#3404](https://github.com/poanetwork/blockscout/pull/3404) - DISABLE_KNOWN_TOKENS env var
- [#3403](https://github.com/poanetwork/blockscout/pull/3403) - Refactor Coingecko interaction - [#3403](https://github.com/poanetwork/blockscout/pull/3403) - Refactor Coingecko interaction
- [#3394](https://github.com/poanetwork/blockscout/pull/3394) - Actualize docker vars list - [#3394](https://github.com/poanetwork/blockscout/pull/3394) - Actualize docker vars list

@ -69,12 +69,15 @@
<%= if token_bridge_supply?() do %> <%= if token_bridge_supply?() do %>
<% token_bridge_market_cap = total_market_cap_from_token_bridge(@exchange_rate) %> <% token_bridge_market_cap = total_market_cap_from_token_bridge(@exchange_rate) %>
<% omni_bridge_market_cap = total_market_cap_from_omni_bridge() %> <% 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" %>
<span <span
data-toggle="tooltip" data-toggle="tooltip"
data-placement="top" data-placement="top"
data-html="true" data-html="true"
data-template="<div class='tooltip tooltip-inversed-color tooltip-market-cap' role='tooltip'><div class='arrow'></div><div class='tooltip-inner'></div></div>" data-template="<div class='tooltip tooltip-inversed-color tooltip-market-cap' role='tooltip'><div class='arrow'></div><div class='tooltip-inner'></div></div>"
title="<div class='custom-tooltip-header'><b><%= format_usd_value(total_market_cap) %></b> is a sum of assets locked in TokenBridge and OmniBridge</div><div class='custom-tooltip-description left'><b><%= format_usd_value(token_bridge_market_cap) %></b> locked in Dai in TokenBridge <br/><b><%= format_usd_value(omni_bridge_market_cap) %></b> locked in different assets in OmniBridge</div>"> title="<div class='custom-tooltip-header'><b><%= formatted_total_market_cap %></b> is a sum of assets locked in TokenBridge and OmniBridge</div><div class='custom-tooltip-description left'><b><%= formatted_token_bridge_market_cap %></b> locked in Dai in TokenBridge <br/><b><%= formatted_omni_bridge_market_cap %></b> locked in different assets in OmniBridge</div>">
<i style="color: #ffffff;" class="fa fa-info-circle ml-1" data-test="token-bridge-supply"></i> <i style="color: #ffffff;" class="fa fa-info-circle ml-1" data-test="token-bridge-supply"></i>
</span> </span>
<% end %> <% end %>

@ -151,7 +151,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Average block time"
msgstr "" msgstr ""
@ -236,7 +236,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr "" msgstr ""
#, elixir-format #, 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:34
#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 #: lib/block_scout_web/templates/layout/_topnav.html.eex:38
msgid "Blocks" msgid "Blocks"
@ -776,7 +776,7 @@ msgid "Success"
msgstr "" msgstr ""
#, elixir-format #, 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 #: lib/block_scout_web/templates/layout/app.html.eex:34
msgid "Tx/day" msgid "Tx/day"
msgstr "" msgstr ""
@ -1065,7 +1065,7 @@ msgid "More internal transactions have come in"
msgstr "" msgstr ""
#, elixir-format #, 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/pending_transaction/index.html.eex:12
#: lib/block_scout_web/templates/transaction/index.html.eex:18 #: lib/block_scout_web/templates/transaction/index.html.eex:18
msgid "More transactions have come in" 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_transaction/index.html.eex:48
#: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: 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/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/pending_transaction/index.html.eex:21
#: lib/block_scout_web/templates/stakes/_table.html.eex:44 #: lib/block_scout_web/templates/stakes/_table.html.eex:44
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22
@ -1324,7 +1324,7 @@ msgid "Something went wrong, click to reload."
msgstr "" msgstr ""
#, elixir-format #, 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." msgid "Something went wrong, click to retry."
msgstr "" msgstr ""
@ -1453,7 +1453,7 @@ msgid "Total Supply"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Total blocks"
msgstr "" msgstr ""
@ -1593,12 +1593,12 @@ msgid "Version"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "View All Blocks"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "View All Transactions"
msgstr "" msgstr ""
@ -1640,7 +1640,7 @@ msgid "WEI"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Wallet addresses"
msgstr "" msgstr ""
@ -1780,7 +1780,7 @@ msgid "Module"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Total transactions"
msgstr "" msgstr ""
@ -1867,7 +1867,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15 #: 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:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18 #: 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/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/views/address_view.ex:349 #: lib/block_scout_web/views/address_view.ex:349
msgid "Transactions" msgid "Transactions"

@ -151,7 +151,7 @@ msgid "Anything not in this list is not supported. Click on the method to be tak
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Average block time"
msgstr "" msgstr ""
@ -236,7 +236,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr "" msgstr ""
#, elixir-format #, 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:34
#: lib/block_scout_web/templates/layout/_topnav.html.eex:38 #: lib/block_scout_web/templates/layout/_topnav.html.eex:38
msgid "Blocks" msgid "Blocks"
@ -776,7 +776,7 @@ msgid "Success"
msgstr "" msgstr ""
#, elixir-format #, 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 #: lib/block_scout_web/templates/layout/app.html.eex:34
msgid "Tx/day" msgid "Tx/day"
msgstr "" msgstr ""
@ -1065,7 +1065,7 @@ msgid "More internal transactions have come in"
msgstr "" msgstr ""
#, elixir-format #, 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/pending_transaction/index.html.eex:12
#: lib/block_scout_web/templates/transaction/index.html.eex:18 #: lib/block_scout_web/templates/transaction/index.html.eex:18
msgid "More transactions have come in" 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_transaction/index.html.eex:48
#: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: 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/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/pending_transaction/index.html.eex:21
#: lib/block_scout_web/templates/stakes/_table.html.eex:44 #: lib/block_scout_web/templates/stakes/_table.html.eex:44
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22
@ -1324,7 +1324,7 @@ msgid "Something went wrong, click to reload."
msgstr "" msgstr ""
#, elixir-format #, 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." msgid "Something went wrong, click to retry."
msgstr "" msgstr ""
@ -1453,7 +1453,7 @@ msgid "Total Supply"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Total blocks"
msgstr "" msgstr ""
@ -1593,12 +1593,12 @@ msgid "Version"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "View All Blocks"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "View All Transactions"
msgstr "" msgstr ""
@ -1640,7 +1640,7 @@ msgid "WEI"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Wallet addresses"
msgstr "" msgstr ""
@ -1780,7 +1780,7 @@ msgid "Module"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Total transactions"
msgstr "" msgstr ""
@ -1867,7 +1867,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15 #: 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:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18 #: 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/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/views/address_view.ex:349 #: lib/block_scout_web/views/address_view.ex:349
msgid "Transactions" msgid "Transactions"

@ -66,7 +66,15 @@ defmodule Explorer.Chain.Supply.TokenBridge do
end end
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 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() total_coins_from_token_b = total_coins_from_token_bridge()

Loading…
Cancel
Save