remove cast! and dump! functions from Wei module

pull/2036/head
saneery 6 years ago
parent e0bed0ea1c
commit 83cca0aa28
  1. 15
      apps/explorer/lib/explorer/chain/wei.ex

@ -68,11 +68,6 @@ defmodule Explorer.Chain.Wei do
@impl Ecto.Type @impl Ecto.Type
def cast(_), do: :error def cast(_), do: :error
def cast!(arg) do
{:ok, wei} = cast(arg)
wei
end
@impl Ecto.Type @impl Ecto.Type
def dump(%__MODULE__{value: %Decimal{} = decimal}) do def dump(%__MODULE__{value: %Decimal{} = decimal}) do
{:ok, decimal} {:ok, decimal}
@ -81,11 +76,6 @@ defmodule Explorer.Chain.Wei do
@impl Ecto.Type @impl Ecto.Type
def dump(_), do: :error def dump(_), do: :error
def dump!(arg) do
{:ok, decimal} = dump(arg)
decimal
end
@impl Ecto.Type @impl Ecto.Type
def load(%Decimal{} = decimal) do def load(%Decimal{} = decimal) do
{:ok, %__MODULE__{value: decimal}} {:ok, %__MODULE__{value: decimal}}
@ -248,11 +238,6 @@ defmodule Explorer.Chain.Wei do
@spec to(t(), :wei) :: wei() @spec to(t(), :wei) :: wei()
def to(%__MODULE__{value: wei}, :wei), do: wei def to(%__MODULE__{value: wei}, :wei), do: wei
@spec to(t(), :integer) :: integer()
def to(%__MODULE__{value: wei}, :integer) do
Decimal.to_integer(wei)
end
end end
defimpl Inspect, for: Explorer.Chain.Wei do defimpl Inspect, for: Explorer.Chain.Wei do

Loading…
Cancel
Save