account
Никита Поздняков 3 years ago committed by Viktor Baranov
parent b55a965b26
commit 7bf89d3bd3
  1. 4
      apps/explorer/lib/explorer/accounts/notifier/summary.ex
  2. 3
      apps/explorer/test/explorer/accounts/notify/email_test.exs
  3. 12
      apps/explorer/test/explorer/accounts/notify/notify_test.exs
  4. 58
      apps/explorer/test/explorer/accounts/notify/summary_test.exs
  5. 4
      apps/explorer/test/support/factory.ex

@ -90,7 +90,7 @@ defmodule Explorer.Accounts.Notifier.Summary do
block_number: transaction.block_number,
amount: amount(transaction),
tx_fee: fee(transaction),
name: Application.get_env(:explorer, :coin_name),
name: Application.get_env(:explorer, :coin),
subject: "Coin transaction",
type: "COIN"
}
@ -105,7 +105,7 @@ defmodule Explorer.Accounts.Notifier.Summary do
block_number: transaction.block_number,
amount: amount(transaction),
tx_fee: fee(transaction),
name: Application.get_env(:explorer, :coin_name),
name: Application.get_env(:explorer, :coin),
subject: "Contract creation",
type: "COIN"
}

@ -1,9 +1,7 @@
defmodule Explorer.Accounts.Notify.EmailTest do
use ExUnit.Case
alias Explorer.Chain
alias Explorer.Chain.Address
alias Explorer.Chain.Hash
alias Explorer.Chain.Transaction
alias Explorer.Accounts.{
@ -48,7 +46,6 @@ defmodule Explorer.Accounts.Notify.EmailTest do
transaction_hash = %Transaction{hash: tx_hash}
{:ok, from_hash} = string_to_address_hash("0x092D537737E767Dae48c28aE509f34094496f030")
from_address_hash = %Address{hash: from_hash}
{:ok, to_hash} = string_to_address_hash("0xE1F4dd38f00B0D8D4d2b4B5010bE53F2A0b934E5")
to_address = %Address{hash: to_hash}

@ -7,7 +7,7 @@ defmodule Explorer.Accounts.Notify.NotifyTest do
alias Explorer.Accounts.Notifier.Notify
alias Explorer.Accounts.{WatchlistAddress, WatchlistNotification}
alias Explorer.Chain
alias Explorer.Chain.{Address, Token, TokenTransfer, Transaction, Wei}
alias Explorer.Chain.{Transaction, Wei}
alias Explorer.Repo
setup do
@ -59,14 +59,14 @@ defmodule Explorer.Accounts.Notify.NotifyTest do
address: address
} = insert(:account_watchlist_address)
watchlist_address = Repo.preload(wa, :address, watchlist: :identity)
_watchlist_address = Repo.preload(wa, :address, watchlist: :identity)
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
block_number: block_number,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
block_number: _block_number,
hash: _tx_hash
} = with_block(insert(:transaction, to_address: address))
{_, fee} = Chain.fee(tx, :gwei)

@ -6,7 +6,7 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
alias Explorer.Accounts.Notifier.Summary
alias Explorer.Chain
alias Explorer.Chain.{Address, Token, TokenTransfer, Transaction, Wei}
alias Explorer.Chain.{TokenTransfer, Transaction, Wei}
alias Explorer.Repo
describe "call" do
@ -41,9 +41,9 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
test "Pending Coin transaction (w/o block)" do
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
hash: _tx_hash
} = insert(:transaction)
assert Summary.process(tx) == []
@ -57,8 +57,8 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
tx =
%Transaction{
from_address: from_address,
block_number: block_number,
from_address: _from_address,
block_number: _block_number,
hash: tx_hash
} =
:transaction
@ -88,15 +88,15 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
test "ERC-20 Token transfer" do
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
block_number: block_number,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
block_number: _block_number,
hash: _tx_hash
} = with_block(insert(:transaction))
transfer =
%TokenTransfer{
amount: amount,
amount: _amount,
block_number: block_number,
from_address: from_address,
to_address: to_address,
@ -137,15 +137,15 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
block_number: block_number,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
block_number: _block_number,
hash: _tx_hash
} = with_block(insert(:transaction))
transfer =
%TokenTransfer{
amount: amount,
amount: _amount,
block_number: block_number,
from_address: from_address,
to_address: to_address
@ -166,8 +166,6 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
decimals = Decimal.new(Integer.pow(10, token_decimals))
amount = Decimal.div(transfer.amount, decimals)
assert Summary.process(transfer) == [
%Summary{
amount: 0,
@ -189,15 +187,15 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
block_number: block_number,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
block_number: _block_number,
hash: _tx_hash
} = with_block(insert(:transaction))
transfer =
%TokenTransfer{
amount: amount,
amount: _amount,
block_number: block_number,
from_address: from_address,
to_address: to_address
@ -218,8 +216,6 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
decimals = Decimal.new(Integer.pow(10, token_decimals))
amount = Decimal.div(transfer.amount, decimals)
assert Summary.process(transfer) == [
%Summary{
amount: 0,
@ -241,15 +237,15 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
tx =
%Transaction{
from_address: from_address,
to_address: to_address,
block_number: block_number,
hash: tx_hash
from_address: _from_address,
to_address: _to_address,
block_number: _block_number,
hash: _tx_hash
} = with_block(insert(:transaction))
transfer =
%TokenTransfer{
amount: amount,
amount: _amount,
block_number: block_number,
from_address: from_address,
to_address: to_address
@ -271,8 +267,6 @@ defmodule Explorer.Accounts.Notify.SummaryTest do
decimals = Decimal.new(Integer.pow(10, token_decimals))
amount = Decimal.div(transfer.amount, decimals)
assert Summary.process(transfer) == [
%Summary{
amount: 0,

@ -12,10 +12,8 @@ defmodule Explorer.Factory do
User,
UserContact,
Identity,
TagAddress,
Watchlist,
WatchlistAddress,
WatchlistNotification
WatchlistAddress
}
alias Explorer.Admin.Administrator

Loading…
Cancel
Save