Remove coin name from localization files, define it from COIN_NAME env var, remove COIN env var from build args, COIN -> EXCHANGE_RATES_COIN (add backward compatibility)

pull/6183/head
Viktor Baranov 2 years ago
parent e3eae9e38a
commit b660496a10
  1. 1
      CHANGELOG.md
  2. 3
      apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex
  3. 2
      apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex
  4. 2
      apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex
  5. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex
  6. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex
  7. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex
  8. 2
      apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex
  9. 2
      apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex
  10. 2
      apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex
  11. 2
      apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex
  12. 2
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  13. 2
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  14. 4
      apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
  15. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex
  16. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
  17. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  18. 3
      apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex
  19. 6
      apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex
  20. 25
      apps/block_scout_web/priv/gettext/default.pot
  21. 25
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  22. 4
      apps/block_scout_web/test/block_scout_web/controllers/account/api/v1/user_controller_test.exs
  23. 2
      apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs
  24. 8
      apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs
  25. 2
      apps/block_scout_web/test/block_scout_web/views/block_view_test.exs
  26. 4
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs
  27. 9
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex
  28. 2
      apps/explorer/lib/explorer.ex
  29. 5
      apps/explorer/lib/explorer/account/notifier/summary.ex
  30. 4
      apps/explorer/test/explorer/account/notify/summary_test.exs
  31. 6
      config/runtime.exs
  32. 1
      docker-compose/docker-compose-no-rust-verification.yml
  33. 1
      docker-compose/docker-compose.yml
  34. 3
      docker-compose/envs/common-blockscout.env
  35. 9
      docker/Dockerfile
  36. 5
      docker/Makefile

@ -20,6 +20,7 @@
### Chore ### Chore
- [#6183](https://github.com/blockscout/blockscout/pull/6183) - Transparent coin name definition
- [#6155](https://github.com/blockscout/blockscout/pull/6155) - Refactor Ethereum JSON RPC variants - [#6155](https://github.com/blockscout/blockscout/pull/6155) - Refactor Ethereum JSON RPC variants
- [#6125](https://github.com/blockscout/blockscout/pull/6125) - Rename obsolete "parity" EthereumJSONRPC.Variant to "nethermind" - [#6125](https://github.com/blockscout/blockscout/pull/6125) - Rename obsolete "parity" EthereumJSONRPC.Variant to "nethermind"
- [#6124](https://github.com/blockscout/blockscout/pull/6124) - Docker compose: add config for Erigon - [#6124](https://github.com/blockscout/blockscout/pull/6124) - Docker compose: add config for Erigon

@ -3,6 +3,7 @@ defmodule BlockScoutWeb.API.RPC.StatsController do
use Explorer.Schema use Explorer.Schema
alias Explorer
alias Explorer.{Chain, Etherscan, ExchangeRates} alias Explorer.{Chain, Etherscan, ExchangeRates}
alias Explorer.Chain.Cache.{AddressSum, AddressSumMinusBurnt} alias Explorer.Chain.Cache.{AddressSum, AddressSumMinusBurnt}
alias Explorer.Chain.Wei alias Explorer.Chain.Wei
@ -60,7 +61,7 @@ defmodule BlockScoutWeb.API.RPC.StatsController do
end end
def coinprice(conn, _params) do def coinprice(conn, _params) do
symbol = Application.get_env(:explorer, :coin) symbol = Explorer.coin()
rates = ExchangeRates.lookup(symbol) rates = ExchangeRates.lookup(symbol)
render(conn, "coinprice.json", rates: rates) render(conn, "coinprice.json", rates: rates)

@ -24,7 +24,7 @@
<p style="font-size: 14px;"><%= gettext("Please select what types of notifications you will receive:") %></p> <p style="font-size: 14px;"><%= gettext("Please select what types of notifications you will receive:") %></p>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<h3><%= gettext("Ether") %></h3> <h3><%= Explorer.coin_name() %></h3>
<div class="form-input"> <div class="form-input">
<%= checkbox f, :watch_coin_input, class: "form-checkbox" %> <%= checkbox f, :watch_coin_input, class: "form-checkbox" %>
<%= label f, :watch_coin_input, gettext("Incoming"), class: "label-checkbox" %> <%= label f, :watch_coin_input, gettext("Incoming"), class: "label-checkbox" %>

@ -18,7 +18,7 @@
data-placement="top" data-placement="top"
data-toggle="tooltip" data-toggle="tooltip"
data-html="true" data-html="true"
title='<%= "@ " <> to_string(@exchange_rate.usd_value) <> "/" <> gettext("Ether") %>' title='<%= "@ " <> to_string(@exchange_rate.usd_value) <> "/" <> Explorer.coin_name() %>'
> >
</span>) </span>)
</span> </span>

@ -8,7 +8,7 @@
data-placement="top" data-placement="top"
data-toggle="tooltip" data-toggle="tooltip"
data-html="true" data-html="true"
title='<%= "@ " <> usd_value <> "/" <> gettext("Ether") %>' title='<%= "@ " <> usd_value <> "/" <> Explorer.coin_name() %>'
> >
</span>) </span>)
</span> </span>

