Merge pull request #5105 from blockscout/np-redesign-token-page

Redesign token page
np-create-filepath-backfiller
Victor Baranov 3 years ago committed by GitHub
commit 82865227d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/config.yml
  2. 1
      CHANGELOG.md
  3. 3
      apps/block_scout_web/assets/css/components/_tile.scss
  4. 1
      apps/block_scout_web/assets/js/lib/token_icon.js
  5. 0
      apps/block_scout_web/assets/js/pages/token_contract.js
  6. 8
      apps/block_scout_web/assets/js/pages/token_counters.js
  7. 2
      apps/block_scout_web/assets/webpack.config.js
  8. 23
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex
  9. 2
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  10. 0
      apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/_metatags.html.eex
  11. 2
      apps/block_scout_web/lib/block_scout_web/templates/tokens/contract/index.html.eex
  12. 2
      apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex
  13. 153
      apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_details.html.eex
  14. 29
      apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_tabs.html.eex
  15. 2
      apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex
  16. 2
      apps/block_scout_web/lib/block_scout_web/views/tokens/contract_view.ex
  17. 19
      apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex
  18. 46
      apps/block_scout_web/lib/block_scout_web/web_router.ex
  19. 95
      apps/block_scout_web/priv/gettext/default.pot
  20. 95
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  21. 34
      apps/block_scout_web/test/block_scout_web/controllers/tokens/read_contract_controller_test.exs

@ -154,7 +154,7 @@ jobs:
id: dialyzer-cache
with:
path: priv/plts
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash_7-${{ hashFiles('mix.lock') }}
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash_8-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-"

@ -1,6 +1,7 @@
## Current
### Features
- [#5105](https://github.com/blockscout/blockscout/pull/5105) - Redesign token page
- [#4690](https://github.com/blockscout/blockscout/pull/4690) - Improve pagination: introduce pagination with random access to pages; Integrate it to the Transactions List page
### Fixes

@ -589,7 +589,8 @@ $cube-quantity: 5;
}
.view-original-token-container {
margin-top: 15px;
margin-top: 10px;
margin-bottom: 10px;
font-size: 12px;
}

@ -36,6 +36,7 @@ function appendTokenIcon ($tokenIconContainer, chainID, addressHash, foreignChai
if ($tokenIconContainer) {
const img = new Image(iconSize, iconSize)
img.src = tokenIconURL
img.className = 'mr-1'
$tokenIconContainer.append(img)
}
}

@ -49,20 +49,16 @@ const elements = {
'[token-transfer-count]': {
render ($el, state) {
if (state.transferCount) {
$el.text(state.transferCount + ' Transfers')
$el.empty().text(state.transferCount + ' Transfers')
return $el.show()
} else {
return $el.hide()
}
}
},
'[token-holder-count]': {
render ($el, state) {
if (state.tokenHolderCount) {
$el.text(state.tokenHolderCount + ' Addresses')
$el.empty().text(state.tokenHolderCount + ' Addresses')
return $el.show()
} else {
return $el.hide()
}
}
}

@ -82,7 +82,7 @@ const appJs =
'token-counters': './js/pages/token_counters.js',
'token-transfers': './js/pages/token/token_transfers.js',
'admin-tasks': './js/pages/admin/tasks.js',
'read-token-contract': './js/pages/read_token_contract.js',
'token-contract': './js/pages/token_contract.js',
'smart-contract-helpers': './js/lib/smart_contract/index.js',
'token-transfers-toggle': './js/lib/token_transfers_toggle.js',
'try-api': './js/lib/try_api.js',

@ -1,7 +1,7 @@
defmodule BlockScoutWeb.Tokens.ReadContractController do
defmodule BlockScoutWeb.Tokens.ContractController do
use BlockScoutWeb, :controller
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.{AccessHelpers, TabHelpers}
alias Explorer.{Chain, Market}
alias Explorer.Chain.Address
@ -12,11 +12,26 @@ defmodule BlockScoutWeb.Tokens.ReadContractController do
:ok <- Chain.check_verified_smart_contract_exists(address_hash),
{:ok, token} <- Chain.token_from_address_hash(address_hash, options),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
%{type: type, action: action} =
cond do
TabHelpers.tab_active?("read-contract", conn.request_path) ->
%{type: :regular, action: :read}
TabHelpers.tab_active?("write-contract", conn.request_path) ->
%{type: :regular, action: :write}
TabHelpers.tab_active?("read-proxy", conn.request_path) ->
%{type: :proxy, action: :read}
TabHelpers.tab_active?("write-proxy", conn.request_path) ->
%{type: :proxy, action: :write}
end
render(
conn,
"index.html",
type: :regular,
action: :read,
type: type,
action: action,
token: Market.add_price(token),
counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)})
)

