parse block hash from logs

pull/2888/head
Ayrat Badykov 5 years ago
parent 99cb7972ae
commit 2aac092960
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/log.ex
  2. 2
      apps/explorer/lib/explorer/chain/import/runner/token_transfers.ex
  3. 2
      apps/explorer/lib/explorer/chain/token_transfer.ex

@ -84,6 +84,7 @@ defmodule EthereumJSONRPC.Log do
%{ %{
"address" => address_hash, "address" => address_hash,
"blockNumber" => block_number, "blockNumber" => block_number,
"blockHash" => block_hash,
"data" => data, "data" => data,
"logIndex" => index, "logIndex" => index,
"topics" => topics, "topics" => topics,
@ -93,6 +94,7 @@ defmodule EthereumJSONRPC.Log do
%{ %{
address_hash: address_hash, address_hash: address_hash,
block_number: block_number, block_number: block_number,
block_hash: block_hash,
data: data, data: data,
index: index, index: index,
transaction_hash: transaction_hash transaction_hash: transaction_hash

@ -55,7 +55,7 @@ defmodule Explorer.Chain.Import.Runner.TokenTransfers do
on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0) on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0)
# Enforce TokenTransfer ShareLocks order (see docs: sharelocks.md) # Enforce TokenTransfer ShareLocks order (see docs: sharelocks.md)
ordered_changes_list = Enum.sort_by(changes_list, &{&1.transaction_hash, &1.log_index}) ordered_changes_list = Enum.sort_by(changes_list, &{&1.transaction_hash, &1.block_hash, &1.log_index})
{:ok, _} = {:ok, _} =
Import.insert_changes_list( Import.insert_changes_list(

@ -114,7 +114,7 @@ defmodule Explorer.Chain.TokenTransfer do
timestamps() timestamps()
end end
@required_attrs ~w(block_number log_index from_address_hash to_address_hash token_contract_address_hash transaction_hash)a @required_attrs ~w(block_number log_index from_address_hash to_address_hash token_contract_address_hash transaction_hash block_hash)a
@optional_attrs ~w(amount token_id)a @optional_attrs ~w(amount token_id)a
@doc false @doc false

Loading…
Cancel
Save