|
|
|
@ -2,10 +2,14 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
|
|
|
|
use BlockScoutWeb, :controller |
|
|
|
|
|
|
|
|
|
alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController |
|
|
|
|
alias Explorer.Chain |
|
|
|
|
alias Explorer.Chain.SmartContract |
|
|
|
|
alias Explorer.ThirdPartyIntegrations.Sourcify |
|
|
|
|
|
|
|
|
|
def new(conn, %{"address_id" => address_hash_string}) do |
|
|
|
|
if Chain.smart_contract_verified?(address_hash_string) do |
|
|
|
|
redirect(conn, to: address_path(conn, :show, address_hash_string)) |
|
|
|
|
else |
|
|
|
|
case Sourcify.check_by_address(address_hash_string) do |
|
|
|
|
{:ok, _verified_status} -> |
|
|
|
|
VerificationController.get_metadata_and_publish(address_hash_string, conn) |
|
|
|
@ -22,3 +26,4 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|