diff --git a/CHANGELOG.md b/CHANGELOG.md index 16869df2f8..39277b553b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#2834](https://github.com/poanetwork/blockscout/pull/2834) - always redirect to checksummed hash ### Fixes +- [#3014](https://github.com/poanetwork/blockscout/pull/3014) - Fix checksum address feature for tokens pages - [#3012](https://github.com/poanetwork/blockscout/pull/3012) - Speedup token transfers list query - [#3011](https://github.com/poanetwork/blockscout/pull/3011) - Revert realtime fetcher small skips feature - [#3009](https://github.com/poanetwork/blockscout/pull/3009) - Fix broken export to CSV diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex index db24acb2b9..078aac9e56 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex @@ -3,6 +3,7 @@ defmodule BlockScoutWeb.Tokens.HolderController do alias BlockScoutWeb.Tokens.HolderView alias Explorer.{Chain, Market} + alias Explorer.Chain.Address alias Phoenix.View import BlockScoutWeb.Chain, @@ -52,7 +53,7 @@ defmodule BlockScoutWeb.Tokens.HolderController do "index.html", current_path: current_path(conn), token: Market.add_price(token), - counters_path: token_path(conn, :token_counters, %{"id" => to_string(address_hash)}) + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}) ) else :error -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex index 4ea0bd2d76..e05b49cd47 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex @@ -3,6 +3,7 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferController do alias BlockScoutWeb.Tokens.TransferView alias Explorer.{Chain, Market} + alias Explorer.Chain.Address alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] @@ -24,7 +25,7 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferController do conn, :index, token_id, - token.contract_address_hash, + Address.checksum(token.contract_address_hash), Map.delete(next_page_params, "type") ) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex index 112117662e..f257334a07 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex @@ -3,7 +3,7 @@ defmodule BlockScoutWeb.Tokens.InventoryController do alias BlockScoutWeb.Tokens.InventoryView alias Explorer.{Chain, Market} - alias Explorer.Chain.TokenTransfer + alias Explorer.Chain.{Address, TokenTransfer} alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, default_paging_options: 0] @@ -28,7 +28,7 @@ defmodule BlockScoutWeb.Tokens.InventoryController do token_inventory_path( conn, :index, - address_hash_string, + Address.checksum(address_hash_string), Map.delete(next_page_params, "type") ) end @@ -71,7 +71,7 @@ defmodule BlockScoutWeb.Tokens.InventoryController do "index.html", current_path: current_path(conn), token: Market.add_price(token), - counters_path: token_path(conn, :token_counters, %{"id" => to_string(address_hash)}) + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}) ) else :error -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/read_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/read_contract_controller.ex index 9d14b42e5f..b1ff0fcfed 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/read_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/read_contract_controller.ex @@ -2,6 +2,7 @@ defmodule BlockScoutWeb.Tokens.ReadContractController do use BlockScoutWeb, :controller alias Explorer.{Chain, Market} + alias Explorer.Chain.Address def index(conn, %{"token_id" => address_hash_string}) do options = [necessity_by_association: %{[contract_address: :smart_contract] => :optional}] @@ -13,7 +14,7 @@ defmodule BlockScoutWeb.Tokens.ReadContractController do conn, "index.html", token: Market.add_price(token), - counters_path: token_path(conn, :token_counters, %{"id" => to_string(address_hash)}) + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}) ) else :not_found -> diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex index 30a69ff806..b3b523926f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex @@ -3,6 +3,7 @@ defmodule BlockScoutWeb.Tokens.TransferController do alias BlockScoutWeb.Tokens.TransferView alias Explorer.{Chain, Market} + alias Explorer.Chain.Address alias Phoenix.View import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] @@ -19,7 +20,12 @@ defmodule BlockScoutWeb.Tokens.TransferController do nil next_page_params -> - token_transfer_path(conn, :index, token.contract_address_hash, Map.delete(next_page_params, "type")) + token_transfer_path( + conn, + :index, + Address.checksum(token.contract_address_hash), + Map.delete(next_page_params, "type") + ) end transfers_json = @@ -51,7 +57,7 @@ defmodule BlockScoutWeb.Tokens.TransferController do render( conn, "index.html", - counters_path: token_path(conn, :token_counters, %{"id" => to_string(address_hash)}), + counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}), current_path: current_path(conn), token: Market.add_price(token) ) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex index 991c8e13f6..4f363b3347 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex @@ -18,7 +18,7 @@ data-placement="top" data-toggle="tooltip" title='<%= gettext("View Contract") %>' - onclick='<%= "location='#{address_path(@conn, :show, @token.contract_address_hash)}'" %>' + onclick='<%= "location='#{address_path(@conn, :show, Address.checksum(@token.contract_address_hash))}'" %>' > diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex index fe0eb5c0e9..a4e299b2bf 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex @@ -8,7 +8,7 @@ <%= if @token_instance.instance do %> <%= link( gettext("Metadata"), - to: token_instance_metadata_path(@conn, :index, @token.contract_address_hash, to_string(@token_instance.token_id)), + to: token_instance_metadata_path(@conn, :index, Address.checksum(@token.contract_address_hash), to_string(@token_instance.token_id)), class: "card-tab #{tab_status("metadata", @conn.request_path)}") %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex index d46dbb25ac..4fd8e88b8f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex @@ -11,7 +11,7 @@ <% end %> - + -

<%= to_string(@token.contract_address_hash) %>

+

<%= Address.checksum(@token.contract_address_hash) %>

<%= link to: - address_path(@conn, :show, @token.contract_address_hash), + address_path(@conn, :show, Address.checksum(@token.contract_address_hash)), "data-test": "token_contract_address" do %> <%= gettext "View Contract" %> @@ -108,7 +108,7 @@