@ -8,16 +8,17 @@ defmodule Indexer.Address.TokenBalances do
end
end
defp reducer ( { :token_transfers_params , token_transfers_params } , initial ) when is_list ( token_transfers_params ) do
defp reducer ( { :token_transfers_params , token_transfers_params } , initial ) when is_list ( token_transfers_params ) do
Enum . reduce ( token_transfers_params , initial , fn %{
token_transfers_params
block_number : block_number ,
|> ignore_burn_address_transfers_for_token_erc_721
from_address_hash : from_address_hash ,
|> Enum . reduce ( initial , fn %{
to_address_hash : to_address_hash ,
block_number : block_number ,
token_contract_address_hash : token_contract_address_hash
from_address_hash : from_address_hash ,
} ,
to_address_hash : to_address_hash ,
acc
token_contract_address_hash : token_contract_address_hash
when is_integer ( block_number ) and is_binary ( from_address_hash ) and
} ,
is_binary ( to_address_hash ) and
acc
is_binary ( token_contract_address_hash ) ->
when is_integer ( block_number ) and is_binary ( from_address_hash ) and
is_binary ( to_address_hash ) and is_binary ( token_contract_address_hash ) ->
acc
acc
|> MapSet . put ( %{
|> MapSet . put ( %{
address_hash : from_address_hash ,
address_hash : from_address_hash ,
@ -36,4 +37,20 @@ defmodule Indexer.Address.TokenBalances do
} )
} )
end )
end )
end
end
defp ignore_burn_address_transfers_for_token_erc_721 ( token_transfers_params ) do
Enum . filter ( token_transfers_params , & do_filter_burn_address / 1 )
end
def do_filter_burn_address ( %{ from_address_hash : " 0x0000000000000000000000000000000000000000 " , token_type : " ERC-721 " } ) do
false
end
def do_filter_burn_address ( %{ to_address_hash : " 0x0000000000000000000000000000000000000000 " , token_type : " ERC-721 " } ) do
false
end
def do_filter_burn_address ( _token_balance_param ) do
true
end
end
end