Add support for yul verification via rust microservice

pull/6444/head
Viktor Baranov 2 years ago
parent d4013850df
commit 59ac2914e3
  1. 2
      .dialyzer-ignore
  2. 1
      CHANGELOG.md
  3. 26
      apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex
  4. 21
      apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex
  5. 4
      apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex
  6. 6
      apps/block_scout_web/lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex
  7. 1
      apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_flattened_code_view.ex
  8. 1
      apps/block_scout_web/lib/block_scout_web/views/address_contract_verification_via_multi_part_files_view.ex
  9. 2
      apps/block_scout_web/lib/block_scout_web/views/address_contract_view.ex
  10. 4
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  11. 2
      apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex
  12. 4
      apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex
  13. 92
      apps/block_scout_web/priv/gettext/default.pot
  14. 92
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  15. 10
      apps/explorer/lib/explorer/chain/smart_contract.ex
  16. 5
      apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex
  17. 8
      apps/explorer/lib/explorer/smart_contract/solidity/verifier.ex
  18. 7
      apps/explorer/priv/repo/migrations/20221114113853_remove_not_null_constraint_from_abi.exs

@ -22,7 +22,7 @@ lib/explorer/smart_contract/reader.ex:435
lib/indexer/fetcher/token_total_supply_on_demand.ex:16
lib/explorer/exchange_rates/source.ex:116
lib/explorer/exchange_rates/source.ex:119
lib/explorer/smart_contract/solidity/verifier.ex:310
lib/explorer/smart_contract/solidity/verifier.ex:316
lib/block_scout_web/templates/address_contract/index.html.eex:158
lib/block_scout_web/templates/address_contract/index.html.eex:195
lib/explorer/third_party_integrations/sourcify.ex:120

