address_current_token_balances group by token_id

pull/3902/head
Viktor Baranov 4 years ago
parent a01f4ab2c5
commit 3fd1e91763
  1. 5
      apps/indexer/lib/indexer/token_balances.ex

@ -55,9 +55,10 @@ defmodule Indexer.TokenBalances do
address_token_balances address_token_balances
|> Enum.group_by(fn %{ |> Enum.group_by(fn %{
address_hash: address_hash, address_hash: address_hash,
token_contract_address_hash: token_contract_address_hash token_contract_address_hash: token_contract_address_hash,
token_id: token_id
} -> } ->
{address_hash, token_contract_address_hash} {address_hash, token_contract_address_hash, token_id}
end) end)
|> Enum.map(fn {_, grouped_address_token_balances} -> |> Enum.map(fn {_, grouped_address_token_balances} ->
Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end) Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end)

Loading…
Cancel
Save