diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b26b26712..639b9871ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### 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 - [#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 diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex index 008af99de0..8c6d995ee0 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/stats_controller.ex @@ -3,6 +3,7 @@ defmodule BlockScoutWeb.API.RPC.StatsController do use Explorer.Schema + alias Explorer alias Explorer.{Chain, Etherscan, ExchangeRates} alias Explorer.Chain.Cache.{AddressSum, AddressSumMinusBurnt} alias Explorer.Chain.Wei @@ -60,7 +61,7 @@ defmodule BlockScoutWeb.API.RPC.StatsController do end def coinprice(conn, _params) do - symbol = Application.get_env(:explorer, :coin) + symbol = Explorer.coin() rates = ExchangeRates.lookup(symbol) render(conn, "coinprice.json", rates: rates) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex index 430de6ffef..c2a6dce569 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/form.html.eex @@ -24,7 +24,7 @@

<%= gettext("Please select what types of notifications you will receive:") %>

-

<%= gettext("Ether") %>

+

<%= Explorer.coin_name() %>

<%= checkbox f, :watch_coin_input, class: "form-checkbox" %> <%= label f, :watch_coin_input, gettext("Incoming"), class: "label-checkbox" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex index 467c15952f..95c92d9b8f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/account/watchlist_address/row.html.eex @@ -18,7 +18,7 @@ data-placement="top" data-toggle="tooltip" data-html="true" - title='<%= "@ " <> to_string(@exchange_rate.usd_value) <> "/" <> gettext("Ether") %>' + title='<%= "@ " <> to_string(@exchange_rate.usd_value) <> "/" <> Explorer.coin_name() %>' > ) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex index 76ba32bf9f..405f7e6899 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_current_coin_balance.html.eex @@ -8,7 +8,7 @@ data-placement="top" data-toggle="tooltip" data-html="true" - title='<%= "@ " <> usd_value <> "/" <> gettext("Ether") %>' + title='<%= "@ " <> usd_value <> "/" <> Explorer.coin_name() %>' > ) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex index a1cfb6fa76..57dba32da7 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex @@ -2,7 +2,7 @@ <%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
-

<%= gettext "Ether" %> <%= gettext "Addresses" %>

+

<%= Explorer.coin_name() %> <%= gettext "Addresses" %>