@ -2,6 +2,7 @@
### Features
- [#6444](https://github.com/blockscout/blockscout/pull/6444) - Add support for yul verification via rust microservice
- [#6440](https://github.com/blockscout/blockscout/pull/6440) - Add support for base64 encoded NFT metadata
- [#6407](https://github.com/blockscout/blockscout/pull/6407) - Indexed ratio for int txs fetching stage
- [#6324](https://github.com/blockscout/blockscout/pull/6324) - Add verified contracts list page

@ -117,18 +117,20 @@
</section>
<% end)%>
<section>
<div class="d-flex justify-content-between align-items-baseline">
<h3><%= gettext "Contract ABI" %></h3>
<button type="button" class="btn-line" id="button" data-clipboard-text="<%= format_smart_contract_abi(target_contract.abi) %>" aria-label="Copy Contract ABI">
<%= gettext "Copy ABI" %>
</button>
</div>
<div class="tile tile-muted mb-4">
<pre class="pre-wrap pre-scrollable"><code class="nohighlight"><%= format_smart_contract_abi(target_contract.abi) %></code>
</pre>
</div>
</section>
<%= if !is_nil(target_contract.abi) do %>>
<section>
<div class="d-flex justify-content-between align-items-baseline">
<h3><%= gettext "Contract ABI" %></h3>
<button type="button" class="btn-line" id="button" data-clipboard-text="<%= format_smart_contract_abi(target_contract.abi) %>" aria-label="Copy Contract ABI">
<%= gettext "Copy ABI" %>
</button>
</div>
<div class="tile tile-muted mb-4">
<pre class="pre-wrap pre-scrollable"><code class="nohighlight"><%= format_smart_contract_abi(target_contract.abi) %></code>
</pre>
</div>
</section>
<% end %>
<% end %>
<section>

@ -0,0 +1,21 @@
<div class="smart-contract-form-group">
<div class="smart-contract-form-group-inner-wrapper">
<%= label @f, "Is yul contract" %>
<div class="center-column">
<div class="form-radios-group">
<div class="radio-big">
<%= radio_button @f, :is_yul, false, class: "form-check-input autodetectfalse" %>
<div class="radio-icon"></div>
<%= label :is_yul, :false, gettext("No"), class: "radio-text" %>
</div>
<div class="radio-big">
<%= radio_button @f, :is_yul, true, class: "form-check-input autodetecttrue", "aria-describedby": "is_yul-help-block" %>
<div class="radio-icon"></div>
<%= label :is_yul, :true, gettext("Yes"), class: "radio-text" %>
</div>
</div>
<%= error_tag @f, :is_yul, id: "is_yul-help-block", class: "text-danger form-error" %>
</div>
<div class="smart-contract-form-group-tooltip"><%= gettext("Select Yes if you want to vefify Yul contract.") %></div>
</div>
</div>

@ -15,6 +15,10 @@
<%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_address_field.html", f: f %>
<%= if RustVerifierInterface.enabled?() do %>
<%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_yul_contracts_switcher.html", f: f %>
<% end %>
<%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_name_field.html", f: f, tooltip: gettext "Must match the name specified in the code. For example, in <span class=\"tooltip-quote\">contract MyContract {..}</span> <strong>MyContract</strong> is the contract name." %>
<%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_include_nightly_builds_field.html", f: f %>

@ -4,7 +4,7 @@
<%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>
<div class="new-smart-contract-form">
<h1 class="smart-contract-title"><%= gettext "New Solidity Smart Contract Verification" %></h1>
<h1 class="smart-contract-title"><%= if RustVerifierInterface.enabled?(), do: gettext "New Solidity/Yul Smart Contract Verification", else: gettext "New Solidity Smart Contract Verification" %></h1>
<%= form_for changeset,
address_contract_verification_path(@conn, :create),
@ -60,7 +60,7 @@
</div>
<div class="smart-contract-form-group-inner-wrapper">
<label for="smart_contract_multi_part_files"><%= gettext("Sources *.sol files") %></label>
<label for="smart_contract_multi_part_files"><%= if RustVerifierInterface.enabled?(), do: gettext("Sources *.sol or *.yul files"), else: gettext("Sources *.sol files") %></label>
<div class="center-column">
<div class="dropzone-1 dropzone-previews" style="display: flex; margin: 0 auto;", id="dropzone-previews">
<div style="text-align: center;">
@ -69,7 +69,7 @@
</div>
</div>
</div>
<div class="smart-contract-form-group-tooltip"><%= gettext "Drop all Solidity contract source files into the drop zone." %></div>
<div class="smart-contract-form-group-tooltip"><%= if RustVerifierInterface.enabled?(), do: gettext "Drop all Solidity or Yul contract source files into the drop zone.", else: gettext "Drop all Solidity contract source files into the drop zone." %></div>
</div>
<div class="add-contract-libraries-wrapper">

@ -3,4 +3,5 @@ defmodule BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView do
alias Explorer.Chain
alias Explorer.Chain.SmartContract
alias Explorer.SmartContract.RustVerifierInterface
end

@ -3,4 +3,5 @@ defmodule BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView do
alias Explorer.Chain
alias Explorer.Chain.SmartContract
alias Explorer.SmartContract.RustVerifierInterface
end

@ -130,7 +130,7 @@ defmodule BlockScoutWeb.AddressContractView do
end
def creation_code(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do
address.contracts_creation_internal_transaction.input
address.contracts_creation_internal_transaction.init
end
def creation_code(%Address{contracts_creation_transaction: %Transaction{}} = address) do

@ -247,7 +247,7 @@ defmodule BlockScoutWeb.AddressView do
def smart_contract_verified?(%Address{smart_contract: nil}), do: false
def smart_contract_with_read_only_functions?(%Address{smart_contract: %SmartContract{}} = address) do
Enum.any?(address.smart_contract.abi, &is_read_function?(&1))
Enum.any?(address.smart_contract.abi || [], &is_read_function?(&1))
end
def smart_contract_with_read_only_functions?(%Address{smart_contract: nil}), do: false
@ -262,7 +262,7 @@ defmodule BlockScoutWeb.AddressView do
def smart_contract_with_write_functions?(%Address{smart_contract: %SmartContract{}} = address) do
Enum.any?(
address.smart_contract.abi,
address.smart_contract.abi || [],
&Writer.write_function?(&1)
)
end

@ -122,7 +122,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
def smart_contract_with_read_only_functions?(
%Token{contract_address: %Address{smart_contract: %SmartContract{}}} = token
) do
Enum.any?(token.contract_address.smart_contract.abi, &Helper.queriable_method?(&1))
Enum.any?(token.contract_address.smart_contract.abi || [], &Helper.queriable_method?(&1))
end
def smart_contract_with_read_only_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false

@ -48,7 +48,7 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
def smart_contract_with_read_only_functions?(
%Token{contract_address: %Address{smart_contract: %SmartContract{}}} = token
) do
Enum.any?(token.contract_address.smart_contract.abi, &Helper.queriable_method?(&1))
Enum.any?(token.contract_address.smart_contract.abi || [], &Helper.queriable_method?(&1))
end
def smart_contract_with_read_only_functions?(%Token{contract_address: %Address{smart_contract: nil}}), do: false
@ -63,7 +63,7 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
contract_address: %Address{smart_contract: %SmartContract{}} = address
}) do
Enum.any?(
address.smart_contract.abi,
address.smart_contract.abi || [],
&Writer.write_function?(&1)
)
end

@ -176,7 +176,7 @@ msgstr ""
msgid "Add API key"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:82
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76
#, elixir-autogen, elixir-format
msgid "Add Contract Libraries"
@ -187,7 +187,7 @@ msgstr ""
msgid "Add Custom ABI"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:93
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87
#, elixir-autogen, elixir-format
msgid "Add Library"
@ -502,7 +502,7 @@ msgstr ""
#: lib/block_scout_web/templates/account/public_tags_request/form.html.eex:62
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55
@ -640,7 +640,7 @@ msgstr ""
msgid "Contract"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:122
#: lib/block_scout_web/templates/address_contract/index.html.eex:123
#, elixir-autogen, elixir-format
msgid "Contract ABI"
msgstr ""
@ -670,13 +670,13 @@ msgstr ""
msgid "Contract Creation"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:138
#: lib/block_scout_web/templates/address_contract/index.html.eex:153
#: lib/block_scout_web/templates/address_contract/index.html.eex:140
#: lib/block_scout_web/templates/address_contract/index.html.eex:155
#, elixir-autogen, elixir-format
msgid "Contract Creation Code"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80
#, elixir-autogen, elixir-format
msgid "Contract Libraries"
@ -704,7 +704,7 @@ msgstr ""
msgid "Contract source code"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:144
#: lib/block_scout_web/templates/address_contract/index.html.eex:146
#, elixir-autogen, elixir-format
msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified."
msgstr ""
@ -714,7 +714,7 @@ msgstr ""
msgid "Contribute"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:124
#: lib/block_scout_web/templates/address_contract/index.html.eex:125
#, elixir-autogen, elixir-format
msgid "Copy ABI"
msgstr ""
@ -746,8 +746,8 @@ msgstr ""
msgid "Copy Contract Address"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:140
#: lib/block_scout_web/templates/address_contract/index.html.eex:156
#: lib/block_scout_web/templates/address_contract/index.html.eex:142
#: lib/block_scout_web/templates/address_contract/index.html.eex:158
#, elixir-autogen, elixir-format
msgid "Copy Contract Creation Code"
msgstr ""
@ -757,8 +757,8 @@ msgstr ""
msgid "Copy Decompiled Contract Code"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:177
#: lib/block_scout_web/templates/address_contract/index.html.eex:187
#: lib/block_scout_web/templates/address_contract/index.html.eex:179
#: lib/block_scout_web/templates/address_contract/index.html.eex:189
#, elixir-autogen, elixir-format
msgid "Copy Deployed ByteCode"
msgstr ""
@ -966,8 +966,8 @@ msgstr ""
msgid "Delegate Call"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:175
#: lib/block_scout_web/templates/address_contract/index.html.eex:183
#: lib/block_scout_web/templates/address_contract/index.html.eex:177
#: lib/block_scout_web/templates/address_contract/index.html.eex:185
#, elixir-autogen, elixir-format
msgid "Deployed ByteCode"
msgstr ""
@ -997,7 +997,7 @@ msgstr ""
msgid "Difficulty"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:145
#: lib/block_scout_web/templates/address_contract/index.html.eex:147
#, elixir-autogen, elixir-format
msgid "Displaying the init data provided of the creating transaction."
msgstr ""
@ -1073,13 +1073,13 @@ msgid "ETH RPC API Documentation"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:76
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22
#, elixir-autogen, elixir-format
msgid "EVM Version"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26
#, elixir-autogen, elixir-format
msgid "EVM version details"
@ -1117,7 +1117,7 @@ msgstr ""
msgid "Emission Reward"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:68
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72
#, elixir-autogen, elixir-format
msgid "Enter the Solidity Contract Code"
msgstr ""
@ -1190,7 +1190,7 @@ msgstr ""
msgid "Export Data"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:212
#: lib/block_scout_web/templates/address_contract/index.html.eex:214
#, elixir-autogen, elixir-format
msgid "External libraries"
msgstr ""
@ -1373,7 +1373,7 @@ msgstr ""
msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:52
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48
#, elixir-autogen, elixir-format
msgid "If you enabled optimization during compilation, select yes."
@ -1510,7 +1510,7 @@ msgid "Loading chart..."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:105
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49
@ -1649,7 +1649,7 @@ msgstr ""
msgid "Must be set to:"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:18
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22
#, elixir-autogen, elixir-format
msgid "Must match the name specified in the code. For example, in <span class=\"tooltip-quote\">contract MyContract {..}</span> <strong>MyContract</strong> is the contract name."
msgstr ""
@ -1733,7 +1733,8 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:42
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38
#, elixir-autogen, elixir-format
msgid "No"
@ -1802,7 +1803,7 @@ msgid "Optimization enabled"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:70
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:58
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54
#, elixir-autogen, elixir-format
msgid "Optimization runs"
@ -1825,7 +1826,7 @@ msgstr ""
msgid "Owner Address"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "POA solidity flattener or the"
msgstr ""
@ -2041,7 +2042,7 @@ msgstr ""
msgid "Request to edit a public tag/label"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:108
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52
@ -2293,7 +2294,7 @@ msgstr ""
msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26
#, elixir-autogen, elixir-format
msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version."
@ -2309,7 +2310,7 @@ msgstr ""
msgid "The block height of a particular block is defined as the number of blocks preceding it in the blockchain."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18
#, elixir-autogen, elixir-format
msgid "The compiler version is specified in <span class=\"tooltip-quote\">pragma solidity X.X.X</span>. Use the compiler version rather than the nightly build. If using the Solidity compiler, run <span class=\"tooltip-quote\">solc —version</span> to check."
@ -2929,14 +2930,14 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:27
#: lib/block_scout_web/templates/address_contract/index.html.eex:29
#: lib/block_scout_web/templates/address_contract/index.html.eex:161
#: lib/block_scout_web/templates/address_contract/index.html.eex:192
#: lib/block_scout_web/templates/address_contract/index.html.eex:163
#: lib/block_scout_web/templates/address_contract/index.html.eex:194
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14
#, elixir-autogen, elixir-format
msgid "Verify & Publish"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:107
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51
@ -3061,7 +3062,7 @@ msgstr ""
msgid "Watch list"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the"
msgstr ""
@ -3092,7 +3093,8 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:47
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43
#, elixir-autogen, elixir-format
msgid "Yes"
@ -3249,7 +3251,7 @@ msgstr ""
msgid "true"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "truffle flattener"
msgstr ""
@ -3424,3 +3426,23 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Blocks With Internal Transactions Indexed"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72
#, elixir-autogen, elixir-format
msgid "Drop all Solidity or Yul contract source files into the drop zone."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7
#, elixir-autogen, elixir-format
msgid "New Solidity/Yul Smart Contract Verification"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19
#, elixir-autogen, elixir-format
msgid "Select Yes if you want to vefify Yul contract."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63
#, elixir-autogen, elixir-format
msgid "Sources *.sol or *.yul files"
msgstr ""

@ -176,7 +176,7 @@ msgstr ""
msgid "Add API key"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:82
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:76
#, elixir-autogen, elixir-format
msgid "Add Contract Libraries"
@ -187,7 +187,7 @@ msgstr ""
msgid "Add Custom ABI"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:93
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:97
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:87
#, elixir-autogen, elixir-format
msgid "Add Library"
@ -502,7 +502,7 @@ msgstr ""
#: lib/block_scout_web/templates/account/public_tags_request/form.html.eex:62
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:120
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:115
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:41
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:107
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:55
@ -640,7 +640,7 @@ msgstr ""
msgid "Contract"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:122
#: lib/block_scout_web/templates/address_contract/index.html.eex:123
#, elixir-autogen, elixir-format
msgid "Contract ABI"
msgstr ""
@ -670,13 +670,13 @@ msgstr ""
msgid "Contract Creation"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:138
#: lib/block_scout_web/templates/address_contract/index.html.eex:153
#: lib/block_scout_web/templates/address_contract/index.html.eex:140
#: lib/block_scout_web/templates/address_contract/index.html.eex:155
#, elixir-autogen, elixir-format
msgid "Contract Creation Code"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:86
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:90
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:80
#, elixir-autogen, elixir-format
msgid "Contract Libraries"
@ -704,7 +704,7 @@ msgstr ""
msgid "Contract source code"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:144
#: lib/block_scout_web/templates/address_contract/index.html.eex:146
#, elixir-autogen, elixir-format
msgid "Contracts that self destruct in their constructors have no contract code published and cannot be verified."
msgstr ""
@ -714,7 +714,7 @@ msgstr ""
msgid "Contribute"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:124
#: lib/block_scout_web/templates/address_contract/index.html.eex:125
#, elixir-autogen, elixir-format
msgid "Copy ABI"
msgstr ""
@ -746,8 +746,8 @@ msgstr ""
msgid "Copy Contract Address"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:140
#: lib/block_scout_web/templates/address_contract/index.html.eex:156
#: lib/block_scout_web/templates/address_contract/index.html.eex:142
#: lib/block_scout_web/templates/address_contract/index.html.eex:158
#, elixir-autogen, elixir-format
msgid "Copy Contract Creation Code"
msgstr ""
@ -757,8 +757,8 @@ msgstr ""
msgid "Copy Decompiled Contract Code"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:177
#: lib/block_scout_web/templates/address_contract/index.html.eex:187
#: lib/block_scout_web/templates/address_contract/index.html.eex:179
#: lib/block_scout_web/templates/address_contract/index.html.eex:189
#, elixir-autogen, elixir-format
msgid "Copy Deployed ByteCode"
msgstr ""
@ -966,8 +966,8 @@ msgstr ""
msgid "Delegate Call"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:175
#: lib/block_scout_web/templates/address_contract/index.html.eex:183
#: lib/block_scout_web/templates/address_contract/index.html.eex:177
#: lib/block_scout_web/templates/address_contract/index.html.eex:185
#, elixir-autogen, elixir-format
msgid "Deployed ByteCode"
msgstr ""
@ -997,7 +997,7 @@ msgstr ""
msgid "Difficulty"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:145
#: lib/block_scout_web/templates/address_contract/index.html.eex:147
#, elixir-autogen, elixir-format
msgid "Displaying the init data provided of the creating transaction."
msgstr ""
@ -1073,13 +1073,13 @@ msgid "ETH RPC API Documentation"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:76
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:22
#, elixir-autogen, elixir-format
msgid "EVM Version"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26
#, elixir-autogen, elixir-format
msgid "EVM version details"
@ -1117,7 +1117,7 @@ msgstr ""
msgid "Emission Reward"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:68
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:72
#, elixir-autogen, elixir-format
msgid "Enter the Solidity Contract Code"
msgstr ""
@ -1190,7 +1190,7 @@ msgstr ""
msgid "Export Data"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:212
#: lib/block_scout_web/templates/address_contract/index.html.eex:214
#, elixir-autogen, elixir-format
msgid "External libraries"
msgstr ""
@ -1373,7 +1373,7 @@ msgstr ""
msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:52
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:56
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:48
#, elixir-autogen, elixir-format
msgid "If you enabled optimization during compilation, select yes."
@ -1510,7 +1510,7 @@ msgid "Loading chart..."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:77
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:105
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:109
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:35
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:99
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:49
@ -1649,7 +1649,7 @@ msgstr ""
msgid "Must be set to:"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:18
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22
#, elixir-autogen, elixir-format
msgid "Must match the name specified in the code. For example, in <span class=\"tooltip-quote\">contract MyContract {..}</span> <strong>MyContract</strong> is the contract name."
msgstr ""
@ -1733,7 +1733,8 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:42
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:9
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:46
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:38
#, elixir-autogen, elixir-format
msgid "No"
@ -1802,7 +1803,7 @@ msgid "Optimization enabled"
msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:70
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:58
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:62
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:54
#, elixir-autogen, elixir-format
msgid "Optimization runs"
@ -1825,7 +1826,7 @@ msgstr ""
msgid "Owner Address"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "POA solidity flattener or the"
msgstr ""
@ -2041,7 +2042,7 @@ msgstr ""
msgid "Request to edit a public tag/label"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:108
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:112
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:38
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:104
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:52
@ -2293,7 +2294,7 @@ msgstr ""
msgid "The 0x library address. This can be found in the generated json file or Truffle output (if using truffle)."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:30
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:34
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:26
#, elixir-autogen, elixir-format
msgid "The EVM version the contract is written for. If the bytecode does not match the version, we try to verify using the latest EVM version."
@ -2309,7 +2310,7 @@ msgstr ""
msgid "The block height of a particular block is defined as the number of blocks preceding it in the blockchain."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:22
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:26
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:18
#, elixir-autogen, elixir-format
msgid "The compiler version is specified in <span class=\"tooltip-quote\">pragma solidity X.X.X</span>. Use the compiler version rather than the nightly build. If using the Solidity compiler, run <span class=\"tooltip-quote\">solc —version</span> to check."
@ -2929,14 +2930,14 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract/index.html.eex:27
#: lib/block_scout_web/templates/address_contract/index.html.eex:29
#: lib/block_scout_web/templates/address_contract/index.html.eex:161
#: lib/block_scout_web/templates/address_contract/index.html.eex:192
#: lib/block_scout_web/templates/address_contract/index.html.eex:163
#: lib/block_scout_web/templates/address_contract/index.html.eex:194
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:14
#, elixir-autogen, elixir-format
msgid "Verify & Publish"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:107
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:111
#: lib/block_scout_web/templates/address_contract_verification_via_json/new.html.eex:37
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:103
#: lib/block_scout_web/templates/address_contract_verification_via_standard_json_input/new.html.eex:51
@ -3061,7 +3062,7 @@ msgstr ""
msgid "Watch list"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "We recommend using flattened code. This is necessary if your code utilizes a library or inherits dependencies. Use the"
msgstr ""
@ -3092,7 +3093,8 @@ msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_fetch_constructor_args.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_include_nightly_builds_field.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:47
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:14
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:51
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:43
#, elixir-autogen, elixir-format
msgid "Yes"
@ -3249,7 +3251,7 @@ msgstr ""
msgid "true"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:73
#: lib/block_scout_web/templates/address_contract_verification_via_flattened_code/new.html.eex:77
#, elixir-autogen, elixir-format
msgid "truffle flattener"
msgstr ""
@ -3424,3 +3426,23 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Blocks With Internal Transactions Indexed"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:72
#, elixir-autogen, elixir-format, fuzzy
msgid "Drop all Solidity or Yul contract source files into the drop zone."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:7
#, elixir-autogen, elixir-format, fuzzy
msgid "New Solidity/Yul Smart Contract Verification"
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_common_fields/_yul_contracts_switcher.html.eex:19
#, elixir-autogen, elixir-format
msgid "Select Yes if you want to vefify Yul contract."
msgstr ""
#: lib/block_scout_web/templates/address_contract_verification_via_multi_part_files/new.html.eex:63
#, elixir-autogen, elixir-format, fuzzy
msgid "Sources *.sol or *.yul files"
msgstr ""

@ -197,11 +197,12 @@ defmodule Explorer.Chain.SmartContract do
* `partially_verified` - whether contract verified using partial matched source code or not.
* `is_vyper_contract` - boolean flag, determines if contract is Vyper or not
* `file_path` - show the filename or path to the file of the contract source file
* `is_changed_bytecode` - boolean flag, determines if contract's bytecode was modified
* `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
* `autodetect_constructor_args` - field was added for storing user's choice
* `is_yul` - field was added for storing user's choice
"""
@type t :: %Explorer.Chain.SmartContract{
@ -221,7 +222,8 @@ defmodule Explorer.Chain.SmartContract do
bytecode_checked_at: DateTime.t(),
contract_code_md5: String.t(),
implementation_name: String.t() | nil,
autodetect_constructor_args: boolean | nil
autodetect_constructor_args: boolean | nil,
is_yul: boolean | nil
}
schema "smart_contracts" do
@ -243,6 +245,7 @@ defmodule Explorer.Chain.SmartContract do
field(:contract_code_md5, :string)
field(:implementation_name, :string)
field(:autodetect_constructor_args, :boolean, virtual: true)
field(:is_yul, :boolean, virtual: true)
has_many(
:decompiled_smart_contracts,
@ -291,7 +294,6 @@ defmodule Explorer.Chain.SmartContract do
:compiler_version,
:optimization,
:contract_source_code,
:abi,
:address_hash,
:contract_code_md5
])
@ -431,6 +433,7 @@ defmodule Explorer.Chain.SmartContract do
%__MODULE__{}
|> changeset(Map.from_struct(twin_contract))
|> Changeset.put_change(:autodetect_constructor_args, true)
|> Changeset.put_change(:is_yul, false)
|> Changeset.force_change(:address_hash, Changeset.get_field(changeset, :address_hash))
end
@ -443,6 +446,7 @@ defmodule Explorer.Chain.SmartContract do
|> Changeset.put_change(:compiler_version, "latest")
|> Changeset.put_change(:contract_source_code, "")
|> Changeset.put_change(:autodetect_constructor_args, true)
|> Changeset.put_change(:is_yul, false)
end
def merge_twin_vyper_contract_with_changeset(

@ -51,7 +51,7 @@ defmodule Explorer.SmartContract.Solidity.Publisher do
|> Map.put("external_libraries", contract_libraries)
|> Map.put("name", contract_name)
publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string))
publish_smart_contract(address_hash, prepared_params, Jason.decode!(abi_string || "null"))
{:ok, %{abi: abi, constructor_arguments: constructor_arguments}} ->
params_with_constructor_arguments =
@ -245,7 +245,8 @@ defmodule Explorer.SmartContract.Solidity.Publisher do
verified_via_sourcify: params["verified_via_sourcify"],
partially_verified: params["partially_verified"],
is_vyper_contract: false,
autodetect_constructor_args: params["autodetect_constructor_args"]
autodetect_constructor_args: params["autodetect_constructor_args"],
is_yul: params["is_yul"] || false
}
end

@ -51,7 +51,10 @@ defmodule Explorer.SmartContract.Solidity.Verifier do
params
|> Map.put("creation_bytecode", creation_tx_input)
|> Map.put("deployed_bytecode", deployed_bytecode)
|> Map.put("sources", %{"#{params["name"]}.sol" => params["contract_source_code"]})
|> Map.put("sources", %{
"#{params["name"]}.#{smart_contract_source_file_extension(parse_boolean(params["is_yul"]))}" =>
params["contract_source_code"]
})
|> Map.put("contract_libraries", params["external_libraries"])
|> Map.put("optimization_runs", prepare_optimization_runs(params["optimization"], params["optimization_runs"]))
|> RustVerifierInterface.verify_multi_part()
@ -81,6 +84,9 @@ defmodule Explorer.SmartContract.Solidity.Verifier do
end)
end
defp smart_contract_source_file_extension(true), do: "yul"
defp smart_contract_source_file_extension(_), do: "sol"
defp prepare_optimization_runs(false_, _) when false_ in [false, "false"], do: nil
defp prepare_optimization_runs(true_, runs) when true_ in [true, "true"] do

@ -0,0 +1,7 @@
defmodule Explorer.Repo.Migrations.RemoveNotNullConstraintFromAbi do
use Ecto.Migration
def change do
execute("ALTER TABLE smart_contracts ALTER COLUMN abi DROP NOT NULL;")
end
end
Loading…
Cancel
Save