|
|
@ -23,7 +23,7 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
insert(:token_balance, value_fetched_at: DateTime.utc_now()) |
|
|
|
insert(:token_balance, value_fetched_at: DateTime.utc_now()) |
|
|
|
|
|
|
|
|
|
|
|
assert TokenBalance.init([], &[&1 | &2], nil) == [ |
|
|
|
assert TokenBalance.init([], &[&1 | &2], nil) == [ |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, block_number, 0} |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, 1000, "ERC-20", nil, 0} |
|
|
|
] |
|
|
|
] |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -58,7 +58,7 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
assert TokenBalance.run( |
|
|
|
assert TokenBalance.run( |
|
|
|
[{address_hash_bytes, token_contract_address_hash_bytes, block_number, 0}], |
|
|
|
[{address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0}], |
|
|
|
nil |
|
|
|
nil |
|
|
|
) == :ok |
|
|
|
) == :ok |
|
|
|
|
|
|
|
|
|
|
@ -96,6 +96,8 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
{ |
|
|
|
{ |
|
|
|
token_balance_a.address_hash.bytes, |
|
|
|
token_balance_a.address_hash.bytes, |
|
|
|
token_balance_a.token_contract_address_hash.bytes, |
|
|
|
token_balance_a.token_contract_address_hash.bytes, |
|
|
|
|
|
|
|
"ERC-20", |
|
|
|
|
|
|
|
nil, |
|
|
|
token_balance_a.block_number, |
|
|
|
token_balance_a.block_number, |
|
|
|
# this token balance must be ignored |
|
|
|
# this token balance must be ignored |
|
|
|
max_retries |
|
|
|
max_retries |
|
|
@ -103,6 +105,8 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
{ |
|
|
|
{ |
|
|
|
token_balance_b.address_hash.bytes, |
|
|
|
token_balance_b.address_hash.bytes, |
|
|
|
token_balance_b.token_contract_address_hash.bytes, |
|
|
|
token_balance_b.token_contract_address_hash.bytes, |
|
|
|
|
|
|
|
"ERC-20", |
|
|
|
|
|
|
|
nil, |
|
|
|
token_balance_b.block_number, |
|
|
|
token_balance_b.block_number, |
|
|
|
# this token balance still have to be retried |
|
|
|
# this token balance still have to be retried |
|
|
|
max_retries - 2 |
|
|
|
max_retries - 2 |
|
|
@ -136,8 +140,8 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
|
|
|
|
|
|
|
|
assert TokenBalance.run( |
|
|
|
assert TokenBalance.run( |
|
|
|
[ |
|
|
|
[ |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, block_number, 0}, |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0}, |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, block_number, 0} |
|
|
|
{address_hash_bytes, token_contract_address_hash_bytes, block_number, "ERC-20", nil, 0} |
|
|
|
], |
|
|
|
], |
|
|
|
nil |
|
|
|
nil |
|
|
|
) == :ok |
|
|
|
) == :ok |
|
|
@ -177,7 +181,9 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
%{ |
|
|
|
%{ |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
block_number: 19999, |
|
|
|
block_number: 19999, |
|
|
|
token_contract_address_hash: to_string(contract.contract_address_hash) |
|
|
|
token_contract_address_hash: to_string(contract.contract_address_hash), |
|
|
|
|
|
|
|
token_type: "ERC-20", |
|
|
|
|
|
|
|
token_id: nil |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
@ -195,12 +201,16 @@ defmodule Indexer.Fetcher.TokenBalanceTest do |
|
|
|
%{ |
|
|
|
%{ |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
block_number: 19999, |
|
|
|
block_number: 19999, |
|
|
|
token_contract_address_hash: to_string(contract.contract_address_hash) |
|
|
|
token_contract_address_hash: to_string(contract.contract_address_hash), |
|
|
|
|
|
|
|
token_id: 11, |
|
|
|
|
|
|
|
token_type: "ERC-20" |
|
|
|
}, |
|
|
|
}, |
|
|
|
%{ |
|
|
|
%{ |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
address_hash: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", |
|
|
|
block_number: 19999, |
|
|
|
block_number: 19999, |
|
|
|
token_contract_address_hash: to_string(contract2.contract_address_hash) |
|
|
|
token_contract_address_hash: to_string(contract2.contract_address_hash), |
|
|
|
|
|
|
|
token_id: 11, |
|
|
|
|
|
|
|
token_type: "ERC-20" |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|