From a852122c9c4678493d52bc2f6a9c2136fe028a8d Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 31 Jan 2019 11:59:42 +0300 Subject: [PATCH] remove unsafe :erlang.term_to_binary --- apps/explorer/lib/explorer/chain/supply/token_bridge.ex | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex b/apps/explorer/lib/explorer/chain/supply/token_bridge.ex index 696055dcf9..179719f341 100644 --- a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex +++ b/apps/explorer/lib/explorer/chain/supply/token_bridge.ex @@ -89,9 +89,7 @@ defmodule Explorer.Chain.Supply.TokenBridge do cache_key = @cache_key case :ets.lookup(@ets_table, @cache_key) do - [{^cache_key, {binary_coins, time}}] -> - coins = :erlang.binary_to_term(binary_coins) - + [{^cache_key, {coins, time}}] -> {coins, time} _ -> @@ -105,11 +103,9 @@ defmodule Explorer.Chain.Supply.TokenBridge do |> Wei.sub(burned_coins()) |> Wei.to(:ether) - binary_total_coins = :erlang.term_to_binary(current_total_coins) - current_time = current_time() - :ets.insert(@ets_table, {@cache_key, {binary_total_coins, current_time}}) + :ets.insert(@ets_table, {@cache_key, {current_total_coins, current_time}}) {current_total_coins, current_time} end