Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blockscout/lib/explorer/log.ex

36 lines
914 B

defmodule Explorer.Log do
@moduledoc "Captures a Web3 log entry generated by a transaction"
use Ecto.Schema
import Ecto.Changeset
alias Explorer.Address
alias Explorer.Log
alias Explorer.TransactionReceipt
@timestamps_opts [type: Timex.Ecto.DateTime,
autogenerate: {Timex.Ecto.DateTime, :autogenerate, []}]
@required_attrs ~w(index data removed)a
schema "logs" do
belongs_to :transaction_receipt, TransactionReceipt
belongs_to :address, Address
has_one :transaction, through: [:transaction_receipt, :transaction]
field :index, :integer
field :data, :string
field :removed, :boolean
field :first_topic, :string
field :second_topic, :string
field :third_topic, :string
timestamps()
end
def changeset(%Log{} = log, attrs \\ %{}) do
log
|> cast(attrs, @required_attrs)
|> validate_required(@required_attrs)
end
end