@ -2,7 +2,7 @@
<%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %> <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
<div class="card"> <div class="card">
<div class="card-body" data-async-load data-async-listing="<%= @current_path %>"> <div class="card-body" data-async-load data-async-listing="<%= @current_path %>">
<h1 class="card-title list-title-description"><%= gettext "Ether" %> <%= gettext "Addresses" %></h1> <h1 class="card-title list-title-description"><%= Explorer.coin_name() %> <%= gettext "Addresses" %></h1>
<div class="list-top-pagination-container-wrapper"> <div class="list-top-pagination-container-wrapper">
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>

@ -160,7 +160,7 @@
data-placement="top" data-placement="top"
data-toggle="tooltip" data-toggle="tooltip"
data-html="true" data-html="true"
title='<%= "@ " <> usd_value <> "/" <> gettext("Ether") %>' title='<%= "@ " <> usd_value <> "/" <> Explorer.coin_name() %>'
> >
</span>) </span>)
</span> </span>

@ -1,4 +1,4 @@
<% native_coin = gettext("ETH") %> <% native_coin = Explorer.coin_name() %>
<!-- USD value of the balance --> <!-- USD value of the balance -->
<% wei_value = if @address.fetched_coin_balance, do: @address.fetched_coin_balance.value %> <% wei_value = if @address.fetched_coin_balance, do: @address.fetched_coin_balance.value %>
<% raw_usd_value = <% raw_usd_value =

@ -212,7 +212,7 @@
<dl class="row"> <dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted"> <dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Ether") <> " " <> gettext("burned from transactions included in the block (Base fee (per unit of gas) * Gas Used).") %> text: Explorer.coin_name() <> " " <> gettext("burned from transactions included in the block (Base fee (per unit of gas) * Gas Used).") %>
<%= gettext("Burnt Fees") %> <%= gettext("Burnt Fees") %>
</dt> </dt>
<dd class="col-sm-9 col-lg-10"><i class="fa-solid fa-fire i-tooltip-2"></i> <%= format_wei_value(burned_fee, :ether) %></dd> <dd class="col-sm-9 col-lg-10"><i class="fa-solid fa-fire i-tooltip-2"></i> <%= format_wei_value(burned_fee, :ether) %></dd>

@ -21,7 +21,7 @@
</span> </span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0"> <span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title"> <span class="tile-title">
<%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %> <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= Explorer.coin_name() %>
</span> </span>
</span> </span>
</div> </div>

@ -1,5 +1,5 @@
<input id="js-chain-id" class="d-none" value="<%= Application.get_env(:block_scout_web, :chain_id) %>" /> <input id="js-chain-id" class="d-none" value="<%= Application.get_env(:block_scout_web, :chain_id) %>" />
<input id="js-coin-name" class="d-none" value="<%= Application.get_env(:explorer, :coin_name) %>" /> <input id="js-coin-name" class="d-none" value="<%= Explorer.coin_name() %>" />
<% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> <% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %>
<input id="js-subnetwork" class="d-none" value="<%= sub_network %>" /> <input id="js-subnetwork" class="d-none" value="<%= sub_network %>" />
<input id="js-json-rpc" class="d-none" value="<%= Application.get_env(:block_scout_web, :json_rpc) %>" /> <input id="js-json-rpc" class="d-none" value="<%= Application.get_env(:block_scout_web, :json_rpc) %>" />

