From 3fd1e91763669dc7e9778a45b65fc89b1f07ac9e Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Wed, 28 Apr 2021 19:33:00 +0300 Subject: [PATCH] address_current_token_balances group by token_id --- apps/indexer/lib/indexer/token_balances.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/indexer/lib/indexer/token_balances.ex b/apps/indexer/lib/indexer/token_balances.ex index 688583aa53..6b0aab725a 100644 --- a/apps/indexer/lib/indexer/token_balances.ex +++ b/apps/indexer/lib/indexer/token_balances.ex @@ -55,9 +55,10 @@ defmodule Indexer.TokenBalances do address_token_balances |> Enum.group_by(fn %{ 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) |> Enum.map(fn {_, grouped_address_token_balances} -> Enum.max_by(grouped_address_token_balances, fn %{block_number: block_number} -> block_number end)