|
|
|
@ -427,28 +427,18 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do |
|
|
|
|
if valid_internal_transactions_count == 0 do |
|
|
|
|
{:ok, nil} |
|
|
|
|
else |
|
|
|
|
created_contract_address_hash_map = |
|
|
|
|
valid_internal_transactions |
|
|
|
|
|> Enum.group_by(& &1.transaction_hash) |
|
|
|
|
|> Enum.map(fn {transaction_hash, internal_transactions} -> |
|
|
|
|
{transaction_hash, Enum.find_value(internal_transactions, & &1[:created_contract_address_hash])} |
|
|
|
|
end) |
|
|
|
|
|> Enum.into(%{}) |
|
|
|
|
|
|
|
|
|
params = |
|
|
|
|
valid_internal_transactions |
|
|
|
|
|> Enum.filter(fn internal_tx -> |
|
|
|
|
internal_tx[:index] == 0 |
|
|
|
|
end) |
|
|
|
|
|> Enum.map(fn trace -> |
|
|
|
|
transaction_hash = Map.get(trace, :transaction_hash) |
|
|
|
|
|
|
|
|
|
%{ |
|
|
|
|
block_hash: Map.get(trace, :block_hash), |
|
|
|
|
block_number: Map.get(trace, :block_number), |
|
|
|
|
gas_used: Map.get(trace, :gas_used), |
|
|
|
|
transaction_hash: transaction_hash, |
|
|
|
|
created_contract_address_hash: created_contract_address_hash_map[transaction_hash], |
|
|
|
|
transaction_hash: Map.get(trace, :transaction_hash), |
|
|
|
|
created_contract_address_hash: Map.get(trace, :created_contract_address_hash), |
|
|
|
|
error: Map.get(trace, :error), |
|
|
|
|
status: if(is_nil(Map.get(trace, :error)), do: :ok, else: :error) |
|
|
|
|
} |
|
|
|
|