Merge pull request #885 from poanetwork/ams-remove-token-holders

Remove token holders count from Token's page
pull/891/head
Andrew Cravenho 6 years ago committed by GitHub
commit 52708263c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex
  2. 1
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/inventory_controller.ex
  3. 3
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/read_contract_controller.ex
  4. 1
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex
  5. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex
  6. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/inventory/index.html.eex
  7. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex
  8. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/read_contract/index.html.eex
  9. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/token/show.html.eex
  10. 1
      apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex
  11. 37
      apps/block_scout_web/priv/gettext/default.pot
  12. 37
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  13. 1
      apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs
  14. 3
      apps/explorer/lib/explorer/chain.ex

@ -21,7 +21,6 @@ defmodule BlockScoutWeb.Tokens.HolderController do
"index.html", "index.html",
token: token, token: token,
token_balances: token_balances_paginated, token_balances: token_balances_paginated,
total_token_holders: Chain.count_token_holders_from_token_hash(address_hash),
total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash), total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash),
next_page_params: next_page_params(next_page, token_balances_paginated, params) next_page_params: next_page_params(next_page, token_balances_paginated, params)
) )

@ -23,7 +23,6 @@ defmodule BlockScoutWeb.Tokens.InventoryController do
token: token, token: token,
unique_tokens: unique_tokens_paginated, unique_tokens: unique_tokens_paginated,
total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash), total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash),
total_token_holders: Chain.count_token_holders_from_token_hash(address_hash),
next_page_params: unique_tokens_next_page(next_page, unique_tokens_paginated, params) next_page_params: unique_tokens_next_page(next_page, unique_tokens_paginated, params)
) )
else else

@ -10,8 +10,7 @@ defmodule BlockScoutWeb.Tokens.ReadContractController do
conn, conn,
"index.html", "index.html",
token: token, token: token,
total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash), total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash)
total_token_holders: Chain.count_token_holders_from_token_hash(address_hash)
) )
else else
:error -> :error ->

@ -17,7 +17,6 @@ defmodule BlockScoutWeb.Tokens.TransferController do
transfers: token_transfers_paginated, transfers: token_transfers_paginated,
token: token, token: token,
total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash), total_token_transfers: Chain.count_token_transfers_from_token_hash(address_hash),
total_token_holders: Chain.count_token_holders_from_token_hash(address_hash),
next_page_params: next_page_params(next_page, token_transfers_paginated, params) next_page_params: next_page_params(next_page, token_transfers_paginated, params)
) )
else else

@ -4,7 +4,6 @@
"_details.html", "_details.html",
token: @token, token: @token,
total_token_transfers: @total_token_transfers, total_token_transfers: @total_token_transfers,
total_token_holders: @total_token_holders,
conn: @conn conn: @conn
) %> ) %>

@ -4,7 +4,6 @@
"_details.html", "_details.html",
token: @token, token: @token,
total_token_transfers: @total_token_transfers, total_token_transfers: @total_token_transfers,
total_token_holders: @total_token_holders,
conn: @conn conn: @conn
) %> ) %>

@ -36,7 +36,6 @@
</span> </span>
<div class="d-flex flex-row justify-content-start text-muted"> <div class="d-flex flex-row justify-content-start text-muted">
<span class="mr-4"> <%= @token.type %> </span> <span class="mr-4"> <%= @token.type %> </span>
<span class="mr-4"><%= @total_token_holders %> <%= gettext "addresses" %></span>
<span class="mr-4"><%= @total_token_transfers %> <%= gettext "Transfers" %></span> <span class="mr-4"><%= @total_token_transfers %> <%= gettext "Transfers" %></span>
<%= if decimals?(@token) do %> <%= if decimals?(@token) do %>
<span class="mr-4"><%= @token.decimals %> <%= gettext "decimals" %></span> <span class="mr-4"><%= @token.decimals %> <%= gettext "decimals" %></span>

