Contract names display improvement

pull/5268/head
nikitosing 3 years ago committed by Viktor Baranov
parent 403e118c39
commit 7fc7c6c16c
  1. 1
      CHANGELOG.md
  2. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex
  3. 3
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex
  4. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  5. 5
      apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex
  6. 4
      apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex
  7. 5
      apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex
  8. 5
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex
  9. 5
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex
  10. 4
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex
  11. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex
  12. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex
  13. 5
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  14. 70
      apps/block_scout_web/priv/gettext/default.pot
  15. 70
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  16. 48
      apps/explorer/lib/explorer/chain.ex
  17. 11
      apps/explorer/lib/explorer/chain/smart_contract.ex
  18. 9
      apps/explorer/priv/repo/migrations/20220306091504_add_implementation_name.exs

@ -1,6 +1,7 @@
## Current
### Features
- [#5268](https://github.com/blockscout/blockscout/pull/5268) - Contract names display improvement
### Fixes
- [#5269](https://github.com/blockscout/blockscout/pull/5269) - Address Page: Fix implementation address align

@ -16,14 +16,18 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash, [], false),
{:ok, address} <-
Chain.hash_to_address(address_hash, [necessity_by_association: %{:smart_contract => :optional}], false),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
full_options =
[
necessity_by_association: %{
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional
[to_address: :names] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
]
|> Keyword.merge(paging_options(params))

@ -16,6 +16,9 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional,
[token_transfers: :token] => :optional,
[token_transfers: :to_address] => :optional,
[token_transfers: :from_address] => :optional,

@ -26,7 +26,10 @@ defmodule BlockScoutWeb.AddressTransactionController do
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional,
:block => :optional
:block => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
]
@ -34,7 +37,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
@burn_address_hash burn_address_hash
def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"} = params) do
address_options = [necessity_by_association: %{:names => :optional}]
address_options = [necessity_by_association: %{:names => :optional, :smart_contract => :optional}]
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash, address_options, false),

@ -23,7 +23,10 @@ defmodule BlockScoutWeb.BlockTransactionController do
:block => :optional,
[created_contract_address: :names] => :optional,
[from_address: :names] => :required,
[to_address: :names] => :optional
[to_address: :names] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
],
put_key_value_to_paging_options(paging_options(params), :is_index_in_asc_order, true)

@ -17,7 +17,9 @@ defmodule BlockScoutWeb.PendingTransactionController do
necessity_by_association: %{
[from_address: :names] => :optional,
[to_address: :names] => :optional,
[created_contract_address: :names] => :optional
[created_contract_address: :names] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
],
paging_options(params)

@ -16,7 +16,10 @@ defmodule BlockScoutWeb.RecentTransactionsController do
:block => :required,
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional
[to_address: :names] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
},
paging_options: %PagingOptions{page_size: 5}
)

@ -22,7 +22,10 @@ defmodule BlockScoutWeb.TransactionController do
:block => :required,
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional
[to_address: :names] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
]

@ -21,7 +21,10 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do
[created_contract_address: :names] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional,
[transaction: :block] => :optional
[transaction: :block] => :optional,
[created_contract_address: :smart_contract] => :optional,
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional
}
],
paging_options(params)