@ -79,7 +79,7 @@
to: tokens_path(@conn, :index) to: tokens_path(@conn, :index)
) %> ) %>
<%= link( <%= link(
gettext("Ether"), Explorer.coin_name(),
class: "dropdown-item #{tab_status("accounts", @conn.request_path)}", class: "dropdown-item #{tab_status("accounts", @conn.request_path)}",
to: address_path(@conn, :index) to: address_path(@conn, :index)
) %> ) %>

@ -45,7 +45,7 @@
'Less than': '<%= gettext("Less than") %>', 'Less than': '<%= gettext("Less than") %>',
'Market Cap': '<%= gettext("Market Cap") %>', 'Market Cap': '<%= gettext("Market Cap") %>',
'Price': '<%= gettext("Price") %>', 'Price': '<%= gettext("Price") %>',
'Ether': '<%= gettext("Ether") %>', 'Ether': '<%= Explorer.coin_name() %>',
'Tx/day': '<%= gettext("Tx/day") %>' 'Tx/day': '<%= gettext("Tx/day") %>'
} }
</script> </script>

@ -92,7 +92,7 @@
<%= if Helper.payable?(function) do %> <%= if Helper.payable?(function) do %>
<div class="form-group pr-3 d-flex"> <div class="form-group pr-3 d-flex">
<input type="number" name="function_input" tx-value <input type="number" name="function_input" tx-value
data-toggle="tooltip" title='Amount in native token <<%= gettext("ETH")%>>' class="form-control form-control-sm address-input-sm" placeholder='value(<%= gettext("ETH")%>)' min="0" step="1e-18" /> data-toggle="tooltip" title='Amount in native token <<%= Explorer.coin_name() %>>' class="form-control form-control-sm address-input-sm" placeholder='value(<%= Explorer.coin_name() %>)' min="0" step="1e-18" />
</div> </div>
<% end %> <% end %>
@ -134,7 +134,7 @@
<span class="py-2 px-2"> <span class="py-2 px-2">
<input class="wei-ether" type="checkbox" autocomplete="off"> <input class="wei-ether" type="checkbox" autocomplete="off">
<span class="d-inline-block" data-conversion-text-wei><%= gettext("WEI")%></span> <span class="d-inline-block" data-conversion-text-wei><%= gettext("WEI")%></span>
<span class="d-none" data-conversion-text-eth><%= gettext("ETH")%></span> <span class="d-none" data-conversion-text-eth><%= Explorer.coin_name() %></span>
</span> </span>
</div> </div>
</div> </div>

@ -17,7 +17,7 @@
<% end %> <% end %>
</span> </span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0"> <span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title"><%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %></span> <span class="tile-title"><%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= Explorer.coin_name() %></span>
<span class="ml-0 ml-md-1 text-nowrap"> <%= BlockScoutWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %></span> <span class="ml-0 ml-md-1 text-nowrap"> <%= BlockScoutWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %></span>
</span> </span>
</div> </div>

@ -46,7 +46,7 @@
</span> </span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0"> <span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title"> <span class="tile-title">
<%= value(@transaction, include_label: false) %> <%= gettext "Ether" %> <%= value(@transaction, include_label: false) %> <%= Explorer.coin_name() %>
</span> </span>
<span class="ml-0 ml-md-1 text-nowrap"> <span class="ml-0 ml-md-1 text-nowrap">
<%= formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %> <%= formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %>

@ -408,7 +408,7 @@
<dl class="row"> <dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted"> <dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html", <%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Amount of") <> " " <> gettext("Ether") <> " " <> gettext("burned for this transaction. Equals Block Base Fee per Gas * Gas Used.") %> text: gettext("Amount of") <> " " <> Explorer.coin_name() <> " " <> gettext("burned for this transaction. Equals Block Base Fee per Gas * Gas Used.") %>
<%= gettext "Transaction Burnt Fee" %> <%= gettext "Transaction Burnt Fee" %>
</dt> </dt>
<dd class="col-sm-9 col-lg-10"><i class="fa-solid fa-fire i-tooltip-2"></i> <%= format_wei_value(burned_fee, :ether) %> <dd class="col-sm-9 col-lg-10"><i class="fa-solid fa-fire i-tooltip-2"></i> <%= format_wei_value(burned_fee, :ether) %>

