|
|
|
@ -6,14 +6,15 @@ defmodule Explorer.Chain.Log do |
|
|
|
|
require Logger |
|
|
|
|
|
|
|
|
|
alias ABI.{Event, FunctionSelector} |
|
|
|
|
alias Explorer.Chain.{Address, ContractMethod, Data, Hash, Transaction} |
|
|
|
|
alias Explorer.Chain.{Address, Block, ContractMethod, Data, Hash, Transaction} |
|
|
|
|
alias Explorer.Repo |
|
|
|
|
|
|
|
|
|
@required_attrs ~w(address_hash data index transaction_hash)a |
|
|
|
|
@required_attrs ~w(address_hash data block_hash index transaction_hash)a |
|
|
|
|
@optional_attrs ~w(first_topic second_topic third_topic fourth_topic type)a |
|
|
|
|
|
|
|
|
|
@typedoc """ |
|
|
|
|
* `address` - address of contract that generate the event |
|
|
|
|
* `block_hash` - hash of the block |
|
|
|
|
* `address_hash` - foreign key for `address` |
|
|
|
|
* `data` - non-indexed log parameters. |
|
|
|
|
* `first_topic` - `topics[0]` |
|
|
|
@ -28,6 +29,7 @@ defmodule Explorer.Chain.Log do |
|
|
|
|
@type t :: %__MODULE__{ |
|
|
|
|
address: %Ecto.Association.NotLoaded{} | Address.t(), |
|
|
|
|
address_hash: Hash.Address.t(), |
|
|
|
|
block_hash: Hash.Full.t(), |
|
|
|
|
data: Data.t(), |
|
|
|
|
first_topic: String.t(), |
|
|
|
|
second_topic: String.t(), |
|
|
|
@ -59,6 +61,14 @@ defmodule Explorer.Chain.Log do |
|
|
|
|
references: :hash, |
|
|
|
|
type: Hash.Full |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
belongs_to(:block, Block, |
|
|
|
|
foreign_key: :block_hash, |
|
|
|
|
primary_key: true, |
|
|
|
|
references: :hash, |
|
|
|
|
type: Hash.Full |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
|