@ -222,7 +222,7 @@
@view_module != Elixir.BlockScoutWeb.AddressWriteContractView &&
@view_module != Elixir.BlockScoutWeb.AddressWriteProxyView &&
@view_module != Elixir.BlockScoutWeb.Tokens.TransferView &&
@view_module != Elixir.BlockScoutWeb.Tokens.ReadContractView &&
@view_module != Elixir.BlockScoutWeb.Tokens.ContractView &&
@view_module != Elixir.BlockScoutWeb.Tokens.HolderView &&
@view_module != Elixir.BlockScoutWeb.Tokens.InventoryView &&
@view_module != Elixir.BlockScoutWeb.Tokens.InstanceView &&

@ -18,5 +18,5 @@
</div>
</div>
</section>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/read-token-contract.js") %>"></script>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/token-contract.js") %>"></script>
</section>

@ -7,7 +7,7 @@
conn: @conn
) %>
<section data-page="token-holders-list">
<section data-page="token-holders-list" id="holders">
<div class="card">
<%= render OverviewView, "_tabs.html", assigns %>
<!-- Token Holders -->

@ -4,10 +4,10 @@
<% created_from_address_hash = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %>
<section class="address-overview" data-page="token-details" data-page-address-hash="<%= @token.contract_address_hash %>">
<%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
<div class="row">
<div class="card-section col-md-12 col-lg-8 pr-0-md js-ad-dependant-mb-2">
<div class="card">
<div class="card-body" token-page data-async-counters="<%= @counters_path %>">
<div class="row js-ad-dependant-mb-2 js-ad-dependant-mb-5-reverse">
<div class="col-md-12 js-ad-dependant-mb-2">
<div class="card js-ad-dependant-mb-2">
<div class="card-body fs-14" style="line-height: 31px;" token-page data-async-counters="<%= @counters_path %>">
<h1 class="card-title d-flex" style="justify-content: space-between; margin-bottom: 0.75rem">
<div style="line-height: 30px;">
<%= cond do %>
@ -52,74 +52,117 @@
<%= render BlockScoutWeb.CommonComponentsView, "_btn_qr_code.html" %>
</span>
</h1>
<!-- bridged token -->
<%= if @token.bridged do %>
<div class="view-original-token-container">
<%= if Map.has_key?(@token, :foreign_token_contract_address_hash) do %>
<a data-test="original_token_contract_address" href=<%= foreign_bridged_token_explorer_link(@token) %> target="_blank">View Original Token <span class="external-token-icon"><%= render BlockScoutWeb.IconsView, "_external_link.html" %></span></a>
<% end %>
</div>
<%= if Map.has_key?(@token, :custom_metadata) do %>
<div style="margin-top: 15px; font-size: 12px;">
<%= @token.custom_metadata %>
</div>
<% end %>
<% end %>
<h3 class="token-address-mobile"><%= Address.checksum(@token.contract_address_hash) %></h3>
<div class="d-flex flex-column flex-md-row justify-content-start text-muted">
<span class="mr-4 mb-3 mb-md-0">
<%= link to:
AccessHelpers.get_path(@conn, :address_path, :show, Address.checksum(@token.contract_address_hash)),
<dl class="row mt-4">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Address of the token contract") %>
<%= gettext("Contract") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9 contract-address">
<%= link(
@token.contract_address_hash,
to: AccessHelpers.get_path(@conn, :address_path, :show,
Address.checksum(@token.contract_address_hash)),
"data-test": "token_contract_address"
do %>
<%= gettext "View Contract" %>
<% end %>
</span>
<div class="d-flex flex-row justify-content-start text-muted">
<span class="mr-4"> <%= @token.type %> </span>
<span token-holder-count class="mr-4"></span>
<span token-transfer-count class="mr-4"></span>
<%= if decimals?(@token) do %>
<span class="mr-4"><%= @token.decimals %> <%= gettext "Decimals" %></span>
<% end %>
</div>
</div>
</div>
</div>
</div>
<%= if total_supply?(@token) do %>
<div class="card-section col-md-12 col-lg-4 pl-0-md js-ad-dependant-mb-2">
<div class="card card-background-1">
<div class="card-body">
<h2 class="card-title balance-card-title"><%= gettext "Total Supply" %></h2>
<div class="text-right">
<h3 class="text-uppercase">
)
%>
</dd>
</dl>
<%= if total_supply?(@token) do %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The total amount of tokens issued") %>
<%= gettext("Total supply") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<%= if decimals?(@token) do %>
<%= format_according_to_decimals(@token.total_supply, @token.decimals) %>
<% else %>
<%= format_integer_to_currency(@token.total_supply) %>
<% end %> <%= @token.symbol %>
</h3>
<%= if @token.usd_value do %>
<div class="text-uppercase">
</dd>
</dl>
<%= if @token.usd_value do %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Total Supply * Price") %>
<%= gettext("Market Cap") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<span data-selector="token-supply-usd" data-usd-value="<%= total_supply_usd(@token) %>"></span>
<%= unless Map.has_key?(@token, :custom_cap) && @token.custom_cap do %>
|
<span data-selector="token-price" data-token-usd-value="<%= @token.usd_value %>"></span>
<% end %>
</div>
<% else %>
<br />
<% end %>
</div>
</div>
</dd>
</dl>
<%= unless Map.has_key?(@token, :custom_cap) && @token.custom_cap do %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Price per token on the exchanges") %>
<%= gettext("Price") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<span data-selector="token-price" data-usd-value="<%= @token.usd_value %>"></span>
</dd>
</dl>
<% end %>
<% end %>
<% end %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Number of accounts holding the token") %>
<%= gettext("Holders") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<% link = if @conn.request_path |> String.contains?("/token-holders"), do: "", else: AccessHelpers.get_path(@conn, :token_holder_path, :index, @token.contract_address_hash) %>
<a href="<%= link %>#holders" class="page-link bs-label large btn-no-border-link-to-tems" token-holder-count><%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Fetching holders...") %></a>
</dd>
</dl>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Number of transfers for the token") %>
<%= gettext("Transfers") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<% link = if @conn.request_path |> String.contains?("/token-transfers"), do: "", else: AccessHelpers.get_path(@conn, :token_transfer_path, :index, @token.contract_address_hash) %>
<a href="<%= link %>#transfers" class="page-link bs-label large btn-no-border-link-to-tems" token-transfer-count><%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Fetching transfers...") %></a>
</dd>
</dl>
<%= if decimals?(@token) do %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Number of digits that come after the decimal place when displaying token value") %>
<%= gettext("Decimals") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<%= @token.decimals %>
</dd>
</dl>
<% end %>
<dl class="row">
<dt class="col-sm-4 col-md-4 col-lg-3 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Type of the token standard") %>
<%= gettext("Token type") %>
</dt>
<dd class="col-sm-8 col-md-8 col-lg-9">
<%= @token.type %>
</dd>
</dl>
</div>
</div>
</div>
<% end %>
</div>
</section>
<!-- Modal QR -->
<%= render BlockScoutWeb.CommonComponentsView, "_modal_qr_code.html", qr_code: BlockScoutWeb.AddressView.qr_code(Address.checksum(@token.contract_address_hash)), title: @token.contract_address %>

