transactions changes and docs

This commit is contained in:
drethereum 2025-02-26 11:30:47 -07:00
parent bf01e3486e
commit 1c926184f0
3 changed files with 170 additions and 15 deletions

View File

@ -18,6 +18,9 @@ There is more information on how to use dbt docs in the last section of this doc
### Testnet Tables (rise.testnet)
**Dimensional Tables:**
- [dim_contracts](https://flipsidecrypto.github.io/rise-models/#!/model/model.fsc_evm.core__dim_contracts)
**Fact Tables:**
- [fact_blocks](https://flipsidecrypto.github.io/rise-models/#!/model/model.fsc_evm.core__fact_blocks)
- [fact_event_logs](https://flipsidecrypto.github.io/rise-models/#!/model/model.fsc_evm.core__fact_event_logs)

View File

@ -66,18 +66,18 @@ WHERE
utils.udf_hex_to_int(
transaction_json :maxFeePerGas :: STRING
)
) / pow(
10,
9
) AS max_fee_per_gas,
) / pow(
10,
9
) AS max_fee_per_gas, --may not be present in transaction_json
TRY_TO_NUMBER(
utils.udf_hex_to_int(
transaction_json :maxPriorityFeePerGas :: STRING
)
) / pow(
10,
9
) AS max_priority_fee_per_gas,
) / pow(
10,
9
) AS max_priority_fee_per_gas, --may not be present in transaction_json
utils.udf_hex_to_int(
transaction_json :value :: STRING
) AS value_precise_raw,
@ -86,7 +86,21 @@ WHERE
18
) AS value_precise,
value_precise :: FLOAT AS VALUE,
utils.udf_hex_to_int(transaction_json :yParity :: STRING):: bigint AS y_parity,
utils.udf_hex_to_int(
transaction_json :yParity :: STRING
) :: bigint AS y_parity,
utils.udf_hex_to_int(
transaction_json :mint :: STRING
) AS mint_precise_raw,
utils.udf_decimal_adjust(
mint_precise_raw,
18
) AS mint_precise,
mint_precise :: FLOAT AS mint,
utils.udf_hex_to_int(
transaction_json :depositReceiptVersion :: STRING
) :: bigint AS deposit_receipt_version,
transaction_json :sourceHash :: STRING AS source_hash,
transaction_json :accessList AS access_list
FROM
base
@ -107,6 +121,38 @@ WHERE
txs.max_priority_fee_per_gas,
txs.y_parity,
txs.access_list,
utils.udf_hex_to_int(
r.receipts_json :l1BaseFeeScalar :: STRING
) :: bigint AS l1_base_fee_scalar,
utils.udf_hex_to_int(
r.receipts_json :l1BlobBaseFee :: STRING
) :: bigint AS l1_blob_base_fee,
utils.udf_hex_to_int(
r.receipts_json :l1BlobBaseFeeScalar :: STRING
) :: bigint AS l1_blob_base_fee_scalar,
utils.udf_hex_to_int(
r.receipts_json :l1Fee :: STRING
) AS l1_fee_precise_raw,
COALESCE(
l1_fee_precise_raw :: FLOAT,
0
) AS l1_fee,
utils.udf_decimal_adjust(
l1_fee_precise_raw,
18
) AS l1_fee_precise,
COALESCE(
utils.udf_hex_to_int(
r.receipts_json :l1GasUsed :: STRING
) :: FLOAT,
0
) AS l1_gas_used,
COALESCE(
utils.udf_hex_to_int(
r.receipts_json :l1GasPrice :: STRING
) :: FLOAT,
0
) AS l1_gas_price,
utils.udf_decimal_adjust(
txs.gas_price * utils.udf_hex_to_int(
r.receipts_json :gasUsed :: STRING
@ -142,7 +188,15 @@ WHERE
) :: bigint AS effective_gas_price,
txs.r,
txs.s,
txs.v
txs.v,
txs.source_hash,
utils.udf_hex_to_int(
r.receipts_json :depositNonce :: STRING
) :: bigint AS deposit_nonce,
txs.deposit_receipt_version,
txs.mint,
txs.mint_precise_raw,
txs.mint_precise
FROM
transactions_fields txs
LEFT JOIN {{ ref('testnet__fact_blocks') }}
@ -188,10 +242,42 @@ missing_data AS (
t.max_priority_fee_per_gas,
t.y_parity,
t.access_list,
utils.udf_hex_to_int(
r.receipts_json :l1BaseFeeScalar :: STRING
) :: bigint AS l1_base_fee_scalar_heal,
utils.udf_hex_to_int(
r.receipts_json :l1BlobBaseFee :: STRING
) :: bigint AS l1_blob_base_fee_heal,
utils.udf_hex_to_int(
r.receipts_json :l1BlobBaseFeeScalar :: STRING
) :: bigint AS l1_blob_base_fee_scalar_heal,
utils.udf_hex_to_int(
r.receipts_json :l1Fee :: STRING
) AS l1_fee_precise_raw_heal,
COALESCE(
l1_fee_precise_raw_heal :: FLOAT,
0
) AS l1_fee_heal,
utils.udf_decimal_adjust(
l1_fee_precise_raw_heal,
18
) AS l1_fee_precise_heal,
COALESCE(
utils.udf_hex_to_int(
r.receipts_json :l1GasUsed :: STRING
) :: FLOAT,
0
) AS l1_gas_used_heal,
COALESCE(
utils.udf_hex_to_int(
r.receipts_json :l1GasPrice :: STRING
) :: FLOAT,
0
) AS l1_gas_price_heal,
utils.udf_decimal_adjust(
t.gas_price * utils.udf_hex_to_int(
r.receipts_json :gasUsed :: STRING
) :: bigint,
) :: bigint,
9
) AS tx_fee_precise_heal,
COALESCE(
@ -220,7 +306,15 @@ missing_data AS (
) :: bigint AS effective_gas_price_heal,
t.r,
t.s,
t.v
t.v,
t.source_hash,
utils.udf_hex_to_int(
r.receipts_json :depositNonce :: STRING
) :: bigint AS deposit_nonce_heal,
t.deposit_receipt_version,
t.mint,
t.mint_precise_raw,
t.mint_precise
FROM
{{ this }}
t
@ -251,6 +345,12 @@ all_transactions AS (
max_priority_fee_per_gas,
y_parity,
access_list,
l1_base_fee_scalar,
l1_blob_base_fee,
l1_blob_base_fee_scalar,
l1_fee_precise_raw,
l1_fee,
l1_fee_precise,
tx_fee,
tx_fee_precise,
tx_succeeded,
@ -265,7 +365,13 @@ all_transactions AS (
effective_gas_price,
r,
s,
v
v,
source_hash,
deposit_nonce,
deposit_receipt_version,
mint,
mint_precise_raw,
mint_precise
FROM
new_transactions
@ -285,6 +391,12 @@ SELECT
max_priority_fee_per_gas,
y_parity,
access_list,
l1_base_fee_scalar_heal AS l1_base_fee_scalar,
l1_blob_base_fee_heal AS l1_blob_base_fee,
l1_blob_base_fee_scalar_heal AS l1_blob_base_fee_scalar,
l1_fee_precise_raw_heal AS l1_fee_precise_raw,
l1_fee_heal AS l1_fee,
l1_fee_precise_heal AS l1_fee_precise,
tx_fee_heal AS tx_fee,
tx_fee_precise_heal AS tx_fee_precise,
tx_succeeded_heal AS tx_succeeded,
@ -299,7 +411,13 @@ SELECT
effective_gas_price_heal AS effective_gas_price,
r,
s,
v
v,
source_hash,
deposit_nonce_heal AS deposit_nonce,
deposit_receipt_version,
mint,
mint_precise_raw,
mint_precise
FROM
missing_data
{% endif %}
@ -311,6 +429,9 @@ SELECT
from_address,
to_address,
origin_function_signature,
mint,
mint_precise_raw,
mint_precise,
VALUE,
value_precise_raw,
value_precise,
@ -328,11 +449,22 @@ SELECT
effective_gas_price,
max_fee_per_gas,
max_priority_fee_per_gas,
l1_fee,
l1_fee_precise_raw,
l1_fee_precise,
l1_gas_used,
l1_gas_price,
l1_base_fee_scalar,
l1_blob_base_fee,
l1_blob_base_fee_scalar,
y_parity,
access_list,
r,
s,
v,
deposit_nonce,
deposit_receipt_version,
source_hash,
{{ dbt_utils.generate_surrogate_key(['tx_hash']) }} AS fact_transactions_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
@ -343,4 +475,4 @@ FROM
block_number DESC,
block_timestamp DESC nulls last,
tx_succeeded DESC nulls last
) = 1
) = 1

View File

@ -60,10 +60,30 @@ models:
description: '{{ doc("evm_l1_fee") }}'
- name: L1_FEE_PRECISE_RAW
description: '{{ doc("evm_l1_fee_precise_raw") }}'
- name: L1_FEE_PRECISE
description: '{{ doc("evm_l1_fee_precise") }}'
- name: L1_BASE_FEE_SCALAR
description: '{{ doc("evm_l1_base_fee_scalar") }}'
- name: L1_BLOB_BASE_FEE
description: 'The base fee for the blob'
- name: L1_BLOB_BASE_FEE_SCALAR
description: 'The scalar for the blob base fee'
- name: L1_GAS_USED
description: '{{ doc("evm_l1_gas_used") }}'
- name: L1_GAS_PRICE
description: '{{ doc("evm_l1_gas_price") }}'
- name: Y_PARITY
description: '{{ doc("evm_y_parity") }}'
- name: ACCESS_LIST
description: '{{ doc("evm_access_list") }}'
- name: MINT
description: '{{ doc("evm_mint") }}'
- name: DEPOSIT_NONCE
description: 'The nonce of the deposit'
- name: DEPOSIT_RECEIPT_VERSION
description: 'The version of the deposit receipt'
- name: SOURCE_HASH
description: '{{ doc("evm_source_hash") }}'
- name: FACT_TRANSACTIONS_ID
description: '{{ doc("evm_pk") }}'
- name: INSERTED_TIMESTAMP