Added check if sourcify integration is enabled

pull/4388/head
nikitosing 3 years ago
parent 230ea9f5bb
commit 39ce756e26
  1. 1
      CHANGELOG.md
  2. 4
      apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex

@ -3,6 +3,7 @@
### Features ### Features
### Fixes ### Fixes
- [#4388](https://github.com/blockscout/blockscout/pull/4388) - Fix internal server error on contract page for insctances without sourcify envs
### Chore ### Chore
- [#4382](https://github.com/blockscout/blockscout/pull/4382) - Replace awesomplete with autocomplete.js - [#4382](https://github.com/blockscout/blockscout/pull/4382) - Replace awesomplete with autocomplete.js

@ -275,6 +275,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
if Chain.smart_contract_fully_verified?(address_hash_string) do if Chain.smart_contract_fully_verified?(address_hash_string) do
{:ok, :already_fully_verified} {:ok, :already_fully_verified}
else else
if Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:enabled] do
if Chain.smart_contract_verified?(address_hash_string) do if Chain.smart_contract_verified?(address_hash_string) do
case Sourcify.check_by_address(address_hash_string) do case Sourcify.check_by_address(address_hash_string) do
{:ok, _verified_status} -> {:ok, _verified_status} ->
@ -295,6 +296,9 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
{:error, :not_verified} {:error, :not_verified}
end end
end end
else
{:error, :sourcify_disabled}
end
end end
end end
end end

Loading…
Cancel
Save