@ -25,6 +25,10 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do
Keyword.merge(
[
necessity_by_association: %{
[from_address: :smart_contract] => :optional,
[to_address: :smart_contract] => :optional,
[from_address: :names] => :optional,
[to_address: :names] => :optional,
from_address: :required,
to_address: :required,
token: :required

@ -1,6 +1,6 @@
<%= if @address do %>
<%= if assigns[:show_full_hash] do %>
<%= if name = primary_name(@address) do %>
<%= if name = implementation_name(@address) || primary_name(@address) do %>
<span><%= name %> |
<% end %>
<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @address), "data-test": "address_hash_link", class: assigns[:class] do %>

@ -1,5 +1,5 @@
<span class="<%= if @contract do %>contract-address<% end %>" data-address-hash="<%= @address %>">
<%= if name = primary_name(@address) do %>
<%= if name = implementation_name(@address) || primary_name(@address) do %>
<%= if assigns[:no_tooltip] do %>
<%= if @use_custom_tooltip == true do %>
<span><%= name %> (<%= short_hash(@address) %>...)</span>

@ -191,6 +191,11 @@ defmodule BlockScoutWeb.AddressView do
def primary_name(%Address{names: _}), do: nil
def implementation_name(%Address{smart_contract: %{implementation_name: implementation_name}}),
do: implementation_name
def implementation_name(_), do: nil
def primary_validator_metadata(%Address{names: [_ | _] = address_names}) do
case Enum.find(address_names, &(&1.primary == true)) do
%Address.Name{

@ -200,7 +200,7 @@ msgid "Address (external or contract) sending the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:166
#: lib/block_scout_web/templates/address/overview.html.eex:165
msgid "Address balance in xDAI (doesn't include ERC20, ERC721, ERC1155 tokens)."
msgstr ""
@ -239,7 +239,7 @@ msgid "All pool participant addresses. The top address belongs to the %{pool_typ
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:191
#: lib/block_scout_web/templates/address/overview.html.eex:190
msgid "All tokens in the account and total value."
msgstr ""
@ -306,7 +306,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:4
#: lib/block_scout_web/templates/address/overview.html.eex:167 lib/block_scout_web/templates/address_token/overview.html.eex:51
#: lib/block_scout_web/templates/address/overview.html.eex:166 lib/block_scout_web/templates/address_token/overview.html.eex:51
#: lib/block_scout_web/templates/stakes/_stakes_stats_item_account.html.eex:42 lib/block_scout_web/templates/stakes/_stakes_stats_item_account.html.eex:43
msgid "Balance"
msgstr ""
@ -407,7 +407,7 @@ msgid "Block number containing the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:274
#: lib/block_scout_web/templates/address/overview.html.eex:273
msgid "Block number in which the address was updated."
msgstr ""
@ -429,8 +429,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:48
#: lib/block_scout_web/templates/address/overview.html.eex:291 lib/block_scout_web/templates/address_validation/index.html.eex:11
#: lib/block_scout_web/views/address_view.ex:360
#: lib/block_scout_web/templates/address/overview.html.eex:290 lib/block_scout_web/templates/address_validation/index.html.eex:11
#: lib/block_scout_web/views/address_view.ex:365
msgid "Blocks Validated"
msgstr ""
@ -569,13 +569,13 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:353
#: lib/block_scout_web/views/address_view.ex:358
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:34
#: lib/block_scout_web/views/address_view.ex:359
#: lib/block_scout_web/views/address_view.ex:364
msgid "Coin Balance History"
msgstr ""
@ -910,7 +910,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:354
#: lib/block_scout_web/views/address_view.ex:359
msgid "Decompiled Code"
msgstr ""
@ -1111,7 +1111,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:18
#: lib/block_scout_web/templates/address/index.html.eex:5 lib/block_scout_web/templates/address/overview.html.eex:180
#: lib/block_scout_web/templates/address/index.html.eex:5 lib/block_scout_web/templates/address/overview.html.eex:179
#: 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:89 lib/block_scout_web/templates/layout/_topnav.html.eex:110
#: lib/block_scout_web/templates/layout/app.html.eex:51 lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
@ -1164,7 +1164,7 @@ msgid "Favorites"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:264
#: lib/block_scout_web/templates/address/overview.html.eex:263
msgid "Fetching gas used..."
msgstr ""
@ -1180,14 +1180,14 @@ msgid "Fetching tokens..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:211
#: lib/block_scout_web/templates/address/overview.html.eex:219
#: lib/block_scout_web/templates/address/overview.html.eex:210
#: lib/block_scout_web/templates/address/overview.html.eex:218
msgid "Fetching transactions..."
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/tokens/overview/_details.html.eex:137
#: lib/block_scout_web/templates/address/overview.html.eex:237
#: lib/block_scout_web/templates/address/overview.html.eex:245 lib/block_scout_web/templates/tokens/overview/_details.html.eex:137
msgid "Fetching transfers..."
msgstr ""
@ -1231,7 +1231,7 @@ msgid "Gas Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:257
#: lib/block_scout_web/templates/address/overview.html.eex:256
#: lib/block_scout_web/templates/block/_tile.html.eex:73 lib/block_scout_web/templates/block/overview.html.eex:178
msgid "Gas Used"
msgstr ""
@ -1242,7 +1242,7 @@ msgid "Gas Used by Transaction"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:256
#: lib/block_scout_web/templates/address/overview.html.eex:255
msgid "Gas used by the address."
msgstr ""
@ -1377,7 +1377,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:28
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 lib/block_scout_web/views/address_view.ex:350
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:512
msgid "Internal Transactions"
msgstr ""
@ -1409,7 +1409,7 @@ msgid "JSON RPC error"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:275
#: lib/block_scout_web/templates/address/overview.html.eex:274
msgid "Last Balance Update"
msgstr ""
@ -1492,7 +1492,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:41
#: lib/block_scout_web/templates/address_logs/index.html.eex:10 lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 lib/block_scout_web/views/address_view.ex:361
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 lib/block_scout_web/views/address_view.ex:366
#: lib/block_scout_web/views/transaction_view.ex:513
msgid "Logs"
msgstr ""
@ -1712,7 +1712,7 @@ msgid "Number of accounts holding the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:290
#: lib/block_scout_web/templates/address/overview.html.eex:289
msgid "Number of blocks validated by this validator."
msgstr ""
@ -1722,7 +1722,7 @@ msgid "Number of digits that come after the decimal place when displaying token
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:202
#: lib/block_scout_web/templates/address/overview.html.eex:201
msgid "Number of transactions related to this address."
msgstr ""
@ -1732,7 +1732,7 @@ msgid "Number of transfers for the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:229
#: lib/block_scout_web/templates/address/overview.html.eex:228
msgid "Number of transfers to/from this address."
msgstr ""
@ -1933,14 +1933,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:360
#: 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/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:356
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:361
msgid "Read Proxy"
msgstr ""
@ -2628,7 +2628,7 @@ msgstr ""
#: 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: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:352
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:511
msgid "Token Transfers"
@ -2646,10 +2646,10 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:21
#: lib/block_scout_web/templates/address/overview.html.eex:192 lib/block_scout_web/templates/address_token/overview.html.eex:58
#: lib/block_scout_web/templates/address/overview.html.eex:191 lib/block_scout_web/templates/address_token/overview.html.eex:58
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 lib/block_scout_web/templates/layout/_topnav.html.eex:69
#: lib/block_scout_web/templates/layout/_topnav.html.eex:101 lib/block_scout_web/templates/tokens/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:349
#: lib/block_scout_web/views/address_view.ex:354
msgid "Tokens"
msgstr ""
@ -2793,11 +2793,11 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:7
#: lib/block_scout_web/templates/address/overview.html.eex:203 lib/block_scout_web/templates/address/overview.html.eex:209
#: lib/block_scout_web/templates/address/overview.html.eex:217 lib/block_scout_web/templates/address_transaction/index.html.eex:13
#: lib/block_scout_web/templates/address/overview.html.eex:202 lib/block_scout_web/templates/address/overview.html.eex:208
#: lib/block_scout_web/templates/address/overview.html.eex:216 lib/block_scout_web/templates/address_transaction/index.html.eex:13
#: lib/block_scout_web/templates/block/overview.html.eex:80 lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/chain/show.html.eex:236 lib/block_scout_web/templates/layout/_topnav.html.eex:43
#: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/address_view.ex:356
msgid "Transactions"
msgstr ""
@ -2812,8 +2812,8 @@ msgid "Transactions sent"
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/address/overview.html.eex:229
#: lib/block_scout_web/templates/address/overview.html.eex:235 lib/block_scout_web/templates/address/overview.html.eex:243
#: 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 ""
@ -3139,13 +3139,13 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:95
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:362
msgid "Write Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:358
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:363
msgid "Write Proxy"
msgstr ""

@ -200,7 +200,7 @@ msgid "Address (external or contract) sending the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:166
#: lib/block_scout_web/templates/address/overview.html.eex:165
msgid "Address balance in xDAI (doesn't include ERC20, ERC721, ERC1155 tokens)."
msgstr ""
@ -239,7 +239,7 @@ msgid "All pool participant addresses. The top address belongs to the %{pool_typ
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:191
#: lib/block_scout_web/templates/address/overview.html.eex:190
msgid "All tokens in the account and total value."
msgstr ""
@ -306,7 +306,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:4
#: lib/block_scout_web/templates/address/overview.html.eex:167 lib/block_scout_web/templates/address_token/overview.html.eex:51
#: lib/block_scout_web/templates/address/overview.html.eex:166 lib/block_scout_web/templates/address_token/overview.html.eex:51
#: lib/block_scout_web/templates/stakes/_stakes_stats_item_account.html.eex:42 lib/block_scout_web/templates/stakes/_stakes_stats_item_account.html.eex:43
msgid "Balance"
msgstr ""
@ -407,7 +407,7 @@ msgid "Block number containing the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:274
#: lib/block_scout_web/templates/address/overview.html.eex:273
msgid "Block number in which the address was updated."
msgstr ""
@ -429,8 +429,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:48
#: lib/block_scout_web/templates/address/overview.html.eex:291 lib/block_scout_web/templates/address_validation/index.html.eex:11
#: lib/block_scout_web/views/address_view.ex:360
#: lib/block_scout_web/templates/address/overview.html.eex:290 lib/block_scout_web/templates/address_validation/index.html.eex:11
#: lib/block_scout_web/views/address_view.ex:365
msgid "Blocks Validated"
msgstr ""
@ -569,13 +569,13 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126 lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:353
#: lib/block_scout_web/views/address_view.ex:358
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:34
#: lib/block_scout_web/views/address_view.ex:359
#: lib/block_scout_web/views/address_view.ex:364
msgid "Coin Balance History"
msgstr ""
@ -910,7 +910,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:354
#: lib/block_scout_web/views/address_view.ex:359
msgid "Decompiled Code"
msgstr ""
@ -1111,7 +1111,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:18
#: lib/block_scout_web/templates/address/index.html.eex:5 lib/block_scout_web/templates/address/overview.html.eex:180
#: lib/block_scout_web/templates/address/index.html.eex:5 lib/block_scout_web/templates/address/overview.html.eex:179
#: 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:89 lib/block_scout_web/templates/layout/_topnav.html.eex:110
#: lib/block_scout_web/templates/layout/app.html.eex:51 lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
@ -1164,7 +1164,7 @@ msgid "Favorites"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:264
#: lib/block_scout_web/templates/address/overview.html.eex:263
msgid "Fetching gas used..."
msgstr ""
@ -1180,14 +1180,14 @@ msgid "Fetching tokens..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:211
#: lib/block_scout_web/templates/address/overview.html.eex:219
#: lib/block_scout_web/templates/address/overview.html.eex:210
#: lib/block_scout_web/templates/address/overview.html.eex:218
msgid "Fetching transactions..."
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/tokens/overview/_details.html.eex:137
#: lib/block_scout_web/templates/address/overview.html.eex:237
#: lib/block_scout_web/templates/address/overview.html.eex:245 lib/block_scout_web/templates/tokens/overview/_details.html.eex:137
msgid "Fetching transfers..."
msgstr ""
@ -1231,7 +1231,7 @@ msgid "Gas Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:257
#: lib/block_scout_web/templates/address/overview.html.eex:256
#: lib/block_scout_web/templates/block/_tile.html.eex:73 lib/block_scout_web/templates/block/overview.html.eex:178
msgid "Gas Used"
msgstr ""
@ -1242,7 +1242,7 @@ msgid "Gas Used by Transaction"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:256
#: lib/block_scout_web/templates/address/overview.html.eex:255
msgid "Gas used by the address."
msgstr ""
@ -1377,7 +1377,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:28
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:17 lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 lib/block_scout_web/views/address_view.ex:350
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:512
msgid "Internal Transactions"
msgstr ""
@ -1409,7 +1409,7 @@ msgid "JSON RPC error"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:275
#: lib/block_scout_web/templates/address/overview.html.eex:274
msgid "Last Balance Update"
msgstr ""
@ -1492,7 +1492,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:41
#: lib/block_scout_web/templates/address_logs/index.html.eex:10 lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 lib/block_scout_web/views/address_view.ex:361
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 lib/block_scout_web/views/address_view.ex:366
#: lib/block_scout_web/views/transaction_view.ex:513
msgid "Logs"
msgstr ""
@ -1712,7 +1712,7 @@ msgid "Number of accounts holding the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:290
#: lib/block_scout_web/templates/address/overview.html.eex:289
msgid "Number of blocks validated by this validator."
msgstr ""
@ -1722,7 +1722,7 @@ msgid "Number of digits that come after the decimal place when displaying token
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:202
#: lib/block_scout_web/templates/address/overview.html.eex:201
msgid "Number of transactions related to this address."
msgstr ""
@ -1732,7 +1732,7 @@ msgid "Number of transfers for the token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:229
#: lib/block_scout_web/templates/address/overview.html.eex:228
msgid "Number of transfers to/from this address."
msgstr ""
@ -1933,14 +1933,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:81
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:27 lib/block_scout_web/views/address_view.ex:360
#: 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/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:356
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:41 lib/block_scout_web/views/address_view.ex:361
msgid "Read Proxy"
msgstr ""
@ -2628,7 +2628,7 @@ msgstr ""
#: 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: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:352
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:511
msgid "Token Transfers"
@ -2646,10 +2646,10 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:21
#: lib/block_scout_web/templates/address/overview.html.eex:192 lib/block_scout_web/templates/address_token/overview.html.eex:58
#: lib/block_scout_web/templates/address/overview.html.eex:191 lib/block_scout_web/templates/address_token/overview.html.eex:58
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:13 lib/block_scout_web/templates/layout/_topnav.html.eex:69
#: lib/block_scout_web/templates/layout/_topnav.html.eex:101 lib/block_scout_web/templates/tokens/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:349
#: lib/block_scout_web/views/address_view.ex:354
msgid "Tokens"
msgstr ""
@ -2793,11 +2793,11 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:7
#: lib/block_scout_web/templates/address/overview.html.eex:203 lib/block_scout_web/templates/address/overview.html.eex:209
#: lib/block_scout_web/templates/address/overview.html.eex:217 lib/block_scout_web/templates/address_transaction/index.html.eex:13
#: lib/block_scout_web/templates/address/overview.html.eex:202 lib/block_scout_web/templates/address/overview.html.eex:208
#: lib/block_scout_web/templates/address/overview.html.eex:216 lib/block_scout_web/templates/address_transaction/index.html.eex:13
#: lib/block_scout_web/templates/block/overview.html.eex:80 lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/chain/show.html.eex:236 lib/block_scout_web/templates/layout/_topnav.html.eex:43
#: lib/block_scout_web/views/address_view.ex:351
#: lib/block_scout_web/views/address_view.ex:356
msgid "Transactions"
msgstr ""
@ -2812,8 +2812,8 @@ msgid "Transactions sent"
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/address/overview.html.eex:229
#: lib/block_scout_web/templates/address/overview.html.eex:235 lib/block_scout_web/templates/address/overview.html.eex:243
#: 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 ""
@ -3139,13 +3139,13 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:95
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:357
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:34 lib/block_scout_web/views/address_view.ex:362
msgid "Write Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:358
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:48 lib/block_scout_web/views/address_view.ex:363
msgid "Write Proxy"
msgstr ""

@ -18,6 +18,7 @@ defmodule Explorer.Chain do
select: 3,
subquery: 1,
union: 2,
update: 2,
where: 2,
where: 3
]
@ -6770,6 +6771,7 @@ defmodule Explorer.Chain do
def gnosis_safe_contract?(abi) when is_nil(abi), do: false
@spec get_implementation_address_hash(Hash.Address.t(), list()) :: String.t() | nil
def get_implementation_address_hash(proxy_address_hash, abi)
when not is_nil(proxy_address_hash) and not is_nil(abi) do
implementation_method_abi =
@ -6784,16 +6786,19 @@ defmodule Explorer.Chain do
master_copy_pattern?(method)
end)
cond do
implementation_method_abi ->
get_implementation_address_hash_basic(proxy_address_hash, abi)
implementation_address =
cond do
implementation_method_abi ->
get_implementation_address_hash_basic(proxy_address_hash, abi)
master_copy_method_abi ->
get_implementation_address_hash_from_master_copy_pattern(proxy_address_hash)
master_copy_method_abi ->
get_implementation_address_hash_from_master_copy_pattern(proxy_address_hash)
true ->
get_implementation_address_hash_eip_1967(proxy_address_hash)
end
true ->
get_implementation_address_hash_eip_1967(proxy_address_hash)
end
save_implementation_name(implementation_address, proxy_address_hash)
end
def get_implementation_address_hash(proxy_address_hash, abi) when is_nil(proxy_address_hash) or is_nil(abi) do
@ -6924,6 +6929,33 @@ defmodule Explorer.Chain do
end)
end
defp save_implementation_name(empty_address_hash_string, _)
when empty_address_hash_string in [
"0x",
"0x0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
@burn_address_hash_str
],
do: empty_address_hash_string
defp save_implementation_name(implementation_address_hash_string, proxy_address_hash)
when is_binary(implementation_address_hash_string) do
with {:ok, address_hash} <- string_to_address_hash(implementation_address_hash_string),
%SmartContract{name: name} <- address_hash_to_smart_contract(address_hash) do
SmartContract
|> where([sc], sc.address_hash == ^proxy_address_hash)
|> update(set: [implementation_name: ^name])
|> Repo.update_all([])
implementation_address_hash_string
else
_ ->
implementation_address_hash_string
end
end
defp save_implementation_name(other, _), do: other
defp abi_decode_address_output(nil), do: nil
defp abi_decode_address_output("0x"), do: @burn_address_hash_str

