diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b207385d..a643888f17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#3173](https://github.com/poanetwork/blockscout/pull/3173) - Display implementation address at read/write proxy tabs - [#3171](https://github.com/poanetwork/blockscout/pull/3171) - Import accounts/contracts/balances from Geth genesis.json - [#3161](https://github.com/poanetwork/blockscout/pull/3161) - Write proxy contracts feature - [#3160](https://github.com/poanetwork/blockscout/pull/3160) - Write contracts feature diff --git a/apps/block_scout_web/assets/css/components/_card.scss b/apps/block_scout_web/assets/css/components/_card.scss index fee262ebd4..e25d436cdd 100644 --- a/apps/block_scout_web/assets/css/components/_card.scss +++ b/apps/block_scout_web/assets/css/components/_card.scss @@ -256,4 +256,13 @@ $card-tab-icon-color-active: #fff !default; @include media-breakpoint-down(sm) { margin-left: 15px!important; } +} + +.implementation-title { + float: left; + margin-right: 5px; +} + +.implementation-value { + line-height: 30px; } \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex index 604d8cab00..038a15d4de 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex @@ -40,6 +40,10 @@ defmodule BlockScoutWeb.SmartContractController do [] end + implementation_address_hash_string = + Chain.get_implementation_address_hash(address.hash, address.smart_contract.abi) || + "0x0000000000000000000000000000000000000000" + conn |> put_status(200) |> put_layout(false) @@ -48,6 +52,7 @@ defmodule BlockScoutWeb.SmartContractController do read_only_functions: functions, address: address, contract_abi: contract_abi, + implementation_address: implementation_address_hash_string, implementation_abi: implementation_abi, contract_type: contract_type ) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex index 9570f4a418..41c993cc29 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex @@ -1,3 +1,11 @@ +<%= if @contract_type == "proxy" do %> +
+

Implementation address:

<%= link( + @implementation_address, + to: address_path(@conn, :show, @implementation_address) + ) %>

+
+<% end %> <%= for {function, counter} <- Enum.with_index(@read_only_functions, 1) do %>
diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index da842aab61..c4a0a11936 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -568,8 +568,8 @@ msgid "ERC-721 " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:32 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:67 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:40 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:75 msgid "ETH" msgstr "" @@ -1195,7 +1195,7 @@ msgid "QR Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:36 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 msgid "Query" msgstr "" @@ -1649,7 +1649,7 @@ msgid "View transaction %{transaction} on %{subnetwork}" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:66 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:74 msgid "WEI" msgstr "" @@ -1937,7 +1937,7 @@ msgid "Waiting for transaction's confirmation..." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:36 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 msgid "Write" msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index da842aab61..c4a0a11936 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -568,8 +568,8 @@ msgid "ERC-721 " msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:32 -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:67 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:40 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:75 msgid "ETH" msgstr "" @@ -1195,7 +1195,7 @@ msgid "QR Code" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:36 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 msgid "Query" msgstr "" @@ -1649,7 +1649,7 @@ msgid "View transaction %{transaction} on %{subnetwork}" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:66 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:74 msgid "WEI" msgstr "" @@ -1937,7 +1937,7 @@ msgid "Waiting for transaction's confirmation..." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:36 +#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:44 msgid "Write" msgstr ""