fix rsk marketcap

pull/2237/head
Ayrat Badykov 5 years ago
parent cb94abf419
commit 9f3e8eec89
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 5
      apps/explorer/lib/explorer/chain/supply/rsk.ex
  2. 2
      apps/explorer/test/explorer/chain/supply/rsk_test.exs

@ -12,7 +12,10 @@ defmodule Explorer.Chain.Supply.RSK do
alias Explorer.Repo
def market_cap(exchange_rate) do
ether = Wei.to(circulating(), :ether)
ether =
circulating()
|> Wei.to(:ether)
|> Decimal.div(Decimal.new(1_000))
Decimal.mult(ether, exchange_rate.usd_value)
end

@ -20,7 +20,7 @@ defmodule Explorer.Chain.Supply.RSKTest do
test "calculates market_cap" do
address = insert(:address, hash: @coin_address)
insert(:block, number: 0)
insert(:fetched_balance, value: 10_000_000_000_000_000_000, address_hash: address.hash, block_number: 0)
insert(:fetched_balance, value: 10_000_000_000_000_000_000_000, address_hash: address.hash, block_number: 0)
exchange_rate = %{Token.null() | usd_value: Decimal.new(10)}

Loading…
Cancel
Save