update to views

This commit is contained in:
mattromano 2025-04-16 10:24:55 -07:00
parent f9d2e055fd
commit 9b868d2e08
5 changed files with 24 additions and 140 deletions

View File

@ -1,90 +0,0 @@
{% docs evm_batch_size %}
Total transactions included within the batch on the OP stack L2 chain.
{% enddocs %}
{% docs evm_max_block %}
The max block on the OP stack L2 chain this batch relates to.
{% enddocs %}
{% docs evm_min_block %}
The min block on the OP stack L2 chain this batch relates to.
{% enddocs %}
{% docs evm_batch_root %}
Root of the batch, either for submission or state on the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_block_no %}
The Ethereum block number that contained the batch from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_block_time %}
The timestamp of the Ethereum block that contained this batch from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_fee %}
The L1 portion of fees paid.
{% enddocs %}
{% docs evm_l1_fee_scalar %}
This value covers the change in L1 gas price between the time the transaction is submitted and when it is published from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_gas_price %}
The gas price for L1 transactions when the transaction was processed from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_gas_used %}
The gas used on L1 to publish the transaction from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_state_batch %}
The batch index of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_state_tx_hash %}
The L1 tx hash of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_sub_batch %}
The batch index of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
{% enddocs %}
{% docs evm_l1_sub_tx_hash %}
The L1 tx hash of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into an array column consisting of all L1 submission details from the OP stack L2 chain.
{% enddocs %}
{% docs evm_prev_total_elements %}
Confirmed blocks prior to this batch on the OP stack L2 chain.
{% enddocs %}

View File

@ -64,7 +64,7 @@ models:
- name: EVENT_REMOVED
description: '{{ doc("kaia_event_removed") }}'
- name: TX_SUCCEEDED
description: '{{ doc("kaia_tx_status") }}'
description: '{{ doc("evm_tx_succeeded") }}'
- name: TX_STATUS
description: '{{ doc("evm_column_deprecation_notice_tx_status") }}'
- name: EZ_DECODED_EVENT_LOGS_ID

View File

@ -8,6 +8,7 @@ SELECT
block_number,
block_timestamp,
tx_hash,
{# tx_position, #} -- new column
event_index,
origin_function_signature,
origin_from_address,
@ -22,12 +23,7 @@ SELECT
amount_usd,
decimals,
symbol,
COALESCE (
transfers_id,
{{ dbt_utils.generate_surrogate_key(
['tx_hash', 'event_index']
) }}
) AS ez_token_transfers_id,
transfers_id AS ez_token_transfers_id,
inserted_timestamp,
modified_timestamp,
token_price, --deprecate

View File

@ -1,26 +1,26 @@
{{ config(
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = "block_number",
cluster_by = "block_timestamp::date",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
tags = ['non_realtime']
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true }
) }}
SELECT
block_number,
block_timestamp,
tx_hash,
origin_function_signature,
origin_from_address,
origin_to_address,
event_index,
contract_address,
topics,
topics[0]::STRING AS topic_0, --new column
topics[1]::STRING AS topic_1, --new column
topics[2]::STRING AS topic_2, --new column
topics[3]::STRING AS topic_3, --new column
DATA,
event_removed,
origin_from_address,
origin_to_address,
origin_function_signature,
tx_status AS tx_succeeded,
_log_id,
logs_id AS fact_event_logs_id,
inserted_timestamp,
modified_timestamp
@ -30,12 +30,3 @@ FROM
'logs'
) }}
{% if is_incremental() %}
WHERE
modified_timestamp > (
SELECT
MAX(modified_timestamp)
FROM
{{ this }}
)
{% endif %}

View File

@ -1,36 +1,33 @@
{{ config(
materialized = 'incremental',
unique_key = "block_number",
incremental_strategy = 'delete+insert',
cluster_by = "block_timestamp::date",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
tags = ['non_realtime']
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true }
) }}
SELECT
block_number,
block_timestamp,
block_hash,
tx_hash,
nonce,
POSITION,
origin_function_signature,
from_address,
to_address,
origin_function_signature,
VALUE,
value_precise_raw,
value_precise,
tx_fee,
tx_fee_precise,
tx_status as tx_succeeded,
tx_type,
nonce,
POSITION as tx_position,
input_data,
gas_price,
gas_used,
effective_gas_price,
gas AS gas_limit,
gas_used,
cumulative_gas_used,
max_fee_per_gas,
max_priority_fee_per_gas,
input_data,
tx_status AS tx_succeeded,
r,
s,
v,
@ -41,14 +38,4 @@ FROM
{{ source(
'klaytn_silver',
'transactions'
) }}
{% if is_incremental() %}
WHERE
modified_timestamp > (
SELECT
MAX(modified_timestamp)
FROM
{{ this }}
)
{% endif %}
) }}