|
|
@ -436,9 +436,12 @@ defmodule Explorer.SmartContract.Reader do |
|
|
|
abi |
|
|
|
abi |
|
|
|
|> ABI.parse_specification() |
|
|
|
|> ABI.parse_specification() |
|
|
|
|
|
|
|
|
|
|
|
%{outputs: outputs, method_id: method_id} = proccess_abi(parsed_final_abi, method_id) |
|
|
|
with %{outputs: outputs, method_id: method_id} <- proccess_abi(parsed_final_abi, method_id) do |
|
|
|
|
|
|
|
query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) |
|
|
|
query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) |
|
|
|
else |
|
|
|
|
|
|
|
{:error, message} -> |
|
|
|
|
|
|
|
{:error, message} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@spec query_function_with_custom_abi( |
|
|
|
@spec query_function_with_custom_abi( |
|
|
@ -515,10 +518,15 @@ defmodule Explorer.SmartContract.Reader do |
|
|
|
|
|
|
|
|
|
|
|
defp proccess_abi(abi, method_id) do |
|
|
|
defp proccess_abi(abi, method_id) do |
|
|
|
function_object = find_function_by_method(abi, method_id) |
|
|
|
function_object = find_function_by_method(abi, method_id) |
|
|
|
%ABI.FunctionSelector{returns: returns, method_id: method_id} = function_object |
|
|
|
|
|
|
|
outputs = extract_outputs(returns) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%{outputs: outputs, method_id: method_id} |
|
|
|
if function_object do |
|
|
|
|
|
|
|
%ABI.FunctionSelector{returns: returns, method_id: method_id} = function_object |
|
|
|
|
|
|
|
outputs = extract_outputs(returns) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%{outputs: outputs, method_id: method_id} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{:error, "method_id does not exist"} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) do |
|
|
|
defp query_contract_and_link_outputs(contract_address_hash, args, from, abi, outputs, method_id, leave_error_as_map) do |
|
|
|