@ -2,6 +2,7 @@ defmodule BlockScoutWeb.APIDocsView do
use BlockScoutWeb, :view use BlockScoutWeb, :view
alias BlockScoutWeb.LayoutView alias BlockScoutWeb.LayoutView
alias Explorer
def action_tile_id(module, action) do def action_tile_id(module, action) do
"#{module}-#{action}" "#{module}-#{action}"
@ -20,7 +21,7 @@ defmodule BlockScoutWeb.APIDocsView do
end end
def model_type_definition(definition_func) when is_function(definition_func, 1) do def model_type_definition(definition_func) when is_function(definition_func, 1) do
coin = Application.get_env(:explorer, :coin) coin = Explorer.coin()
definition_func.(coin) definition_func.(coin)
end end

@ -35,7 +35,7 @@ defmodule BlockScoutWeb.WeiHelpers do
"10,000 Gwei" "10,000 Gwei"
iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether) iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether)
"10,000 Ether" "10,000 ETH"
# With formatting options # With formatting options
@ -43,7 +43,7 @@ defmodule BlockScoutWeb.WeiHelpers do
...> %Wei{value: Decimal.new(1000500000000000000)}, ...> %Wei{value: Decimal.new(1000500000000000000)},
...> :ether ...> :ether
...> ) ...> )
"1.0005 Ether" "1.0005 ETH"
iex> format_wei_value( iex> format_wei_value(
...> %Wei{value: Decimal.new(10)}, ...> %Wei{value: Decimal.new(10)},
@ -75,5 +75,5 @@ defmodule BlockScoutWeb.WeiHelpers do
defp display_unit(:wei), do: gettext("Wei") defp display_unit(:wei), do: gettext("Wei")
defp display_unit(:gwei), do: gettext("Gwei") defp display_unit(:gwei), do: gettext("Gwei")
defp display_unit(:ether), do: gettext("Ether") defp display_unit(:ether), do: Explorer.coin_name()
end end

@ -1065,14 +1065,6 @@ msgstr ""
msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" msgid "ERC-721, ERC-1155 tokens (NFT) (beta)"
msgstr "" msgstr ""
#: lib/block_scout_web/templates/address_token/overview.html.eex:1
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:95
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:95
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:137
#, elixir-autogen, elixir-format
msgid "ETH"
msgstr ""
#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "ETH RPC API Documentation" msgid "ETH RPC API Documentation"
@ -1174,23 +1166,6 @@ msgstr ""
msgid "Eth RPC" msgid "Eth RPC"
msgstr "" msgstr ""
#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:27
#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:21
#: lib/block_scout_web/templates/address/_current_coin_balance.html.eex:11
#: lib/block_scout_web/templates/address/index.html.eex:5
#: lib/block_scout_web/templates/address/overview.html.eex:163
#: lib/block_scout_web/templates/block/overview.html.eex:215
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:24
#: lib/block_scout_web/templates/layout/_topnav.html.eex:82
#: lib/block_scout_web/templates/layout/app.html.eex:48
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:49
#: lib/block_scout_web/templates/transaction/overview.html.eex:411
#: lib/block_scout_web/views/wei_helpers.ex:78
#, elixir-autogen, elixir-format
msgid "Ether"
msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format

@ -1065,14 +1065,6 @@ msgstr ""
msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" msgid "ERC-721, ERC-1155 tokens (NFT) (beta)"
msgstr "" msgstr ""
#: lib/block_scout_web/templates/address_token/overview.html.eex:1
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:95
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:95
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:137
#, elixir-autogen, elixir-format
msgid "ETH"
msgstr ""
#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "ETH RPC API Documentation" msgid "ETH RPC API Documentation"
@ -1174,23 +1166,6 @@ msgstr ""
msgid "Eth RPC" msgid "Eth RPC"
msgstr "" msgstr ""
#: lib/block_scout_web/templates/account/watchlist_address/form.html.eex:27
#: lib/block_scout_web/templates/account/watchlist_address/row.html.eex:21
#: lib/block_scout_web/templates/address/_current_coin_balance.html.eex:11
#: lib/block_scout_web/templates/address/index.html.eex:5
#: lib/block_scout_web/templates/address/overview.html.eex:163
#: lib/block_scout_web/templates/block/overview.html.eex:215
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:24
#: lib/block_scout_web/templates/layout/_topnav.html.eex:82
#: lib/block_scout_web/templates/layout/app.html.eex:48
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:49
#: lib/block_scout_web/templates/transaction/overview.html.eex:411
#: lib/block_scout_web/views/wei_helpers.ex:78
#, elixir-autogen, elixir-format
msgid "Ether"
msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:211
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164 #: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:164
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format

@ -54,7 +54,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do
|> post("/api/account/v1/user/tags/address", address_tag) |> post("/api/account/v1/user/tags/address", address_tag)
|> json_response(200) |> json_response(200)
response = _response =
conn conn
|> get("/api/account/v1/user/tags/address") |> get("/api/account/v1/user/tags/address")
|> json_response(200) == [tag_address_response] |> json_response(200) == [tag_address_response]
@ -214,7 +214,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do
|> post("/api/account/v1/user/tags/transaction", tx_tag) |> post("/api/account/v1/user/tags/transaction", tx_tag)
|> json_response(200) |> json_response(200)
response = _response =
conn conn
|> get("/api/account/v1/user/tags/transaction") |> get("/api/account/v1/user/tags/transaction")
|> json_response(200) == [tag_response] |> json_response(200) == [tag_response]

@ -79,7 +79,7 @@ defmodule BlockScoutWeb.ViewingAddressesTest do
session session
|> AddressPage.visit_page(address) |> AddressPage.visit_page(address)
|> assert_text(AddressPage.balance(), "0.0000000000000005 Ether") |> assert_text(AddressPage.balance(), "0.0000000000000005 ETH")
end end
describe "viewing contract creator" do describe "viewing contract creator" do

@ -8,13 +8,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do
test "format the wei value in ether" do test "format the wei value in ether" do
wei = Wei.from(Decimal.new(1_340_000_000), :gwei) wei = Wei.from(Decimal.new(1_340_000_000), :gwei)
assert AddressCoinBalanceView.format(wei) == "1.34 Ether" assert AddressCoinBalanceView.format(wei) == "1.34 ETH"
end end
test "format negative values" do test "format negative values" do
wei = Wei.from(Decimal.new(-1_340_000_000), :gwei) wei = Wei.from(Decimal.new(-1_340_000_000), :gwei)
assert AddressCoinBalanceView.format(wei) == "-1.34 Ether" assert AddressCoinBalanceView.format(wei) == "-1.34 ETH"
end end
end end
@ -50,13 +50,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do
test "format positive values" do test "format positive values" do
value = Decimal.new(1_340_000_000_000_000_000) value = Decimal.new(1_340_000_000_000_000_000)
assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether" assert AddressCoinBalanceView.format_delta(value) == "1.34 ETH"
end end
test "format negative values" do test "format negative values" do
value = Decimal.new(-1_340_000_000_000_000_000) value = Decimal.new(-1_340_000_000_000_000_000)
assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether" assert AddressCoinBalanceView.format_delta(value) == "1.34 ETH"
end end
end end
end end

@ -91,7 +91,7 @@ defmodule BlockScoutWeb.BlockViewTest do
block = Repo.preload(block, :rewards) block = Repo.preload(block, :rewards)
assert BlockView.combined_rewards_value(block) == "3.000042 Ether" assert BlockView.combined_rewards_value(block) == "3.000042 ETH"
end end
end end
end end

@ -136,7 +136,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
gas_used: nil gas_used: nil
) )
expected_value = "Max of 0.009 Ether" expected_value = "Max of 0.009 ETH"
assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether) assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether)
end end
@ -144,7 +144,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
{:ok, gas_price} = Wei.cast(3_000_000_000) {:ok, gas_price} = Wei.cast(3_000_000_000)
transaction = build(:transaction, gas_price: gas_price, gas_used: Decimal.from_float(1_034_234.0)) transaction = build(:transaction, gas_price: gas_price, gas_used: Decimal.from_float(1_034_234.0))
expected_value = "0.003102702 Ether" expected_value = "0.003102702 ETH"
assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether) assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether)
end end
end end