@ -4,7 +4,6 @@
"_details.html", "_details.html",
token: @token, token: @token,
total_token_transfers: @total_token_transfers, total_token_transfers: @total_token_transfers,
total_token_holders: @total_token_holders,
conn: @conn conn: @conn
) %> ) %>

@ -4,7 +4,6 @@
"_details.html", "_details.html",
token: @token, token: @token,
total_token_transfers: @total_token_transfers, total_token_transfers: @total_token_transfers,
total_token_holders: @total_token_holders,
conn: @conn conn: @conn
) %> ) %>

@ -4,7 +4,6 @@
"_details.html", "_details.html",
token: @token, token: @token,
total_token_transfers: @total_token_transfers, total_token_transfers: @total_token_transfers,
total_token_holders: @total_token_holders,
conn: @conn conn: @conn
) %> ) %>

@ -155,8 +155,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:73 #: lib/block_scout_web/templates/address/overview.html.eex:73
#: lib/block_scout_web/templates/address/overview.html.eex:81 #: lib/block_scout_web/templates/address/overview.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:90 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:89
msgid "Close" msgid "Close"
msgstr "" msgstr ""
@ -439,7 +439,7 @@ msgid "Internal Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:18 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:17
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:23 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:23
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:67 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:67
#: lib/block_scout_web/views/tokens/overview_view.ex:38 #: lib/block_scout_web/views/tokens/overview_view.ex:38
@ -536,8 +536,8 @@ msgid "Next"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:35 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:34
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:34 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:33
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
@ -565,7 +565,7 @@ msgstr ""
#: lib/block_scout_web/templates/block/index.html.eex:20 #: lib/block_scout_web/templates/block/index.html.eex:20
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50 #: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:70 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:70
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33
#: lib/block_scout_web/templates/transaction/index.html.eex:70 #: lib/block_scout_web/templates/transaction/index.html.eex:70
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24
msgid "Older" msgid "Older"
@ -634,7 +634,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:72 #: lib/block_scout_web/templates/address/overview.html.eex:72
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:81 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:80
msgid "QR Code" msgid "QR Code"
msgstr "" msgstr ""
@ -731,7 +731,7 @@ msgid "Telegram"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:27
msgid "There are no holders for this Token." msgid "There are no holders for this Token."
msgstr "" msgstr ""
@ -767,7 +767,7 @@ msgid "There are no tokens for this address."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:27 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:26
msgid "There are no tokens." msgid "There are no tokens."
msgstr "" msgstr ""
@ -778,7 +778,7 @@ msgid "There are no transactions for this address."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:26
msgid "There are no transfers for this Token." msgid "There are no transfers for this Token."
msgstr "" msgstr ""
@ -811,7 +811,7 @@ msgid "Token Details"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:18
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:60 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:60
#: lib/block_scout_web/views/tokens/overview_view.ex:36 #: lib/block_scout_web/views/tokens/overview_view.ex:36
@ -833,7 +833,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:54 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:54
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:18 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:17
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:6 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:6
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
@ -865,7 +865,7 @@ msgid "Total Difficulty"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:54 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:53
msgid "Total Supply" msgid "Total Supply"
msgstr "" msgstr ""
@ -905,7 +905,7 @@ msgid "Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:40 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:39
msgid "Transfers" msgid "Transfers"
msgstr "" msgstr ""
@ -1003,24 +1003,19 @@ msgstr ""
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:39
msgid "addresses"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:48 #: lib/block_scout_web/templates/address/overview.html.eex:48
msgid "at" msgid "at"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:42 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:41
msgid "decimals" msgid "decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_read_contract/index.html.eex:12 #: lib/block_scout_web/templates/address_read_contract/index.html.eex:12
#: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:19 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:18
msgid "loading..." msgid "loading..."
msgstr "" msgstr ""

