From ff1b7568d6762ec9a2cd84628347f9c2a5d6abb6 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 2 Sep 2019 10:51:14 +0300 Subject: [PATCH] fix tests --- .../lib/block_scout_web/views/chain_view.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex b/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex index 528cf3671f..3033dbc0fe 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/chain_view.ex @@ -3,8 +3,13 @@ defmodule BlockScoutWeb.ChainView do alias BlockScoutWeb.LayoutView - defp market_cap(:standard, exchange_rate) do - Decimal.mult(exchange_rate.available_supply, exchange_rate.usd_value) + defp market_cap(:standard, %{available_supply: available_supply, usd_value: usd_value}) + when is_nil(available_supply) or is_nil(usd_value) do + Decimal.new(0) + end + + defp market_cap(:standard, %{available_supply: available_supply, usd_value: usd_value}) do + Decimal.mult(available_supply, usd_value) end defp market_cap(module, exchange_rate) do