diff --git a/.dialyzer-ignore b/.dialyzer-ignore index 7eba66f776..2f8d917196 100644 --- a/.dialyzer-ignore +++ b/.dialyzer-ignore @@ -23,7 +23,7 @@ lib/indexer/fetcher/token_total_supply_on_demand.ex:16 lib/explorer/exchange_rates/source.ex:110 lib/explorer/exchange_rates/source.ex:113 lib/explorer/smart_contract/verifier.ex:89 -lib/block_scout_web/templates/address_contract/index.html.eex:151 +lib/block_scout_web/templates/address_contract/index.html.eex:162 lib/explorer/staking/stake_snapshotting.ex:15: Function do_snapshotting/7 has no local return lib/explorer/staking/stake_snapshotting.ex:147 lib/explorer/third_party_integrations/sourcify.ex:65 diff --git a/CHANGELOG.md b/CHANGELOG.md index f873300ae4..2f54a6e9b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#4323](https://github.com/blockscout/blockscout/pull/4323) - Renamed Contract Byte Code, add Contract Creation Code on contract's page - [#4312](https://github.com/blockscout/blockscout/pull/4312) - Display pending transactions on address page - [#4299](https://github.com/blockscout/blockscout/pull/4299) - Added sourcify verification api endpoint - [#4267](https://github.com/blockscout/blockscout/pull/4267) - Extend verification through [Sourcify](https://sourcify.dev) smart-contract verification: fetch smart contract metadata from Sourcify repo if it has been already verified there diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex index 272beac456..66f95126f8 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex @@ -132,21 +132,32 @@
<%= transaction_init %>
<% {:ok, contract_code} -> %> + <%= if creation_code(@address) do %> +
+

<%= gettext "Contract Creation Code" %>

+ +
+
+
<%= creation_code(@address) %>
+
+ <% end %> <%= if smart_contract_verified do %>
-

<%= gettext "Contract Byte Code" %>

+

<%= gettext "Deployed ByteCode" %>

<% else %> -
+
-

<%= gettext "Contract Byte Code" %>

+

<%= gettext "Deployed ByteCode" %>

<%= if match?({:selfdestructed, _}, contract_creation_code) do %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex index 004c06f295..d66965004a 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex @@ -3,7 +3,7 @@ defmodule BlockScoutWeb.AddressContractView do alias ABI.{FunctionSelector, TypeDecoder} alias Explorer.Chain - alias Explorer.Chain.{Address, Data, InternalTransaction, SmartContract} + alias Explorer.Chain.{Address, Data, InternalTransaction, SmartContract, Transaction} def render("scripts.html", %{conn: conn}) do render_scripts(conn, "address_contract/code_highlighting.js") @@ -119,6 +119,14 @@ defmodule BlockScoutWeb.AddressContractView do {:ok, contract_code} end + def creation_code(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do + address.contracts_creation_internal_transaction.input + end + + def creation_code(%Address{contracts_creation_transaction: %Transaction{}} = address) do + address.contracts_creation_transaction.input + end + def sourcify_repo_url(address_hash) do checksummed_hash = Address.checksum(address_hash) chain_id = Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:chain_id] diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 11e110469b..a39dbbe09c 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -354,12 +354,6 @@ msgstr "" msgid "Contract Address Pending" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:137 -#: lib/block_scout_web/templates/address_contract/index.html.eex:145 -msgid "Contract Byte Code" -msgstr "" - #, elixir-format #: lib/block_scout_web/views/transaction_view.ex:351 msgid "Contract Call" @@ -372,6 +366,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:122 +#: lib/block_scout_web/templates/address_contract/index.html.eex:137 msgid "Contract Creation Code" msgstr "" @@ -422,6 +417,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:124 +#: lib/block_scout_web/templates/address_contract/index.html.eex:139 msgid "Copy Contract Creation Code" msgstr "" @@ -671,7 +667,7 @@ msgid "Nonce" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:186 +#: lib/block_scout_web/templates/address_contract/index.html.eex:197 msgid "External libraries" msgstr "" @@ -1580,8 +1576,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:24 -#: lib/block_scout_web/templates/address_contract/index.html.eex:153 -#: lib/block_scout_web/templates/address_contract/index.html.eex:165 +#: lib/block_scout_web/templates/address_contract/index.html.eex:164 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:19 msgid "Verify & Publish" msgstr "" @@ -1989,12 +1985,6 @@ msgstr "" msgid "Play" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:139 -#: lib/block_scout_web/templates/address_contract/index.html.eex:149 -msgid "Copy Byte Code" -msgstr "" - #: lib/block_scout_web/templates/stakes/_stakes_top.html.eex:6 msgid "%{blocks} block" msgid_plural "%{blocks} blocks" @@ -2018,17 +2008,6 @@ msgstr "" msgid "(inactive pool)" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/stakes/_stakes_modal_withdraw.html.eex:76 -msgid "

Pending stake (stake placed on a candidate pool or placed during the current staking epoch) may be withdrawn now.

\n

Active stake (stake available after the current epoch) can be ordered for withdrawal from the pool, and will be available to claim after the current staking epoch is complete.

\n

If you have already ordered (and the staking window is still open), you may increase your current order by entering a positive value, or decrease your current order by entering a negative value in the box and clicking 'Order Withdrawal'. You must either keep the minimum stake amount in the pool, or order your entire stake for withdrawal.

\n" -msgstr "" - -#, elixir-format -#: -#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36 -msgid "

To become a candidate, your staking address must be funded with %{tokenSymbol} tokens and %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.

\n

To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the Stake button next to the address to begin the process.

" -msgstr "" - #, elixir-format #: #: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:27 @@ -2801,3 +2780,26 @@ msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 msgid "Sourcify: Sources and metadata JSON file" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:150 +#: lib/block_scout_web/templates/address_contract/index.html.eex:160 +msgid "Copy Deployed ByteCode" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:148 +#: lib/block_scout_web/templates/address_contract/index.html.eex:156 +msgid "Deployed ByteCode" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/stakes/_stakes_modal_withdraw.html.eex:76 +msgid "

Pending stake (stake placed on a candidate pool or placed during the current staking epoch) may be withdrawn now.

\n

Active stake (stake available after the current epoch) can be ordered for withdrawal from the pool, and will be available to claim after the current staking epoch is complete.

\n

If you have already ordered (and the staking window is still open), you may increase your current order by entering a positive value, or decrease your current order by entering a negative value in the box and clicking 'Order Withdrawal'. You must either keep the minimum stake amount in the pool, or order your entire stake for withdrawal.

\n" +msgstr "" + +#, elixir-format +#: +#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36 +msgid "

To become a candidate, your staking address must be funded with %{tokenSymbol} tokens and %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.

\n

To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the Stake button next to the address to begin the process.

" +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 11e110469b..535db3156d 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 @@ -354,12 +354,6 @@ msgstr "" msgid "Contract Address Pending" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:137 -#: lib/block_scout_web/templates/address_contract/index.html.eex:145 -msgid "Contract Byte Code" -msgstr "" - #, elixir-format #: lib/block_scout_web/views/transaction_view.ex:351 msgid "Contract Call" @@ -372,6 +366,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:122 +#: lib/block_scout_web/templates/address_contract/index.html.eex:137 msgid "Contract Creation Code" msgstr "" @@ -422,6 +417,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:124 +#: lib/block_scout_web/templates/address_contract/index.html.eex:139 msgid "Copy Contract Creation Code" msgstr "" @@ -671,7 +667,7 @@ msgid "Nonce" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:186 +#: lib/block_scout_web/templates/address_contract/index.html.eex:197 msgid "External libraries" msgstr "" @@ -1580,8 +1576,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:24 -#: lib/block_scout_web/templates/address_contract/index.html.eex:153 -#: lib/block_scout_web/templates/address_contract/index.html.eex:165 +#: lib/block_scout_web/templates/address_contract/index.html.eex:164 +#: lib/block_scout_web/templates/address_contract/index.html.eex:176 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:19 msgid "Verify & Publish" msgstr "" @@ -1989,12 +1985,6 @@ msgstr "" msgid "Play" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_contract/index.html.eex:139 -#: lib/block_scout_web/templates/address_contract/index.html.eex:149 -msgid "Copy Byte Code" -msgstr "" - #: lib/block_scout_web/templates/stakes/_stakes_top.html.eex:6 msgid "%{blocks} block" msgid_plural "%{blocks} blocks" @@ -2018,17 +2008,6 @@ msgstr "" msgid "(inactive pool)" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/stakes/_stakes_modal_withdraw.html.eex:76 -msgid "

Pending stake (stake placed on a candidate pool or placed during the current staking epoch) may be withdrawn now.

\n

Active stake (stake available after the current epoch) can be ordered for withdrawal from the pool, and will be available to claim after the current staking epoch is complete.

\n

If you have already ordered (and the staking window is still open), you may increase your current order by entering a positive value, or decrease your current order by entering a negative value in the box and clicking 'Order Withdrawal'. You must either keep the minimum stake amount in the pool, or order your entire stake for withdrawal.

\n" -msgstr "" - -#, elixir-format -#: -#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36 -msgid "

To become a candidate, your staking address must be funded with %{tokenSymbol} tokens and %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.

\n

To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the Stake button next to the address to begin the process.

" -msgstr "" - #, elixir-format #: #: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:27 @@ -2801,3 +2780,26 @@ msgstr "" #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:40 msgid "Sourcify: Sources and metadata JSON file" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:150 +#: lib/block_scout_web/templates/address_contract/index.html.eex:160 +msgid "Copy Deployed ByteCode" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_contract/index.html.eex:148 +#: lib/block_scout_web/templates/address_contract/index.html.eex:156 +msgid "Deployed ByteCode" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/stakes/_stakes_modal_withdraw.html.eex:76 +msgid "

Pending stake (stake placed on a candidate pool or placed during the current staking epoch) may be withdrawn now.

\n

Active stake (stake available after the current epoch) can be ordered for withdrawal from the pool, and will be available to claim after the current staking epoch is complete.

\n

If you have already ordered (and the staking window is still open), you may increase your current order by entering a positive value, or decrease your current order by entering a negative value in the box and clicking 'Order Withdrawal'. You must either keep the minimum stake amount in the pool, or order your entire stake for withdrawal.

\n" +msgstr "" + +#, elixir-format, fuzzy +#: +#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36 +msgid "

To become a candidate, your staking address must be funded with %{tokenSymbol} tokens and %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.

\n

To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the Stake button next to the address to begin the process.

" +msgstr ""