@ -96,16 +96,17 @@ defmodule EthereumJSONRPC.Variant do
) :: {:ok, [raw_trace_params]} | {:error, reason :: term} | :ignore ) :: {:ok, [raw_trace_params]} | {:error, reason :: term} | :ignore
def get do def get do
variant = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:type]
cond do cond do
is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) -> is_nil(variant) ->
"nethermind" "nethermind"
System.get_env("ETHEREUM_JSONRPC_VARIANT") == "parity" -> variant == "parity" ->
"nethermind" "nethermind"
true -> true ->
"ETHEREUM_JSONRPC_VARIANT" variant
|> System.get_env()
|> String.split(".") |> String.split(".")
|> List.last() |> List.last()
|> String.downcase() |> String.downcase()

@ -7,6 +7,8 @@ defmodule Explorer do
if it comes from the database, an external API or others. if it comes from the database, an external API or others.
""" """
require Logger
@doc """ @doc """
Returns the configured coin for `Explorer` Returns the configured coin for `Explorer`
""" """

@ -5,6 +5,7 @@ defmodule Explorer.Account.Notifier.Summary do
require Logger require Logger
alias Explorer
alias Explorer.Account.Notifier.Summary alias Explorer.Account.Notifier.Summary
alias Explorer.{Chain, Repo} alias Explorer.{Chain, Repo}
alias Explorer.Chain.Wei alias Explorer.Chain.Wei
@ -79,7 +80,7 @@ defmodule Explorer.Account.Notifier.Summary do
block_number: transaction.block_number, block_number: transaction.block_number,
amount: amount(transaction), amount: amount(transaction),
tx_fee: fee(transaction), tx_fee: fee(transaction),
name: Application.get_env(:explorer, :coin_name), name: Explorer.coin_name(),
subject: "Coin transaction", subject: "Coin transaction",
type: "COIN" type: "COIN"
} }
@ -94,7 +95,7 @@ defmodule Explorer.Account.Notifier.Summary do
block_number: transaction.block_number, block_number: transaction.block_number,
amount: amount(transaction), amount: amount(transaction),
tx_fee: fee(transaction), tx_fee: fee(transaction),
name: Application.get_env(:explorer, :coin_name), name: Explorer.coin_name(),
subject: "Contract creation", subject: "Contract creation",
type: "COIN" type: "COIN"
} }

