@ -134,7 +134,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
def get_metadata_and_publish ( address_hash_string , nil ) do
case Sourcify . get_metadata ( address_hash_string ) do
{ :ok , verification_metadata } ->
proccess_metadata_ad d_publish ( address_hash_string , verification_metadata , false )
process_metadata_an d_publish ( address_hash_string , verification_metadata , false )
{ :error , %{ " error " = > error } } ->
{ :error , error : error }
@ -144,7 +144,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
def get_metadata_and_publish ( address_hash_string , conn ) do
case Sourcify . get_metadata ( address_hash_string ) do
{ :ok , verification_metadata } ->
proccess_metadata_ad d_publish ( address_hash_string , verification_metadata , false , conn )
process_metadata_an d_publish ( address_hash_string , verification_metadata , false , conn )
{ :error , %{ " error " = > error } } ->
EventsPublisher . broadcast (
@ -154,7 +154,7 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
end
end
defp proccess_metadata_ad d_publish ( address_hash_string , verification_metadata , is_partial , conn \\ nil ) do
defp process_metadata_an d_publish ( address_hash_string , verification_metadata , is_partial , conn \\ nil ) do
%{ " params_to_publish " = > params_to_publish , " abi " = > abi , " secondary_sources " = > secondary_sources } =
parse_params_from_sourcify ( address_hash_string , verification_metadata )
@ -187,10 +187,9 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
end
def parse_params_from_sourcify ( address_hash_string , verification_metadata ) do
verification_metadata_json =
[ verification_metadata_json ] =
verification_metadata
|> Enum . filter ( fn %{ " name " = > name , " content " = > _content } -> name =~ " .json " end )
|> Enum . at ( 0 )
|> Enum . filter ( & ( Map . get ( &1 , " name " ) == " metadata.json " ) )
full_params_initial = parse_json_from_sourcify_for_insertion ( verification_metadata_json )
@ -198,7 +197,6 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
verification_metadata
|> Enum . filter ( fn %{ " name " = > name , " content " = > _content } -> name =~ " .sol " end )
full_params =
verification_metadata_sol
|> Enum . reduce ( full_params_initial , fn %{ " name " = > name , " content " = > content , " path " = > _path } = param ,
full_params_acc ->
@ -224,8 +222,6 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
}
end
end )
full_params
end
defp prepare_additional_source ( address_hash_string , %{ " name " = > name , " content " = > content , " path " = > _path } ) do
@ -293,10 +289,10 @@ defmodule BlockScoutWeb.AddressContractVerificationController do
else
case Sourcify . check_by_address_any ( address_hash_string ) do
{ :ok , " full " , metadata } ->
proccess_metadata_ad d_publish ( address_hash_string , metadata , false )
process_metadata_an d_publish ( address_hash_string , metadata , false )
{ :ok , " partial " , metadata } ->
proccess_metadata_ad d_publish ( address_hash_string , metadata , true )
process_metadata_an d_publish ( address_hash_string , metadata , true )
_ ->
{ :error , :not_verified }