Merge pull request #1172 from poanetwork/fix-event-decoding-crash

fix: match more explicitly on ABI decoding result
pull/1219/head
Andrew Cravenho 6 years ago committed by GitHub
commit 4e93979a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/explorer/lib/explorer/chain/log.ex

@ -5,7 +5,7 @@ defmodule Explorer.Chain.Log do
require Logger require Logger
alias ABI.Event alias ABI.{Event, FunctionSelector}
alias Explorer.Chain.{Address, Data, Hash, Transaction} alias Explorer.Chain.{Address, Data, Hash, Transaction}
@required_attrs ~w(address_hash data index transaction_hash)a @required_attrs ~w(address_hash data index transaction_hash)a
@ -117,7 +117,7 @@ defmodule Explorer.Chain.Log do
def decode(_log, _transaction), do: {:error, :contract_not_verified} def decode(_log, _transaction), do: {:error, :contract_not_verified}
defp find_and_decode(abi, log, transaction) do defp find_and_decode(abi, log, transaction) do
with {selector, mapping} <- with {%FunctionSelector{} = selector, mapping} <-
abi abi
|> ABI.parse_specification(include_events?: true) |> ABI.parse_specification(include_events?: true)
|> Event.find_and_decode( |> Event.find_and_decode(

Loading…
Cancel
Save