@ -27,7 +27,7 @@ defmodule Explorer.Account.Notify.SummaryTest do
block_number: block_number, block_number: block_number,
from_address_hash: from_address.hash, from_address_hash: from_address.hash,
method: "transfer", method: "transfer",
name: "POA", name: "ETH",
subject: "Coin transaction", subject: "Coin transaction",
to_address_hash: to_address.hash, to_address_hash: to_address.hash,
transaction_hash: tx_hash, transaction_hash: tx_hash,
@ -74,7 +74,7 @@ defmodule Explorer.Account.Notify.SummaryTest do
block_number: block.number, block_number: block.number,
from_address_hash: address.hash, from_address_hash: address.hash,
method: "contract_creation", method: "contract_creation",
name: "POA", name: "ETH",
subject: "Contract creation", subject: "Contract creation",
to_address_hash: contract_address.hash, to_address_hash: contract_address.hash,
transaction_hash: tx_hash, transaction_hash: tx_hash,

@ -168,6 +168,8 @@ config :ethereum_jsonrpc, EthereumJSONRPC.Geth, debug_trace_transaction_timeout:
config :ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction, config :ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction,
type: System.get_env("ETHEREUM_JSONRPC_PENDING_TRANSACTIONS_TYPE", "default") type: System.get_env("ETHEREUM_JSONRPC_PENDING_TRANSACTIONS_TYPE", "default")
config :ethereum_jsonrpc, EthereumJSONRPC.Variant, type: System.get_env("ETHEREUM_JSONRPC_VARIANT", "nethermind")
################ ################
### Explorer ### ### Explorer ###
################ ################
@ -182,8 +184,8 @@ healthy_blocks_period =
|> :timer.minutes() |> :timer.minutes()
config :explorer, config :explorer,
coin: System.get_env("COIN") || "POA", coin: System.get_env("COIN", nil) || System.get_env("EXCHANGE_RATES_COIN") || "ETH",
coin_name: System.get_env("COIN_NAME") || System.get_env("COIN") || "POA", coin_name: System.get_env("COIN_NAME", nil) || System.get_env("EXCHANGE_RATES_COIN") || "ETH",
allowed_evm_versions: allowed_evm_versions:
System.get_env("ALLOWED_EVM_VERSIONS") || System.get_env("ALLOWED_EVM_VERSIONS") ||
"homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default", "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default",

