arbitrum-models/models/gold/core__fact_blocks.sql
drethereum bc6332984b
AN-3534/arb-streamline-migration (#82)
* workflow changes

* models macro

* logs table docs

* gold layer changes

* silver legacy changes

* silver core tests

* timestamp cast type

* workflow changes schedule

* gas price column names
2023-07-11 10:54:30 -06:00

67 lines
1.3 KiB
SQL

{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true }
) }}
SELECT
block_number,
block_timestamp,
'mainnet' AS network,
'arbitrum' AS blockchain,
tx_count,
difficulty,
total_difficulty,
extra_data,
gas_limit,
gas_used,
HASH,
parent_hash,
receipts_root,
sha3_uncles,
SIZE,
uncles as uncle_blocks,
OBJECT_CONSTRUCT(
'baseFeePerGas',
base_fee_per_gas,
'difficulty',
difficulty,
'extraData',
extra_data,
'gasLimit',
gas_limit,
'gasUsed',
gas_used,
'hash',
HASH,
'logsBloom',
logs_bloom,
'miner',
miner,
'nonce',
nonce,
'number',
NUMBER,
'parentHash',
parent_hash,
'receiptsRoot',
receipts_root,
'sha3Uncles',
sha3_uncles,
'size',
SIZE,
'stateRoot',
state_root,
'timestamp',
block_timestamp,
'totalDifficulty',
total_difficulty,
'transactionsRoot',
transactions_root,
'uncles',
uncles
) AS block_header_json
FROM
{{ ref('silver__blocks') }}
LEFT JOIN {{ ref('silver__tx_count') }} USING (block_number)