@ -155,8 +155,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:73 #: lib/block_scout_web/templates/address/overview.html.eex:73
#: lib/block_scout_web/templates/address/overview.html.eex:81 #: lib/block_scout_web/templates/address/overview.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:90 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:89
msgid "Close" msgid "Close"
msgstr "" msgstr ""
@ -439,7 +439,7 @@ msgid "Internal Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:18 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:17
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:23 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:23
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:67 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:67
#: lib/block_scout_web/views/tokens/overview_view.ex:38 #: lib/block_scout_web/views/tokens/overview_view.ex:38
@ -536,8 +536,8 @@ msgid "Next"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:35 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:34
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:34 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:33
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
@ -565,7 +565,7 @@ msgstr ""
#: lib/block_scout_web/templates/block/index.html.eex:20 #: lib/block_scout_web/templates/block/index.html.eex:20
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50 #: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:70 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:70
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33
#: lib/block_scout_web/templates/transaction/index.html.eex:70 #: lib/block_scout_web/templates/transaction/index.html.eex:70
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24
msgid "Older" msgid "Older"
@ -634,7 +634,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:72 #: lib/block_scout_web/templates/address/overview.html.eex:72
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:81 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:80
msgid "QR Code" msgid "QR Code"
msgstr "" msgstr ""
@ -731,7 +731,7 @@ msgid "Telegram"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:28 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:27
msgid "There are no holders for this Token." msgid "There are no holders for this Token."
msgstr "" msgstr ""
@ -767,7 +767,7 @@ msgid "There are no tokens for this address."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:27 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:26
msgid "There are no tokens." msgid "There are no tokens."
msgstr "" msgstr ""
@ -778,7 +778,7 @@ msgid "There are no transactions for this address."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:27 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:26
msgid "There are no transfers for this Token." msgid "There are no transfers for this Token."
msgstr "" msgstr ""
@ -811,7 +811,7 @@ msgid "Token Details"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:18
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:13 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:13
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:60 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:60
#: lib/block_scout_web/views/tokens/overview_view.ex:36 #: lib/block_scout_web/views/tokens/overview_view.ex:36
@ -833,7 +833,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:54 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:54
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:18 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:17
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:6 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:6
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
@ -865,7 +865,7 @@ msgid "Total Difficulty"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:54 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:53
msgid "Total Supply" msgid "Total Supply"
msgstr "" msgstr ""
@ -905,7 +905,7 @@ msgid "Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:40 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:39
msgid "Transfers" msgid "Transfers"
msgstr "" msgstr ""
@ -1003,24 +1003,19 @@ msgstr ""
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:39
msgid "addresses"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:48 #: lib/block_scout_web/templates/address/overview.html.eex:48
msgid "at" msgid "at"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:42 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:41
msgid "decimals" msgid "decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_read_contract/index.html.eex:12 #: lib/block_scout_web/templates/address_read_contract/index.html.eex:12
#: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:19 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:18
msgid "loading..." msgid "loading..."
msgstr "" msgstr ""

@ -31,7 +31,6 @@ defmodule BlockScoutWeb.Tokens.ReadContractControllerTest do
assert html_response(conn, 200) assert html_response(conn, 200)
assert token.contract_address_hash == conn.assigns.token.contract_address_hash assert token.contract_address_hash == conn.assigns.token.contract_address_hash
assert conn.assigns.total_token_transfers assert conn.assigns.total_token_transfers
assert conn.assigns.total_token_holders
end end
end end
end end

@ -1987,6 +1987,9 @@ defmodule Explorer.Chain do
|> Repo.all() |> Repo.all()
end end
# This function is deprecated.
#
# The code is being treated at https://github.com/poanetwork/blockscout/issues/880
@spec count_token_holders_from_token_hash(Hash.Address.t()) :: non_neg_integer() @spec count_token_holders_from_token_hash(Hash.Address.t()) :: non_neg_integer()
def count_token_holders_from_token_hash(contract_address_hash) do def count_token_holders_from_token_hash(contract_address_hash) do
contract_address_hash contract_address_hash

Loading…
Cancel
Save