parent
f66d560950
commit
f7d41877f8
@ -1,15 +1,24 @@ |
|||||||
defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
defmodule BlockScoutWeb.AddressContractVerificationViaJsonController do |
||||||
use BlockScoutWeb, :controller |
use BlockScoutWeb, :controller |
||||||
|
|
||||||
|
alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController |
||||||
alias Explorer.Chain.SmartContract |
alias Explorer.Chain.SmartContract |
||||||
|
alias Explorer.ThirdPartyIntegrations.Sourcify |
||||||
|
|
||||||
def new(conn, %{"address_id" => address_hash_string}) do |
def new(conn, %{"address_id" => address_hash_string}) do |
||||||
changeset = |
case Sourcify.check_by_address(address_hash_string) do |
||||||
SmartContract.changeset( |
{:ok, _verified_status} -> |
||||||
%SmartContract{address_hash: address_hash_string}, |
VerificationController.get_metadata_and_publish(address_hash_string, conn) |
||||||
%{} |
redirect(conn, to: address_path(conn, :show, address_hash_string)) |
||||||
) |
|
||||||
|
|
||||||
render(conn, "new.html", changeset: changeset, address_hash: address_hash_string) |
_ -> |
||||||
|
changeset = |
||||||
|
SmartContract.changeset( |
||||||
|
%SmartContract{address_hash: address_hash_string}, |
||||||
|
%{} |
||||||
|
) |
||||||
|
|
||||||
|
render(conn, "new.html", changeset: changeset, address_hash: address_hash_string) |
||||||
|
end |
||||||
end |
end |
||||||
end |
end |
||||||
|
Loading…
Reference in new issue