Skip to content

Commit

Permalink
Merge branch 'main' into chore-add-csv-importer-script
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19-cw authored Apr 30, 2024
2 parents 9387137 + 64bb527 commit 03dc41a
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/eth/storage/csv/csv_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const HISTORICAL_NONCES_HEADERS: [&str; 6] = ["id", "address", "nonce", "block_n

const TRANSACTIONS_FILE: &str = "data/transactions";

const TRANSACTIONS_HEADERS: [&str; 21] = [
const TRANSACTIONS_HEADERS: [&str; 22] = [
"id",
"hash",
"signer_address",
Expand All @@ -77,6 +77,7 @@ const TRANSACTIONS_HEADERS: [&str; 21] = [
"created_at",
"updated_at",
"chain_id",
"contract_address",
];

const BLOCKS_FILE: &str = "data/blocks";
Expand Down Expand Up @@ -302,27 +303,28 @@ impl CsvExporter {
// export data
let now = now();
let row = [
self.transactions_id.value.to_string(), // id
to_bytea(tx.input.hash), // hash
to_bytea(tx.input.from), // signer_address
tx.input.nonce.to_string(), // nonce
to_bytea(tx.input.from), // address_from
tx.input.to.map(to_bytea).unwrap_or_default(), // address_to
to_bytea(tx.input.input), // input
to_bytea(tx.execution.output), // output
tx.execution.gas.to_string(), // gas
tx.input.gas_price.to_string(), // gas_price
tx.transaction_index.to_string(), // idx_in_block
tx.block_number.to_string(), // block_number
to_bytea(tx.block_hash), // block_hash
to_bytea(tx.input.v.as_u64().to_be_bytes()), // v
u256_to_bytea(tx.input.r), // r
u256_to_bytea(tx.input.s), // s
tx.input.value.to_string(), // value
tx.execution.result.to_string(), // result
now.clone(), // created_at
now, // updated_at
from_option(tx.input.chain_id), // chain_id
self.transactions_id.value.to_string(), // id
to_bytea(tx.input.hash), // hash
to_bytea(tx.input.from), // signer_address
tx.input.nonce.to_string(), // nonce
to_bytea(tx.input.from), // address_from
tx.input.to.map(to_bytea).unwrap_or_default(), // address_to
to_bytea(tx.input.input), // input
to_bytea(&tx.execution.output), // output
tx.execution.gas.to_string(), // gas
tx.input.gas_price.to_string(), // gas_price
tx.transaction_index.to_string(), // idx_in_block
tx.block_number.to_string(), // block_number
to_bytea(tx.block_hash), // block_hash
to_bytea(tx.input.v.as_u64().to_be_bytes()), // v
u256_to_bytea(tx.input.r), // r
u256_to_bytea(tx.input.s), // s
tx.input.value.to_string(), // value
tx.execution.result.to_string(), // result
now.clone(), // created_at
now, // updated_at
from_option(tx.input.chain_id), // chain_id
tx.execution.contract_address().map(to_bytea).unwrap_or_default(), // contract_address
];
self.transactions_csv.write_record(row).context("failed to write csv transaction")?;
}
Expand Down

0 comments on commit 03dc41a

Please sign in to comment.