<%= 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 %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex index 28a1920d02..4ad0bd3abd 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex @@ -160,7 +160,7 @@ data-placement="top" data-toggle="tooltip" data-html="true" - title='<%= "@ " <> usd_value <> "/" <> gettext("Ether") %>' + title='<%= "@ " <> usd_value <> "/" <> Explorer.coin_name() %>' > ) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex index 11da76cfc8..6f922375b9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/overview.html.eex @@ -1,4 +1,4 @@ -<% native_coin = gettext("ETH") %> +<% native_coin = Explorer.coin_name() %> <% wei_value = if @address.fetched_coin_balance, do: @address.fetched_coin_balance.value %> <% raw_usd_value = diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex index 0724f70211..500e35a868 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex @@ -212,7 +212,7 @@
<%= 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") %>
<%= format_wei_value(burned_fee, :ether) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex index b7ae6e7f2f..d88a6d9c5c 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex @@ -21,7 +21,7 @@ - <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %> + <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= Explorer.coin_name() %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex index f6cae48b98..0e777ee945 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex @@ -1,5 +1,5 @@ - + <% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index 8347d71e3c..400cc96f05 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -79,7 +79,7 @@ to: tokens_path(@conn, :index) ) %> <%= link( - gettext("Ether"), + Explorer.coin_name(), class: "dropdown-item #{tab_status("accounts", @conn.request_path)}", to: address_path(@conn, :index) ) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex index ed909fdfdc..f2e64a8426 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex @@ -45,7 +45,7 @@ 'Less than': '<%= gettext("Less than") %>', 'Market Cap': '<%= gettext("Market Cap") %>', 'Price': '<%= gettext("Price") %>', - 'Ether': '<%= gettext("Ether") %>', + 'Ether': '<%= Explorer.coin_name() %>', 'Tx/day': '<%= gettext("Tx/day") %>' } diff --git a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex index c3407643b5..6cbda8d930 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex @@ -92,7 +92,7 @@ <%= if Helper.payable?(function) do %>
+ 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" />
<% end %> @@ -134,7 +134,7 @@ <%= gettext("WEI")%> - <%= gettext("ETH")%> + <%= Explorer.coin_name() %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex index afe4e00f27..d1b33ffeeb 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex @@ -17,7 +17,7 @@ <% end %> - <%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %> + <%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= Explorer.coin_name() %> <%= BlockScoutWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex index 75b6e2fe20..f555c37968 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex @@ -46,7 +46,7 @@ - <%= value(@transaction, include_label: false) %> <%= gettext "Ether" %> + <%= value(@transaction, include_label: false) %> <%= Explorer.coin_name() %> <%= formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index e6661c5e05..f483a9112d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -408,7 +408,7 @@
<%= 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" %>
<%= format_wei_value(burned_fee, :ether) %> diff --git a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex index 883440b485..20260243b9 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.APIDocsView do use BlockScoutWeb, :view alias BlockScoutWeb.LayoutView + alias Explorer def action_tile_id(module, action) do "#{module}-#{action}" @@ -20,7 +21,7 @@ defmodule BlockScoutWeb.APIDocsView do end 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) end diff --git a/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex index 1a9ed2c50f..1239f32f71 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex @@ -35,7 +35,7 @@ defmodule BlockScoutWeb.WeiHelpers do "10,000 Gwei" iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether) - "10,000 Ether" + "10,000 ETH" # With formatting options @@ -43,7 +43,7 @@ defmodule BlockScoutWeb.WeiHelpers do ...> %Wei{value: Decimal.new(1000500000000000000)}, ...> :ether ...> ) - "1.0005 Ether" + "1.0005 ETH" iex> format_wei_value( ...> %Wei{value: Decimal.new(10)}, @@ -75,5 +75,5 @@ defmodule BlockScoutWeb.WeiHelpers do defp display_unit(:wei), do: gettext("Wei") defp display_unit(:gwei), do: gettext("Gwei") - defp display_unit(:ether), do: gettext("Ether") + defp display_unit(:ether), do: Explorer.coin_name() end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 94888cbbe5..5c8813bbf9 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1065,14 +1065,6 @@ msgstr "" msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" 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 #, elixir-autogen, elixir-format msgid "ETH RPC API Documentation" @@ -1174,23 +1166,6 @@ msgstr "" msgid "Eth RPC" 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/_eth_rpc_item.html.eex:164 #, elixir-autogen, elixir-format 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 94888cbbe5..5c8813bbf9 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 @@ -1065,14 +1065,6 @@ msgstr "" msgid "ERC-721, ERC-1155 tokens (NFT) (beta)" 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 #, elixir-autogen, elixir-format msgid "ETH RPC API Documentation" @@ -1174,23 +1166,6 @@ msgstr "" msgid "Eth RPC" 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/_eth_rpc_item.html.eex:164 #, elixir-autogen, elixir-format diff --git a/apps/block_scout_web/test/block_scout_web/controllers/account/api/v1/user_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/account/api/v1/user_controller_test.exs index 2ce2a92d62..0f56777af7 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/account/api/v1/user_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/account/api/v1/user_controller_test.exs @@ -54,7 +54,7 @@ defmodule BlockScoutWeb.Account.Api.V1.UserControllerTest do |> post("/api/account/v1/user/tags/address", address_tag) |> json_response(200) - response = + _response = conn |> get("/api/account/v1/user/tags/address") |> 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) |> json_response(200) - response = + _response = conn |> get("/api/account/v1/user/tags/transaction") |> json_response(200) == [tag_response] diff --git a/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs b/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs index 0cab258891..6a8fd918a6 100644 --- a/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs +++ b/apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs @@ -79,7 +79,7 @@ defmodule BlockScoutWeb.ViewingAddressesTest do session |> AddressPage.visit_page(address) - |> assert_text(AddressPage.balance(), "0.0000000000000005 Ether") + |> assert_text(AddressPage.balance(), "0.0000000000000005 ETH") end describe "viewing contract creator" do diff --git a/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs index 348dc96f6c..bc07e1c4fe 100644 --- a/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs @@ -8,13 +8,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do test "format the wei value in ether" do 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 test "format negative values" do 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 @@ -50,13 +50,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do test "format positive values" do 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 test "format negative values" do 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 diff --git a/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs index d707404628..5336dc9ff7 100644 --- a/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/block_view_test.exs @@ -91,7 +91,7 @@ defmodule BlockScoutWeb.BlockViewTest do 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 diff --git a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs index 9b16ef3a54..2a1faf37e4 100644 --- a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs @@ -136,7 +136,7 @@ defmodule BlockScoutWeb.TransactionViewTest do 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) end @@ -144,7 +144,7 @@ defmodule BlockScoutWeb.TransactionViewTest do {: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)) - expected_value = "0.003102702 Ether" + expected_value = "0.003102702 ETH" assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether) end end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex index 7dcff89363..4027609b42 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/variant.ex @@ -96,16 +96,17 @@ defmodule EthereumJSONRPC.Variant do ) :: {:ok, [raw_trace_params]} | {:error, reason :: term} | :ignore def get do + variant = Application.get_env(:ethereum_jsonrpc, __MODULE__)[:type] + cond do - is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) -> + is_nil(variant) -> "nethermind" - System.get_env("ETHEREUM_JSONRPC_VARIANT") == "parity" -> + variant == "parity" -> "nethermind" true -> - "ETHEREUM_JSONRPC_VARIANT" - |> System.get_env() + variant |> String.split(".") |> List.last() |> String.downcase() diff --git a/apps/explorer/lib/explorer.ex b/apps/explorer/lib/explorer.ex index d870da511c..0becee7b1a 100644 --- a/apps/explorer/lib/explorer.ex +++ b/apps/explorer/lib/explorer.ex @@ -7,6 +7,8 @@ defmodule Explorer do if it comes from the database, an external API or others. """ + require Logger + @doc """ Returns the configured coin for `Explorer` """ diff --git a/apps/explorer/lib/explorer/account/notifier/summary.ex b/apps/explorer/lib/explorer/account/notifier/summary.ex index a327074492..8ba3f2e9fc 100644 --- a/apps/explorer/lib/explorer/account/notifier/summary.ex +++ b/apps/explorer/lib/explorer/account/notifier/summary.ex @@ -5,6 +5,7 @@ defmodule Explorer.Account.Notifier.Summary do require Logger + alias Explorer alias Explorer.Account.Notifier.Summary alias Explorer.{Chain, Repo} alias Explorer.Chain.Wei @@ -79,7 +80,7 @@ defmodule Explorer.Account.Notifier.Summary do block_number: transaction.block_number, amount: amount(transaction), tx_fee: fee(transaction), - name: Application.get_env(:explorer, :coin_name), + name: Explorer.coin_name(), subject: "Coin transaction", type: "COIN" } @@ -94,7 +95,7 @@ defmodule Explorer.Account.Notifier.Summary do block_number: transaction.block_number, amount: amount(transaction), tx_fee: fee(transaction), - name: Application.get_env(:explorer, :coin_name), + name: Explorer.coin_name(), subject: "Contract creation", type: "COIN" } diff --git a/apps/explorer/test/explorer/account/notify/summary_test.exs b/apps/explorer/test/explorer/account/notify/summary_test.exs index 611316f193..6402064b7e 100644 --- a/apps/explorer/test/explorer/account/notify/summary_test.exs +++ b/apps/explorer/test/explorer/account/notify/summary_test.exs @@ -27,7 +27,7 @@ defmodule Explorer.Account.Notify.SummaryTest do block_number: block_number, from_address_hash: from_address.hash, method: "transfer", - name: "POA", + name: "ETH", subject: "Coin transaction", to_address_hash: to_address.hash, transaction_hash: tx_hash, @@ -74,7 +74,7 @@ defmodule Explorer.Account.Notify.SummaryTest do block_number: block.number, from_address_hash: address.hash, method: "contract_creation", - name: "POA", + name: "ETH", subject: "Contract creation", to_address_hash: contract_address.hash, transaction_hash: tx_hash, diff --git a/config/runtime.exs b/config/runtime.exs index 1f2bf922a6..48fcfdf9dd 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -168,6 +168,8 @@ config :ethereum_jsonrpc, EthereumJSONRPC.Geth, debug_trace_transaction_timeout: config :ethereum_jsonrpc, EthereumJSONRPC.PendingTransaction, type: System.get_env("ETHEREUM_JSONRPC_PENDING_TRANSACTIONS_TYPE", "default") +config :ethereum_jsonrpc, EthereumJSONRPC.Variant, type: System.get_env("ETHEREUM_JSONRPC_VARIANT", "nethermind") + ################ ### Explorer ### ################ @@ -182,8 +184,8 @@ healthy_blocks_period = |> :timer.minutes() config :explorer, - coin: System.get_env("COIN") || "POA", - coin_name: System.get_env("COIN_NAME") || 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", nil) || System.get_env("EXCHANGE_RATES_COIN") || "ETH", allowed_evm_versions: System.get_env("ALLOWED_EVM_VERSIONS") || "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,default", diff --git a/docker-compose/docker-compose-no-rust-verification.yml b/docker-compose/docker-compose-no-rust-verification.yml index 2f809bcfe2..1fa50867f4 100644 --- a/docker-compose/docker-compose-no-rust-verification.yml +++ b/docker-compose/docker-compose-no-rust-verification.yml @@ -25,7 +25,6 @@ services: context: .. dockerfile: ./docker/Dockerfile args: - COIN: "" CACHE_EXCHANGE_RATES_PERIOD: "" DISABLE_READ_API: "false" API_PATH: "/" diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index e9043545f3..7d14fd445a 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -26,7 +26,6 @@ services: context: .. dockerfile: ./docker/Dockerfile args: - COIN: "" CACHE_EXCHANGE_RATES_PERIOD: "" DISABLE_READ_API: "false" API_PATH: "/" diff --git a/docker-compose/envs/common-blockscout.env b/docker-compose/envs/common-blockscout.env index 6b157a2011..0d3a9fbc5d 100644 --- a/docker-compose/envs/common-blockscout.env +++ b/docker-compose/envs/common-blockscout.env @@ -20,7 +20,6 @@ BLOCKSCOUT_PROTOCOL= # CHECK_ORIGIN= PORT=4000 COIN_NAME= -# COIN= # METADATA_CONTRACT= # VALIDATORS_CONTRACT= # KEYS_MANAGER_CONTRACT= @@ -29,6 +28,8 @@ COIN_NAME= EMISSION_FORMAT=DEFAULT # CHAIN_SPEC_PATH= # SUPPLY_MODULE= +COIN= +EXCHANGE_RATES_COIN= # EXCHANGE_RATES_SOURCE= # EXCHANGE_RATES_COINGECKO_COIN_ID= # EXCHANGE_RATES_COINGECKO_API_KEY= diff --git a/docker/Dockerfile b/docker/Dockerfile index b0a6f0591b..085430f3b4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -34,7 +34,6 @@ ARG WOBSERVER_ENABLED ARG ADMIN_PANEL_ENABLED ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL ARG SOCKET_ROOT -ARG COIN # Cache elixir deps ADD mix.exs mix.lock ./ @@ -49,14 +48,6 @@ ADD . . 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 mix compile && npm install npm@latest diff --git a/docker/Makefile b/docker/Makefile index 2ef104427c..331633bbb1 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -220,6 +220,9 @@ endif ifdef CHECKSUM_FUNCTION BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_FUNCTION=$(CHECKSUM_FUNCTION)' endif +ifdef EXCHANGE_RATES_COIN + BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COIN=$(EXCHANGE_RATES_COIN)' +endif ifdef EXCHANGE_RATES_SOURCE BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_SOURCE=$(EXCHANGE_RATES_SOURCE)' endif @@ -519,7 +522,7 @@ ifdef HAS_BLOCKSCOUT_IMAGE @echo "==> Image exist. Using $(BS_CONTAINER_IMAGE)" else @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 migrate_only: