diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa5c3c7fd..557055970d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- [#7952](https://github.com/blockscout/blockscout/pull/7952) - Add parsing constructor arguments for sourcify contracts - [#6190](https://github.com/blockscout/blockscout/pull/6190) - Add EIP-1559 support to gas price oracle - [#7977](https://github.com/blockscout/blockscout/pull/7977) - GraphQL: extend schema with new field for existing objects 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 658acfd417..77c96739cb 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 @@ -43,7 +43,7 @@ <% end %> <%= if smart_contract_verified || (!smart_contract_verified && metadata_for_verification) do %> <% target_contract = if smart_contract_verified, do: @address.smart_contract, else: metadata_for_verification %> - <%= if @address.smart_contract.partially_verified && smart_contract_verified do %> + <%= if @address.smart_contract.verified_via_sourcify && @address.smart_contract.partially_verified && smart_contract_verified do %>
<%= gettext("This contract has been partially verified via Sourcify.") %> <% else %> diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index e2ed916029..4861fe6103 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -1938,7 +1938,8 @@ defmodule Explorer.Chain do end defp check_and_update_constructor_args( - %SmartContract{address_hash: address_hash, constructor_arguments: nil} = smart_contract + %SmartContract{address_hash: address_hash, constructor_arguments: nil, verified_via_sourcify: true} = + smart_contract ) do if args = Verifier.parse_constructor_arguments_for_sourcify_contract(address_hash, smart_contract.abi) do smart_contract |> SmartContract.changeset(%{constructor_arguments: args}) |> Repo.update() @@ -1952,7 +1953,7 @@ defmodule Explorer.Chain do %Address{ hash: address_hash, contract_code: deployed_bytecode, - smart_contract: %SmartContract{constructor_arguments: nil} = smart_contract + smart_contract: %SmartContract{constructor_arguments: nil, verified_via_sourcify: true} = smart_contract } = address ) do if args =