@ -199,6 +199,7 @@ defmodule Explorer.Chain.SmartContract do
* `is_changed_bytecode` - boolean flag, determines if contract's bytecode was modified
* `bytecode_checked_at` - timestamp of the last check of contract's bytecode matching (DB and BlockChain)
* `contract_code_md5` - md5(`t:Explorer.Chain.Address.t/0` `contract_code`)
* `implementation_name` - name of the proxy implementation
"""
@type t :: %Explorer.Chain.SmartContract{
@ -216,7 +217,8 @@ defmodule Explorer.Chain.SmartContract do
is_vyper_contract: boolean | nil,
is_changed_bytecode: boolean,
bytecode_checked_at: DateTime.t(),
contract_code_md5: String.t()
contract_code_md5: String.t(),
implementation_name: String.t() | nil
}
schema "smart_contracts" do
@ -236,6 +238,7 @@ defmodule Explorer.Chain.SmartContract do
field(:is_changed_bytecode, :boolean, default: false)
field(:bytecode_checked_at, :utc_datetime_usec, default: DateTime.add(DateTime.utc_now(), -86400, :second))
field(:contract_code_md5, :string)
field(:implementation_name, :string)
has_many(
:decompiled_smart_contracts,
@ -276,7 +279,8 @@ defmodule Explorer.Chain.SmartContract do
:is_vyper_contract,
:is_changed_bytecode,
:bytecode_checked_at,
:contract_code_md5
:contract_code_md5,
:implementation_name
])
|> validate_required([
:name,
@ -315,7 +319,8 @@ defmodule Explorer.Chain.SmartContract do
:is_vyper_contract,
:is_changed_bytecode,
:bytecode_checked_at,
:contract_code_md5
:contract_code_md5,
:implementation_name
])
|> (&if(json_verification,
do: &1,

@ -0,0 +1,9 @@
defmodule Explorer.Repo.Migrations.AddImplementationName do
use Ecto.Migration
def change do
alter table(:smart_contracts) do
add(:implementation_name, :string, null: true)
end
end
end
Loading…
Cancel
Save