@ -25,7 +25,6 @@ services:
context: .. context: ..
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
args: args:
COIN: ""
CACHE_EXCHANGE_RATES_PERIOD: "" CACHE_EXCHANGE_RATES_PERIOD: ""
DISABLE_READ_API: "false" DISABLE_READ_API: "false"
API_PATH: "/" API_PATH: "/"

@ -26,7 +26,6 @@ services:
context: .. context: ..
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
args: args:
COIN: ""
CACHE_EXCHANGE_RATES_PERIOD: "" CACHE_EXCHANGE_RATES_PERIOD: ""
DISABLE_READ_API: "false" DISABLE_READ_API: "false"
API_PATH: "/" API_PATH: "/"

@ -20,7 +20,6 @@ BLOCKSCOUT_PROTOCOL=
# CHECK_ORIGIN= # CHECK_ORIGIN=
PORT=4000 PORT=4000
COIN_NAME= COIN_NAME=
# COIN=
# METADATA_CONTRACT= # METADATA_CONTRACT=
# VALIDATORS_CONTRACT= # VALIDATORS_CONTRACT=
# KEYS_MANAGER_CONTRACT= # KEYS_MANAGER_CONTRACT=
@ -29,6 +28,8 @@ COIN_NAME=
EMISSION_FORMAT=DEFAULT EMISSION_FORMAT=DEFAULT
# CHAIN_SPEC_PATH= # CHAIN_SPEC_PATH=
# SUPPLY_MODULE= # SUPPLY_MODULE=
COIN=
EXCHANGE_RATES_COIN=
# EXCHANGE_RATES_SOURCE= # EXCHANGE_RATES_SOURCE=
# EXCHANGE_RATES_COINGECKO_COIN_ID= # EXCHANGE_RATES_COINGECKO_COIN_ID=
# EXCHANGE_RATES_COINGECKO_API_KEY= # EXCHANGE_RATES_COINGECKO_API_KEY=

@ -34,7 +34,6 @@ ARG WOBSERVER_ENABLED
ARG ADMIN_PANEL_ENABLED ARG ADMIN_PANEL_ENABLED
ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
ARG SOCKET_ROOT ARG SOCKET_ROOT
ARG COIN
# Cache elixir deps # Cache elixir deps
ADD mix.exs mix.lock ./ ADD mix.exs mix.lock ./
@ -49,14 +48,6 @@ ADD . .
COPY . . COPY . .
RUN if [ "$COIN" != "" ]; then \
sed -i s/"POA"/"${COIN}"/g apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \
sed -i "/msgid \"Ether\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/default.pot; \
sed -i "/msgid \"Ether\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \
sed -i "/msgid \"ETH\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/default.pot; \
sed -i "/msgid \"ETH\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \
fi
# Run forderground build and phoenix digest # Run forderground build and phoenix digest
RUN mix compile && npm install npm@latest RUN mix compile && npm install npm@latest

@ -220,6 +220,9 @@ endif
ifdef CHECKSUM_FUNCTION ifdef CHECKSUM_FUNCTION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_FUNCTION=$(CHECKSUM_FUNCTION)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_FUNCTION=$(CHECKSUM_FUNCTION)'
endif endif
ifdef EXCHANGE_RATES_COIN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COIN=$(EXCHANGE_RATES_COIN)'
endif
ifdef EXCHANGE_RATES_SOURCE ifdef EXCHANGE_RATES_SOURCE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_SOURCE=$(EXCHANGE_RATES_SOURCE)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_SOURCE=$(EXCHANGE_RATES_SOURCE)'
endif endif
@ -519,7 +522,7 @@ ifdef HAS_BLOCKSCOUT_IMAGE
@echo "==> Image exist. Using $(BS_CONTAINER_IMAGE)" @echo "==> Image exist. Using $(BS_CONTAINER_IMAGE)"
else else
@echo "==> No image found, trying to build one..." @echo "==> No image found, trying to build one..."
@docker build --build-arg COIN="$(COIN)" -f ./Dockerfile -t $(BS_CONTAINER_IMAGE) ../ @docker build -f ./Dockerfile -t $(BS_CONTAINER_IMAGE) ../
endif endif
migrate_only: migrate_only:

Loading…
Cancel
Save