@ -1,3 +1,5 @@
<% address_hash = Address.checksum(@token.contract_address_hash) %>
<% is_proxy = BlockScoutWeb.Tokens.OverviewView.smart_contract_is_proxy?(@token) %>
<div class="card-tabs js-card-tabs">
<%= link(
gettext("Token Transfers"),
@ -9,22 +11,43 @@
gettext("Token Holders"),
class: "card-tab #{tab_status("token-holders", @conn.request_path)}",
"data-test": "token_holders_tab",
to: AccessHelpers.get_path(@conn, :token_holder_path, :index, Address.checksum(@token.contract_address_hash))
to: AccessHelpers.get_path(@conn, :token_holder_path, :index, address_hash)
)
%>
<%= if display_inventory?(@token) do %>
<%= link(
gettext("Inventory"),
class: "card-tab #{tab_status("inventory", @conn.request_path)}",
to: AccessHelpers.get_path(@conn, :token_inventory_path, :index, Address.checksum(@token.contract_address_hash))
to: AccessHelpers.get_path(@conn, :token_inventory_path, :index, address_hash)
)
%>
<% end %>
<%= if smart_contract_with_read_only_functions?(@token) do %>
<%= link(
gettext("Read Contract"),
to: AccessHelpers.get_path(@conn, :token_read_contract_path, :index, Address.checksum(@token.contract_address_hash)),
to: AccessHelpers.get_path(@conn, :token_read_contract_path, :index, address_hash),
class: "card-tab #{tab_status("read-contract", @conn.request_path)}")
%>
<% end %>
<%= if smart_contract_with_write_functions?(@token) do %>
<%= link(
gettext("Write Contract"),
to: AccessHelpers.get_path(@conn, :token_write_contract_path, :index, address_hash),
class: "card-tab #{tab_status("write-contract", @conn.request_path)}")
%>
<% end %>
<%= if is_proxy do %>
<%= link(
gettext("Read Proxy"),
to: AccessHelpers.get_path(@conn, :token_read_proxy_path, :index, address_hash),
class: "card-tab #{tab_status("read-proxy", @conn.request_path)}")
%>
<% end %>
<%= if smart_contract_with_write_functions?(@token) && is_proxy do %>
<%= link(
gettext("Write Proxy"),
to: AccessHelpers.get_path(@conn, :token_write_proxy_path, :index, address_hash),
class: "card-tab #{tab_status("write-proxy", @conn.request_path)}")
%>
<% end %>
</div>

