|
|
@ -2,10 +2,14 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
|
|
|
use BlockScoutWeb, :controller |
|
|
|
use BlockScoutWeb, :controller |
|
|
|
|
|
|
|
|
|
|
|
alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController |
|
|
|
alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController |
|
|
|
|
|
|
|
alias Explorer.Chain |
|
|
|
alias Explorer.Chain.SmartContract |
|
|
|
alias Explorer.Chain.SmartContract |
|
|
|
alias Explorer.ThirdPartyIntegrations.Sourcify |
|
|
|
alias Explorer.ThirdPartyIntegrations.Sourcify |
|
|
|
|
|
|
|
|
|
|
|
def new(conn, %{"address_id" => address_hash_string}) do |
|
|
|
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 |
|
|
|
case Sourcify.check_by_address(address_hash_string) do |
|
|
|
{:ok, _verified_status} -> |
|
|
|
{:ok, _verified_status} -> |
|
|
|
VerificationController.get_metadata_and_publish(address_hash_string, conn) |
|
|
|
VerificationController.get_metadata_and_publish(address_hash_string, conn) |
|
|
@ -21,4 +25,5 @@ defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
|
|
|
render(conn, "new.html", changeset: changeset, address_hash: address_hash_string) |
|
|
|
render(conn, "new.html", changeset: changeset, address_hash: address_hash_string) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|