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/from_address.ex

24 lines
664 B

defmodule Explorer.FromAddress do
@moduledoc false
alias Explorer.FromAddress
import Ecto.Changeset
use Ecto.Schema
@timestamps_opts [type: Timex.Ecto.DateTime,
autogenerate: {Timex.Ecto.DateTime, :autogenerate, []}]
@primary_key false
schema "from_addresses" do
belongs_to :transaction, Explorer.Transaction, primary_key: true
belongs_to :address, Explorer.Address
timestamps()
end
def changeset(%FromAddress{} = to_address, attrs \\ %{}) do
to_address
|> cast(attrs, [:transaction_id, :address_id])
|> unique_constraint(:transaction_id,
name: :from_addresses_transaction_id_index)
end
end