@ -7,7 +7,7 @@
conn: @conn
) %>
<section data-page="token-transfer-list">
<section data-page="token-transfer-list" id="transfers">
<div class="card">
<%= render OverviewView, "_tabs.html", assigns %>
<div class="card-body" data-async-load data-async-listing="<%= @current_path %>">

@ -1,4 +1,4 @@
defmodule BlockScoutWeb.Tokens.ReadContractView do
defmodule BlockScoutWeb.Tokens.ContractView do
use BlockScoutWeb, :view
alias BlockScoutWeb.Tokens.OverviewView

@ -3,7 +3,7 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
alias Explorer.{Chain, CustomContractsHelpers}
alias Explorer.Chain.{Address, SmartContract, Token}
alias Explorer.SmartContract.Helper
alias Explorer.SmartContract.{Helper, Writer}
alias BlockScoutWeb.{AccessHelpers, CurrencyHelpers, LayoutView}
@ -55,6 +55,23 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
def smart_contract_with_read_only_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false
def smart_contract_is_proxy?(%Token{contract_address: %Address{smart_contract: %SmartContract{}} = address}) do
Chain.proxy_contract?(address.hash, address.smart_contract.abi)
end
def smart_contract_is_proxy?(%Token{contract_address: %Address{smart_contract: nil}}), do: false
def smart_contract_with_write_functions?(%Token{
contract_address: %Address{smart_contract: %SmartContract{}} = address
}) do
Enum.any?(
address.smart_contract.abi,
&Writer.write_function?(&1)
)
end
def smart_contract_with_write_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false
@doc """
Get the total value of the token supply in USD.
"""

