diff --git a/apps/explorer/lib/explorer/chain/supply/rsk.ex b/apps/explorer/lib/explorer/chain/supply/rsk.ex index 305ff50429..37d04598ff 100644 --- a/apps/explorer/lib/explorer/chain/supply/rsk.ex +++ b/apps/explorer/lib/explorer/chain/supply/rsk.ex @@ -68,10 +68,10 @@ defmodule Explorer.Chain.Supply.RSK do case Map.get(by_day, date) do nil -> - {Map.put(days, date, last), last} + {Map.put(days, date, Decimal.sub(total(), last)), last} value -> - {Map.put(days, date, value.value), value.value} + {Map.put(days, date, Decimal.sub(total(), value.value)), value.value} end end) |> elem(0) diff --git a/apps/explorer/test/explorer/chain/supply/rsk_test.exs b/apps/explorer/test/explorer/chain/supply/rsk_test.exs index d22ed8fc02..9504ce5df4 100644 --- a/apps/explorer/test/explorer/chain/supply/rsk_test.exs +++ b/apps/explorer/test/explorer/chain/supply/rsk_test.exs @@ -4,7 +4,6 @@ defmodule Explorer.Chain.Supply.RSKTest do import Mox alias Explorer.Chain.Supply.RSK - alias Explorer.Chain.Wei alias Explorer.ExchangeRates.Token @coin_address "0x0000000000000000000000000000000001000006" @@ -45,9 +44,9 @@ defmodule Explorer.Chain.Supply.RSKTest do assert RSK.supply_for_days(2) == {:ok, %{ - date(now, days: -2) => dec(0), - date(now, days: -1) => dec(0), - date(now) => dec(0) + date(now, days: -2) => dec(21_000_000), + date(now, days: -1) => dec(21_000_000), + date(now) => dec(21_000_000) }} end @@ -62,9 +61,9 @@ defmodule Explorer.Chain.Supply.RSKTest do assert RSK.supply_for_days(2) == {:ok, %{ - date(now, days: -2) => dec(10), - date(now, days: -1) => dec(10), - date(now) => dec(10) + date(now, days: -2) => dec(20_999_990), + date(now, days: -1) => dec(20_999_990), + date(now) => dec(20_999_990) }} end @@ -82,9 +81,9 @@ defmodule Explorer.Chain.Supply.RSKTest do assert RSK.supply_for_days(2) == {:ok, %{ - date(now, days: -2) => dec(10), - date(now, days: -1) => dec(20), - date(now) => dec(20) + date(now, days: -2) => dec(20_999_990), + date(now, days: -1) => dec(20_999_980), + date(now) => dec(20_999_980) }} end @@ -105,9 +104,9 @@ defmodule Explorer.Chain.Supply.RSKTest do assert RSK.supply_for_days(2) == {:ok, %{ - date(now, days: -2) => dec(10), - date(now, days: -1) => dec(20), - date(now) => dec(20) + date(now, days: -2) => dec(20_999_990), + date(now, days: -1) => dec(20_999_980), + date(now) => dec(20_999_980) }} end @@ -128,9 +127,9 @@ defmodule Explorer.Chain.Supply.RSKTest do assert RSK.supply_for_days(2) == {:ok, %{ - date(now, days: -2) => dec(10), - date(now, days: -1) => dec(20), - date(now) => dec(30) + date(now, days: -2) => dec(20_999_990), + date(now, days: -1) => dec(20_999_980), + date(now) => dec(20_999_970) }} end end