|
|
@ -64,6 +64,9 @@ defmodule Explorer.Chain.Address.TokenBalance do |
|
|
|
|> unique_constraint(:block_number, name: :token_balances_address_hash_block_number_index) |
|
|
|
|> unique_constraint(:block_number, name: :token_balances_address_hash_block_number_index) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") |
|
|
|
|
|
|
|
@burn_address_hash burn_address_hash |
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
@doc """ |
|
|
|
Builds an `Ecto.Query` to fetch the last token balances that have value greater than 0. |
|
|
|
Builds an `Ecto.Query` to fetch the last token balances that have value greater than 0. |
|
|
|
|
|
|
|
|
|
|
@ -110,12 +113,10 @@ defmodule Explorer.Chain.Address.TokenBalance do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp token_holders_query(contract_address_hash) do |
|
|
|
defp token_holders_query(contract_address_hash) do |
|
|
|
{:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from( |
|
|
|
from( |
|
|
|
tb in TokenBalance, |
|
|
|
tb in TokenBalance, |
|
|
|
distinct: :address_hash, |
|
|
|
distinct: :address_hash, |
|
|
|
where: tb.token_contract_address_hash == ^contract_address_hash and tb.address_hash != ^burn_address_hash, |
|
|
|
where: tb.token_contract_address_hash == ^contract_address_hash and tb.address_hash != ^@burn_address_hash, |
|
|
|
order_by: [desc: :block_number] |
|
|
|
order_by: [desc: :block_number] |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
@ -130,9 +131,6 @@ defmodule Explorer.Chain.Address.TokenBalance do |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
{:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000") |
|
|
|
|
|
|
|
@burn_address_hash burn_address_hash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
@doc """ |
|
|
|
Builds an `Ecto.Query` to fetch the unfetched token balances. |
|
|
|
Builds an `Ecto.Query` to fetch the unfetched token balances. |
|
|
|
|
|
|
|
|
|
|
|