From 5d1441d515e9cc3bdc6719e7e91a5c3af875f2fe Mon Sep 17 00:00:00 2001 From: Felipe Renan Date: Wed, 24 Oct 2018 17:06:22 -0300 Subject: [PATCH] Do not store token_hash as address_hash in token balances We don't need this extraction because it will try to fetch the balance from the own token in its contract and it doesn't make sense for us. We will stop to store a lot of unnecessary data removing this extraction. --- apps/indexer/lib/indexer/address/token_balances.ex | 5 ----- apps/indexer/test/indexer/address/token_balances_test.exs | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/indexer/lib/indexer/address/token_balances.ex b/apps/indexer/lib/indexer/address/token_balances.ex index 4d47c0213a..eab8eaea91 100644 --- a/apps/indexer/lib/indexer/address/token_balances.ex +++ b/apps/indexer/lib/indexer/address/token_balances.ex @@ -30,11 +30,6 @@ defmodule Indexer.Address.TokenBalances do token_contract_address_hash: token_contract_address_hash, block_number: block_number }) - |> MapSet.put(%{ - address_hash: token_contract_address_hash, - token_contract_address_hash: token_contract_address_hash, - block_number: block_number - }) end) end diff --git a/apps/indexer/test/indexer/address/token_balances_test.exs b/apps/indexer/test/indexer/address/token_balances_test.exs index 885d42dcb9..3751fa4703 100644 --- a/apps/indexer/test/indexer/address/token_balances_test.exs +++ b/apps/indexer/test/indexer/address/token_balances_test.exs @@ -29,7 +29,7 @@ defmodule Indexer.Address.TokenBalancesTest do params_set = TokenBalances.params_set(%{token_transfers_params: [token_transfer_params]}) - assert MapSet.size(params_set) == 3 + assert MapSet.size(params_set) == 2 assert %{address_hash: from_address_hash, block_number: block_number} assert %{address_hash: to_address_hash, block_number: block_number} assert %{address_hash: token_contract_address_hash, block_number: block_number}