remove unsafe :erlang.term_to_binary

pull/1396/head
Ayrat Badykov 6 years ago
parent 245a19121f
commit a852122c9c
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 8
      apps/explorer/lib/explorer/chain/supply/token_bridge.ex

@ -89,9 +89,7 @@ defmodule Explorer.Chain.Supply.TokenBridge do
cache_key = @cache_key cache_key = @cache_key
case :ets.lookup(@ets_table, @cache_key) do case :ets.lookup(@ets_table, @cache_key) do
[{^cache_key, {binary_coins, time}}] -> [{^cache_key, {coins, time}}] ->
coins = :erlang.binary_to_term(binary_coins)
{coins, time} {coins, time}
_ -> _ ->
@ -105,11 +103,9 @@ defmodule Explorer.Chain.Supply.TokenBridge do
|> Wei.sub(burned_coins()) |> Wei.sub(burned_coins())
|> Wei.to(:ether) |> Wei.to(:ether)
binary_total_coins = :erlang.term_to_binary(current_total_coins)
current_time = current_time() 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} {current_total_coins, current_time}
end end

Loading…
Cancel
Save