mirror of https://github.com/poanetwork/ex_abi.git
Compare commits
2 Commits
50deca4645
...
f6ff54c229
Author | SHA1 | Date |
---|---|---|
Kirill Fedoseev | f6ff54c229 | |
Kirill Fedoseev | a493ebdecb |
|
@ -29,14 +29,14 @@ defmodule ABI.FunctionSelector do
|
||||||
* `:types` - Function's input types
|
* `:types` - Function's input types
|
||||||
* `:returns` - Function's return types
|
* `:returns` - Function's return types
|
||||||
* `:return_names` - Names of the return values (output names)
|
* `:return_names` - Names of the return values (output names)
|
||||||
* `:method_id` - First four bits of the hashed function signature
|
* `:method_id` - First four bytes of the hashed function signature or full 32 byte hash for events
|
||||||
* `:input_names` - Names of the input values (argument names)
|
* `:input_names` - Names of the input values (argument names)
|
||||||
* `:type` - The type of the selector. Events are part of the ABI, but are not considered functions
|
* `:type` - The type of the selector. Events are part of the ABI, but are not considered functions
|
||||||
* `:inputs_index` - A list of true/false values denoting if each input is indexed. Only populated for events.
|
* `:inputs_index` - A list of true/false values denoting if each input is indexed. Only populated for events.
|
||||||
"""
|
"""
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
function: String.t() | nil,
|
function: String.t() | nil,
|
||||||
method_id: String.t() | nil,
|
method_id: binary | nil,
|
||||||
input_names: [String.t()],
|
input_names: [String.t()],
|
||||||
types: [type],
|
types: [type],
|
||||||
returns: [type],
|
returns: [type],
|
||||||
|
@ -418,13 +418,7 @@ defmodule ABI.FunctionSelector do
|
||||||
defp add_event_id(selector) do
|
defp add_event_id(selector) do
|
||||||
signature = encode(selector)
|
signature = encode(selector)
|
||||||
|
|
||||||
case ExKeccak.hash_256(signature) do
|
%{selector | method_id: ExKeccak.hash_256(signature)}
|
||||||
<<event_id::binary-size(32)>> ->
|
|
||||||
%{selector | method_id: event_id}
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
selector
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_types(function_selector) do
|
defp get_types(function_selector) do
|
||||||
|
|
Loading…
Reference in New Issue