View Source Ethers.Event (Ethers v0.5.5)

EVM Event struct and helpers

Summary

Functions

Decodes a log entry with the given Event function selector and returns an Event struct

Given a log entry and an EventFilters module (e.g. Ethers.Contracts.ERC20.EventFilters) will find a matching event filter in the given module and decodes the log using the event selector.

Types

t()

@type t() :: %Ethers.Event{
  address: Ethers.Types.t_address(),
  block_hash: Ethers.Types.t_hash(),
  block_number: non_neg_integer(),
  data: [term()],
  data_raw: String.t(),
  log_index: non_neg_integer(),
  removed: boolean(),
  topics: [term(), ...],
  topics_raw: [String.t(), ...],
  transaction_hash: Ethers.Types.t_hash(),
  transaction_index: non_neg_integer()
}

Functions

decode(log, selector)

@spec decode(map(), ABI.FunctionSelector.t()) :: t()

Decodes a log entry with the given Event function selector and returns an Event struct

find_and_decode(log, event_filters_module)

@spec find_and_decode(map(), module()) :: {:ok, t()} | {:error, :not_found}

Given a log entry and an EventFilters module (e.g. Ethers.Contracts.ERC20.EventFilters) will find a matching event filter in the given module and decodes the log using the event selector.