@ -236,11 +236,32 @@ defmodule BlockScoutWeb.WebRouter do
resources(
"/read-contract",
Tokens.ReadContractController,
Tokens.ContractController,
only: [:index],
as: :read_contract
)
resources(
"/write-contract",
Tokens.ContractController,
only: [:index],
as: :write_contract
)
resources(
"/read-proxy",
Tokens.ContractController,
only: [:index],
as: :read_proxy
)
resources(
"/write-proxy",
Tokens.ContractController,
only: [:index],
as: :write_proxy
)
resources(
"/token-holders",
Tokens.HolderController,
@ -294,11 +315,32 @@ defmodule BlockScoutWeb.WebRouter do
resources(
"/read-contract",
Tokens.ReadContractController,
Tokens.ContractController,
only: [:index],
as: :read_contract
)
resources(
"/write-contract",
Tokens.ContractController,
only: [:index],
as: :write_contract
)
resources(
"/read-proxy",
Tokens.ContractController,
only: [:index],
as: :read_proxy
)
resources(
"/write-proxy",
Tokens.ContractController,
only: [:index],
as: :write_proxy
)
resources(
"/token-holders",
Tokens.HolderController,

@ -638,6 +638,7 @@ msgid "Constructor Arguments"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:66
#: lib/block_scout_web/templates/transaction/overview.html.eex:223
msgid "Contract"
msgstr ""
@ -893,7 +894,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:145
msgid "Decimals"
msgstr ""
@ -1177,7 +1178,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:238
#: lib/block_scout_web/templates/address/overview.html.eex:246
#: lib/block_scout_web/templates/address/overview.html.eex:246 lib/block_scout_web/templates/tokens/overview/_details.html.eex:137
msgid "Fetching transfers..."
msgstr ""
@ -1370,7 +1371,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:15
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:17 lib/block_scout_web/views/tokens/overview_view.ex:44
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 lib/block_scout_web/views/tokens/overview_view.ex:44
msgid "Inventory"
msgstr ""
@ -1464,7 +1465,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:54
#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:79 lib/block_scout_web/templates/address_read_contract/index.html.eex:12
#: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 lib/block_scout_web/templates/address_write_contract/index.html.eex:12
#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 lib/block_scout_web/templates/tokens/read_contract/index.html.eex:16
#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 lib/block_scout_web/templates/tokens/contract/index.html.eex:16
msgid "Loading..."
msgstr ""
@ -1503,7 +1504,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:61
#: lib/block_scout_web/templates/layout/app.html.eex:43 lib/block_scout_web/views/address_view.ex:142
#: lib/block_scout_web/templates/layout/app.html.eex:43 lib/block_scout_web/templates/tokens/overview/_details.html.eex:98
#: lib/block_scout_web/views/address_view.ex:142
msgid "Market Cap"
msgstr ""
@ -1847,7 +1849,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:41
#: lib/block_scout_web/templates/layout/app.html.eex:44
#: lib/block_scout_web/templates/layout/app.html.eex:44 lib/block_scout_web/templates/tokens/overview/_details.html.eex:109
msgid "Price"
msgstr ""
@ -1896,14 +1898,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:43
msgid "Read Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:88
#: lib/block_scout_web/views/address_view.ex:352
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:352
msgid "Read Proxy"
msgstr ""
@ -2565,7 +2567,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16
#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:9 lib/block_scout_web/views/tokens/overview_view.ex:42
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Token Holders"
msgstr ""
@ -2589,7 +2591,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:13
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
@ -2652,11 +2654,6 @@ msgstr ""
msgid "Total Difficulty"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:97
msgid "Total Supply"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:153
msgid "Total blocks"
@ -2767,7 +2764,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:230
#: lib/block_scout_web/templates/address/overview.html.eex:236 lib/block_scout_web/templates/address/overview.html.eex:244
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 lib/block_scout_web/templates/tokens/overview/_details.html.eex:133
msgid "Transfers"
msgstr ""
@ -2981,7 +2978,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 lib/block_scout_web/templates/tokens/overview/_details.html.eex:77
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20
msgid "View Contract"
msgstr ""
@ -3077,13 +3074,13 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:95
#: lib/block_scout_web/views/address_view.ex:353
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:353
msgid "Write Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:102
#: lib/block_scout_web/views/address_view.ex:354
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:354
msgid "Write Proxy"
msgstr ""
@ -3283,3 +3280,63 @@ msgstr ""
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:18
msgid "validator"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:65
msgid "Address of the token contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:126
msgid "Fetching holders..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:122
msgid "Holders"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:121
msgid "Number of accounts holding the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:144
msgid "Number of digits that come after the decimal place when displaying token value"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:132
msgid "Number of transfers for the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108
msgid "Price per token on the exchanges"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82
msgid "The total amount of tokens issued"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:156
msgid "Token type"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:97
msgid "Total Supply * Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:83
msgid "Total supply"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:155
msgid "Type of the token standard"
msgstr ""

@ -638,6 +638,7 @@ msgid "Constructor Arguments"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:66
#: lib/block_scout_web/templates/transaction/overview.html.eex:223
msgid "Contract"
msgstr ""
@ -893,7 +894,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:52
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:85
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:145
msgid "Decimals"
msgstr ""
@ -1177,7 +1178,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:238
#: lib/block_scout_web/templates/address/overview.html.eex:246
#: lib/block_scout_web/templates/address/overview.html.eex:246 lib/block_scout_web/templates/tokens/overview/_details.html.eex:137
msgid "Fetching transfers..."
msgstr ""
@ -1370,7 +1371,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/inventory/index.html.eex:15
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:17 lib/block_scout_web/views/tokens/overview_view.ex:44
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:19 lib/block_scout_web/views/tokens/overview_view.ex:44
msgid "Inventory"
msgstr ""
@ -1464,7 +1465,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:54
#: lib/block_scout_web/templates/address_contract_verification_vyper/new.html.eex:79 lib/block_scout_web/templates/address_read_contract/index.html.eex:12
#: lib/block_scout_web/templates/address_read_proxy/index.html.eex:12 lib/block_scout_web/templates/address_write_contract/index.html.eex:12
#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 lib/block_scout_web/templates/tokens/read_contract/index.html.eex:16
#: lib/block_scout_web/templates/address_write_proxy/index.html.eex:12 lib/block_scout_web/templates/tokens/contract/index.html.eex:16
msgid "Loading..."
msgstr ""
@ -1503,7 +1504,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:61
#: lib/block_scout_web/templates/layout/app.html.eex:43 lib/block_scout_web/views/address_view.ex:142
#: lib/block_scout_web/templates/layout/app.html.eex:43 lib/block_scout_web/templates/tokens/overview/_details.html.eex:98
#: lib/block_scout_web/views/address_view.ex:142
msgid "Market Cap"
msgstr ""
@ -1847,7 +1849,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:41
#: lib/block_scout_web/templates/layout/app.html.eex:44
#: lib/block_scout_web/templates/layout/app.html.eex:44 lib/block_scout_web/templates/tokens/overview/_details.html.eex:109
msgid "Price"
msgstr ""
@ -1896,14 +1898,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/tokens/overview_view.ex:43
msgid "Read Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:88
#: lib/block_scout_web/views/address_view.ex:352
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:352
msgid "Read Proxy"
msgstr ""
@ -2565,7 +2567,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:16
#: lib/block_scout_web/templates/tokens/instance/holder/index.html.eex:16 lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:17
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:9 lib/block_scout_web/views/tokens/overview_view.ex:42
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:11 lib/block_scout_web/views/tokens/overview_view.ex:42
msgid "Token Holders"
msgstr ""
@ -2589,7 +2591,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:13
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:5
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
@ -2652,11 +2654,6 @@ msgstr ""
msgid "Total Difficulty"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:97
msgid "Total Supply"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:153
msgid "Total blocks"
@ -2767,7 +2764,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:230
#: lib/block_scout_web/templates/address/overview.html.eex:236 lib/block_scout_web/templates/address/overview.html.eex:244
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:50 lib/block_scout_web/templates/tokens/overview/_details.html.eex:133
msgid "Transfers"
msgstr ""
@ -2981,7 +2978,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:16
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20 lib/block_scout_web/templates/tokens/overview/_details.html.eex:77
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:20
msgid "View Contract"
msgstr ""
@ -3077,13 +3074,13 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:95
#: lib/block_scout_web/views/address_view.ex:353
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:353
msgid "Write Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:102
#: lib/block_scout_web/views/address_view.ex:354
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:354
msgid "Write Proxy"
msgstr ""
@ -3283,3 +3280,63 @@ msgstr ""
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:18
msgid "validator"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:65
msgid "Address of the token contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:126
msgid "Fetching holders..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:122
msgid "Holders"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:121
msgid "Number of accounts holding the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:144
msgid "Number of digits that come after the decimal place when displaying token value"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:132
msgid "Number of transfers for the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:108
msgid "Price per token on the exchanges"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:82
msgid "The total amount of tokens issued"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:156
msgid "Token type"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:97
msgid "Total Supply * Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:83
msgid "Total supply"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:155
msgid "Type of the token standard"
msgstr ""

@ -1,6 +1,8 @@
defmodule BlockScoutWeb.Tokens.ReadContractControllerTest do
defmodule BlockScoutWeb.Tokens.ContractControllerTest do
use BlockScoutWeb.ConnCase, async: false
import Mox
describe "GET index/3" do
test "with invalid address hash", %{conn: conn} do
conn = get(conn, token_read_contract_path(BlockScoutWeb.Endpoint, :index, "invalid_address"))
@ -51,10 +53,40 @@ defmodule BlockScoutWeb.Tokens.ReadContractControllerTest do
token: token
)
get_eip1967_implementation()
conn = get(conn, token_read_contract_path(BlockScoutWeb.Endpoint, :index, token.contract_address_hash))
assert html_response(conn, 200)
assert token.contract_address_hash == conn.assigns.token.contract_address_hash
end
end
def get_eip1967_implementation do
EthereumJSONRPC.Mox
|> expect(:json_rpc, fn %{
id: 0,
method: "eth_getStorageAt",
params: [
_,
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
"latest"
]
},
_options ->
{:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"}
end)
|> expect(:json_rpc, fn %{
id: 0,
method: "eth_getStorageAt",
params: [
_,
"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50",
"latest"
]
},
_options ->
{:ok, "0x0000000000000000000000000000000000000000000000000000000000000000"}
end)
end
end

Loading…
Cancel
Save