Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mfachal committed Jun 6, 2022
1 parent 76aa395 commit ab1251b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions eth_client/lib/eth_client/abi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ defmodule EthClient.ABI do
def get(abi_path), do: get_local(abi_path)

def to_selector(function_def) do
ABI.FunctionSelector.decode(function_def["name"])
function_def["name"]
|> ABI.FunctionSelector.decode()
|> Map.put(:method_id, function_def["selector"])
|> Map.put(:state_mutability, function_def["stateMutability"])
end
Expand All @@ -36,12 +37,9 @@ defmodule EthClient.ABI do

case System.cmd("python3", [decode_path, bytecode]) do
{hashes, 0} ->
{:ok, funclist} =
hashes
|> Jason.decode()

funclist =
funclist
hashes
|> Jason.decode!()
|> Enum.filter(fn %{"selector" => hash} -> hash != "_fallback()" end)
|> Enum.map(&to_selector/1)
|> Enum.map(&filter_unnamed/1)
Expand Down
2 changes: 1 addition & 1 deletion eth_client/lib/eth_client/contract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defmodule EthClient.Contract do
parse_abi(tail, acc)
end

defp build_function_by_hash(%{method_id: _selector, state_mutability: mutability} = method)
defp build_function_by_hash(%{state_mutability: mutability} = method)
when mutability in ["pure", "view"] do
args =
method.types
Expand Down

0 comments on commit ab1251b

Please sign in to comment.