|
|
@ -93,7 +93,7 @@ defmodule BlockScoutWeb.SmartContractView do |
|
|
|
render_type_value(type, values) |
|
|
|
render_type_value(type, values) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def values_with_type(value, type, _components) when type in ["address", "address payable"] do |
|
|
|
def values_with_type(value, type, _components) when type in [:address, "address", "address payable"] do |
|
|
|
{:ok, address} = Address.cast(value) |
|
|
|
{:ok, address} = Address.cast(value) |
|
|
|
render_type_value("address", to_string(address)) |
|
|
|
render_type_value("address", to_string(address)) |
|
|
|
end |
|
|
|
end |
|
|
@ -102,7 +102,13 @@ defmodule BlockScoutWeb.SmartContractView do |
|
|
|
|
|
|
|
|
|
|
|
def values_with_type(value, "bool", _components), do: render_type_value("bool", to_string(value)) |
|
|
|
def values_with_type(value, "bool", _components), do: render_type_value("bool", to_string(value)) |
|
|
|
|
|
|
|
|
|
|
|
def values_with_type(value, type, _components), do: render_type_value(type, binary_to_utf_string(value)) |
|
|
|
def values_with_type(value, type, _components) do |
|
|
|
|
|
|
|
if String.starts_with?(type, "uint") do |
|
|
|
|
|
|
|
render_type_value(type, to_string(value)) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
render_type_value(type, binary_to_utf_string(value)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def values_only(value, type, components) when is_list(value) do |
|
|
|
def values_only(value, type, components) when is_list(value) do |
|
|
|
cond do |
|
|
|
cond do |
|
|
@ -153,7 +159,7 @@ defmodule BlockScoutWeb.SmartContractView do |
|
|
|
values |
|
|
|
values |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def values_only(value, type, _components) when type in ["address", "address payable"] do |
|
|
|
def values_only(value, type, _components) when type in [:address, "address", "address payable"] do |
|
|
|
{:ok, address} = Address.cast(value) |
|
|
|
{:ok, address} = Address.cast(value) |
|
|
|
to_string(address) |
|
|
|
to_string(address) |
|
|
|
end |
|
|
|
end |
|
|
@ -162,7 +168,13 @@ defmodule BlockScoutWeb.SmartContractView do |
|
|
|
|
|
|
|
|
|
|
|
def values_only(value, "bool", _components), do: to_string(value) |
|
|
|
def values_only(value, "bool", _components), do: to_string(value) |
|
|
|
|
|
|
|
|
|
|
|
def values_only(value, _type, _components), do: binary_to_utf_string(value) |
|
|
|
def values_only(value, type, _components) do |
|
|
|
|
|
|
|
if String.starts_with?(type, "uint") do |
|
|
|
|
|
|
|
to_string(value) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
binary_to_utf_string(value) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp tuple_array_to_array(value, type) do |
|
|
|
defp tuple_array_to_array(value, type) do |
|
|
|
value |
|
|
|
value |
|
|
|