|
|
|
@ -8,7 +8,19 @@ defmodule Explorer.Chain.Address do |
|
|
|
|
use Explorer.Schema |
|
|
|
|
|
|
|
|
|
alias Ecto.Changeset |
|
|
|
|
alias Explorer.Chain.{Address, Block, Data, Hash, InternalTransaction, SmartContract, Token, Transaction, Wei} |
|
|
|
|
|
|
|
|
|
alias Explorer.Chain.{ |
|
|
|
|
Address, |
|
|
|
|
Block, |
|
|
|
|
Data, |
|
|
|
|
DecompiledSmartContract, |
|
|
|
|
Hash, |
|
|
|
|
InternalTransaction, |
|
|
|
|
SmartContract, |
|
|
|
|
Token, |
|
|
|
|
Transaction, |
|
|
|
|
Wei |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce)a |
|
|
|
|
@required_attrs ~w(hash)a |
|
|
|
@ -62,6 +74,7 @@ defmodule Explorer.Chain.Address do |
|
|
|
|
field(:fetched_coin_balance_block_number, :integer) |
|
|
|
|
field(:contract_code, Data) |
|
|
|
|
field(:nonce, :integer) |
|
|
|
|
field(:has_decompiled_code?, :boolean, virtual: true) |
|
|
|
|
|
|
|
|
|
has_one(:smart_contract, SmartContract) |
|
|
|
|
has_one(:token, Token, foreign_key: :contract_address_hash) |
|
|
|
@ -79,6 +92,7 @@ defmodule Explorer.Chain.Address do |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
has_many(:names, Address.Name, foreign_key: :address_hash) |
|
|
|
|
has_many(:decompiled_smart_contract, DecompiledSmartContract, foreign_key: :address_hash) |
|
|
|
|
|
|
|
|
|
timestamps() |
|
|
|
|
end |
|
|
|
|