From 2ed95197e9abc6444bad1a5398c84e82d3e02839 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Wed, 24 Jul 2024 21:46:42 +0000 Subject: [PATCH 01/29] init --- models/rollup_economics/ethereum/_schema.yml | 73 +++ .../ethereum/l1_blob_fees.sql | 46 -- .../ethereum/l1_blob_fees/_schema.yml | 54 ++ .../rollup_economics_l1_blob_fees.sql | 66 +++ .../ethereum/l1_data_fees.sql | 466 ------------------ .../ethereum/l1_data_fees/_schema.yml | 57 +++ .../l1_data_fees/platforms/_schema.yml | 82 +++ .../rollup_economics_linea_l1_data_fees.sql | 36 ++ .../rollup_economics_zksync_l1_data_fees.sql | 52 ++ .../rollup_economics_l1_data_fees.sql | 71 +++ models/rollup_economics/ethereum/l1_fees.sql | 79 ++- .../ethereum/l1_verification_fees.sql | 192 -------- .../ethereum/l1_verification_fees/_schema.yml | 57 +++ .../platforms/_schema.yml | 82 +++ ...p_economics_linea_l1_verification_fees.sql | 36 ++ ..._economics_zksync_l1_verification_fees.sql | 46 ++ .../rollup_economics_l1_verification_fees.sql | 71 +++ .../rollup_economics/ethereum/l2_revenue.sql | 301 +---------- .../rollup_economics_ethereum_schema.yml | 133 ----- 19 files changed, 837 insertions(+), 1163 deletions(-) create mode 100644 models/rollup_economics/ethereum/_schema.yml delete mode 100644 models/rollup_economics/ethereum/l1_blob_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_blob_fees/_schema.yml create mode 100644 models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql delete mode 100644 models/rollup_economics/ethereum/l1_data_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_data_fees/_schema.yml create mode 100644 models/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml create mode 100644 models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql delete mode 100644 models/rollup_economics/ethereum/l1_verification_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_verification_fees/_schema.yml create mode 100644 models/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml create mode 100644 models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql create mode 100644 models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql delete mode 100644 models/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml diff --git a/models/rollup_economics/ethereum/_schema.yml b/models/rollup_economics/ethereum/_schema.yml new file mode 100644 index 00000000000..cc88c4c33c6 --- /dev/null +++ b/models/rollup_economics/ethereum/_schema.yml @@ -0,0 +1,73 @@ +version: 2 + +models: + - name: l1_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable + config: + tags: ['rollup', 'l2'] + description: Gas fees paid by rollups for posting transaction data or state updates on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &day + name: day + description: "The day when relevant transactions occurred by each rollup" + - &data_fee_native + name: data_fee_native + description: "Fee spent on calldata gas by the transaction (in ETH)" + - &data_fee_usd + name: data_fee_usd + description: "Fee spent on calldata gas by the transaction (in USD)" + - &verification_fee_native + name: verification_fee_native + description: "Fee spent on calldata gas for proof verification by the transaction (in ETH)" + - &verification_fee_usd + name: verification_fee_usd + description: "Fee spent on calldata gas for proof verification by the transaction (in USD)" + - &blob_fee_native + name: blob_fee_native + description: "Fee spent on blob gas by the transaction (in ETH)" + - &blob_fee_usd + name: blob_fee_usd + description: "Fee spent on blob gas by the transaction (in USD)" + - &l1_fee_native + name: l1_fee_native + description: "Total amount paid in gas fees (in ETH)" + - &l1_fee_usd + name: l1_fee_usd + description: "Total amount paid in gas fees (in USD)" + + - name: l2_revenue + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable + config: + tags: ['rollup', 'l2'] + description: "Gas fees earned by rollup on L2" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - day + columns: + - *day + - *name + - &l2_rev + name: l2_rev + description: "Total amount of revenue earned from gas fees (in ETH)" + - &l2_rev_usd + name: l2_rev_usd + description: "Total amount of revenue earned from gas fees (in USD)" + \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_blob_fees.sql b/models/rollup_economics/ethereum/l1_blob_fees.sql deleted file mode 100644 index ba88a6036fe..00000000000 --- a/models/rollup_economics/ethereum/l1_blob_fees.sql +++ /dev/null @@ -1,46 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_blob_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "maybeYonas"]\') }}' -)}} - -SELECT -lower(blob_submitter_label) as name, -tx_hash as hash, -block_time, -block_number, -blob_gas_used, -blob_base_fee, -(blob_gas_used*blob_base_fee)/1e18 as blob_spend, -p.price * (blob_gas_used*blob_base_fee)/1e18 as blob_spend_usd, -blob_count -FROM {{ ref('ethereum_blob_submissions')}} s -INNER JOIN {{ source('prices','usd') }} p -ON p.minute = date_trunc('minute', s.block_time) -AND p.blockchain is null -AND p.symbol = 'ETH' -AND p.minute >= timestamp '2024-03-13' -AND s.block_time >= timestamp '2024-03-13' -{% if is_incremental() %} -AND s.block_time >= date_trunc('day', now() - interval '7' day) -AND p.minute >= date_trunc('day', now() - interval '7' day) -{% endif %} -AND s.blob_submitter_label IN ('Arbitrum', -'Linea', -'zkSync Era', -'Base', -'Scroll', -'Zora', -'Public Goods Network', -'OP Mainnet', -'Starknet', -'Mode', -'Blast' -) \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_blob_fees/_schema.yml b/models/rollup_economics/ethereum/l1_blob_fees/_schema.yml new file mode 100644 index 00000000000..8735d4b6e63 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_blob_fees/_schema.yml @@ -0,0 +1,54 @@ +version: 2 + +models: + - name: rollup_economics_l1_blob_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by rollups for blob gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &block_month + name: block_month + description: "UTC event block month of each transaction" + - &block_date + name: block_date + description: "UTC event block date of each transaction" + - &block_time + name: block_time + description: "UTC event block time of each transaction" + - &block_number + name: block_number + description: "Block number of each transaction" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_index + name: tx_index + description: "Transaction index" + - &blob_base_fee + name: blob_base_fee + description: "Base fee per blob gas (in wei)" + - &blob_gas_used + name: blob_gas_used + description: "Total blob gas used in the transaction" + - &blob_fee_native + name: blob_fee_native + description: "Fee spent on blob gas by the transaction (in ETH)" + - &blob_fee_usd + name: blob_fee_usd + description: "Fee spent on blob gas by the transaction (in USD)" + - &blob_count + name: blob_count + description: "Number of blobs submitted in the transaction" \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql new file mode 100644 index 00000000000..985f1399a9c --- /dev/null +++ b/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -0,0 +1,66 @@ +{{ config( + schema = 'rollup_economics_ethereum', + alias = 'l1_blob_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['name', 'tx_hash'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "maybeYonas", "lgingerich"]\') }}' +)}} + +WITH blob_txs AS ( + SELECT + lower(b.blob_submitter_label) AS name + , cast(date_trunc('month', b.block_time) AS date) AS block_month + , cast(date_trunc('day', b.block_time) AS date) AS block_date + , b.block_time + , b.block_number + , b.tx_hash + , b.tx_index + , b.blob_base_fee + , b.blob_gas_used + , (b.blob_base_fee / 1e18) * b.blob_gas_used AS blob_fee_native + , (b.blob_base_fee / 1e18) * b.blob_gas_used * p.price AS blob_fee_usd + , b.blob_count + FROM {{ ref('ethereum_blob_submissions')}} b + INNER JOIN {{ source('prices', 'usd') }} p + ON p.minute = date_trunc('minute', b.block_time) + AND p.blockchain IS NULL + AND p.symbol = 'ETH' + AND p.minute >= TIMESTAMP '2024-03-13' + {% if is_incremental() %} + WHERE {{incremental_predicate('b.block_time')}} + AND {{incremental_predicate('p.minute')}} + {% endif %} + AND b.blob_submitter_label IN ( + 'Arbitrum' + , 'Linea' + , 'zkSync Era' + , 'Base' + , 'Scroll' + , 'Zora' + , 'Public Goods Network' + , 'OP Mainnet' + , 'Starknet' + , 'Mode' + , 'Blast' + ) +) + +SELECT + name + , block_month + , block_date + , block_time + , block_number + , tx_hash + , tx_index + , blob_base_fee + , blob_gas_used + , blob_fee_native + , blob_fee_usd + , blob_count +FROM blob_txs \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees.sql deleted file mode 100644 index e640c67fc34..00000000000 --- a/models/rollup_economics/ethereum/l1_data_fees.sql +++ /dev/null @@ -1,466 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_data_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable"]\') }}' -)}} - -with tx_batch_appends as ( - SELECT - 'arbitrum' as name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM - ( - SELECT - evt_tx_hash as tx_hash, - evt_block_time as block_time, - evt_block_number as block_number - FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOrigin') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2Batch') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOriginWithGasRefunder') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - hash as tx_hash, - block_time, - block_number - FROM {{ source('ethereum','transactions') }} - WHERE "from" = 0xC1b634853Cb333D3aD8663715b08f41A3Aec47cc - AND to = 0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6 - AND bytearray_substring(data, 1, 4) = 0x3e5aa082 --addSequencerL2BatchFromBlobs - AND block_number >= 19433943 --when arbitrum started submitting blobs - {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - ) b - INNER JOIN {{ source('ethereum','transactions') }} t - ON b.tx_hash = t.hash - AND b.block_number = t.block_number - AND t.success = true - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - lower(protocol_name) as name, - block_number, - hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - data_length, - gas_used, - calldata_gas_used - FROM ( - SELECT protocol_name, t.block_time, t.block_number, t.hash, t.gas_used, t.gas_price, length(t.data) as data_length, {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} as t - INNER JOIN {{ ref('addresses_ethereum_optimism_batchinbox_combinations') }} as op - ON t."from" = op.l1_batch_inbox_from_address - AND t.to = op.l1_batch_inbox_to_address - WHERE t.block_time >= timestamp '2020-01-01' - UNION ALL - SELECT protocol_name, t.block_time, t.block_number, t.hash, t.gas_used, t.gas_price, length(t.data) as data_length, {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} as t - INNER JOIN {{ ref('addresses_ethereum_optimism_outputoracle_combinations') }} as op - ON t."from" = op.l2_output_oracle_from_address - AND t.to = op.l2_output_oracle_to_address - WHERE t.block_time >= timestamp '2020-01-01' - ) b - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', b.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - AND p.minute >= timestamp '2020-01-01' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - {% if is_incremental() %} - WHERE b.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'starknet' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - t.to = 0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4 -- StateUpdate proxy contract - AND bytearray_substring(t.data, 1, 4) IN (0x77552641, 0xb72d42a1) -- updateState, updateStateKzgDA - ) - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'imx' AS chain, -- imx state updates to L1 through the Data Availability Committee, imx uses offchain DA - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - (t.to = 0x5FDCCA53617f4d2b9134B29090C87D01058e27e9 OR t.to = 0x16BA0f221664A5189cf2C1a7AF0d3AbFc70aA295) - AND (bytearray_substring(t.data, 1, 4) = 0x538f9406 OR bytearray_substring(t.data, 1, 4) = 0x504f7f6f) -- StateUpdate & Verify Availability Proof - ) - AND t.block_time >= timestamp '2021-03-24' -- mainnet launch date - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'zksync lite' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE - ( - t."from" = 0xda7357bbce5e8c616bc7b0c3c86f0c71c5b4eabb -- Old L2 Operator - OR t."from" = 0x18c208921F7a741510a7fc0CfA51E941735DAE54 -- L2 Operator - OR t."from" = 0x01c3a1a6890a146ac187a019f9863b3ab2bff91e -- L2 Operator V1 - ) - AND t.to = 0xabea9132b05a70803a4e85094fd0e1800777fbef -- zksync - AND bytearray_substring(t.data, 1, 4) = 0x45269298 -- Commit Block - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'zksync era' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - -- L1 transactions settle here post-Boojum - OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - -- L1 transactions settle here post-EIP4844 - OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD - ) - AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x0c4dd810 -- Commit Block - OR - bytearray_substring(t.data, 1, 4) = 0xce9dcf16 -- Execute Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x701f58c5 -- Commit Batches - OR - bytearray_substring(t.data, 1, 4) = 0xc3d93e7c -- Execute Batches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'polygon zkevm' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE - ( - t.to = 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 -- old proxy - OR t.to = 0x519E42c24163192Dca44CD3fBDCEBF6be9130987 -- new proxy (as of block 19218878) - ) - AND bytearray_substring(t.data, 1, 4) IN ( - 0x5e9145c9, -- sequenceBatches - 0xecef3f99, -- sequenceBatches (as of block 19218878) - 0xdef57e54 -- sequenceBatches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'linea' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service - AND bytearray_substring(t.data, 1, 4) IN ( - 0x7a776315, -- submitData (Aplha v2 Release at block. 19222438) - 0x2d3c12e5 -- submitBlobData - ) - AND t.block_time >= timestamp '2023-07-12' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'scroll' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 - AND bytearray_substring(t.data, 1, 4) = 0x1325aca0 -- Commit Batch - AND t.block_time >= timestamp '2023-10-07' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'loopring' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS input_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x153CdDD727e407Cb951f728F24bEB9A5FaaA8512 - AND bytearray_substring(t.data, 1, 4) = 0xdcb2aa31 -- submitBlocksWithCallbacks (proof verified immediately) - AND t.block_time >= timestamp '2021-03-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'Mantle' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS input_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - t.to = 0xD1328C9167e0693B689b5aa5a024379d4e437858 -- Rollup Proxy (last used as of block 19437175) - OR t.to = 0x31d543e7BE1dA6eFDc2206Ef7822879045B9f481 -- L2OutputOracle Proxy (used as of block 19440324) - OR t.to = 0x50Fa427235C7C8cAA4A0C21b5009f5a0d015B23A -- BVM_EigenDataLayrChain Proxy (DA1) (last used as of block 19437271) - OR t.to = 0x5BD63a7ECc13b955C4F57e3F12A64c10263C14c1 -- DataLayrServiceManager Proxy (DA2) (used as of block 19439557) - ) - AND ( - bytearray_substring(t.data, 1, 4) = 0x49cd3004 -- createAssertionWithStateBatch - OR bytearray_substring(t.data, 1, 4) = 0x9aaab648 -- proposeL2Output - OR bytearray_substring(t.data, 1, 4) = 0x5e4a3056 -- storeData (DA1) - OR bytearray_substring(t.data, 1, 4) = 0x4618ed87 -- confirmData (DA1) - OR bytearray_substring(t.data, 1, 4) = 0x58942e73 -- confirmDataStore (DA2) - OR bytearray_substring(t.data, 1, 4) = 0xdcf49ea7 -- initDataStore (DA2) - ) - AND t.block_time >= timestamp '2023-06-27' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - -,block_basefees as ( - SELECT - b.number as block_number - , b.base_fee_per_gas - , b.time - FROM {{ source('ethereum','blocks') }} as b - WHERE b.time >= timestamp '2021-03-23' - {% if is_incremental() %} - AND b.time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - - -SELECT - txs.name, - txs.hash, - bxs.time as block_time, - txs.block_number, - txs.data_length, - gas_spent, - gas_spent_usd, - gas_used, - calldata_gas_used -FROM tx_batch_appends txs -INNER JOIN block_basefees bxs - ON txs.block_number = bxs.block_number diff --git a/models/rollup_economics/ethereum/l1_data_fees/_schema.yml b/models/rollup_economics/ethereum/l1_data_fees/_schema.yml new file mode 100644 index 00000000000..9e8dc5654a4 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_data_fees/_schema.yml @@ -0,0 +1,57 @@ +version: 2 + +models: + - name: rollup_economics_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by rollups for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &block_month + name: block_month + description: "UTC event block month of each transaction" + - &block_date + name: block_date + description: "UTC event block date of each transaction" + - &block_time + name: block_time + description: "UTC event block time of each transaction" + - &block_number + name: block_number + description: "Block number of each transaction" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_index + name: tx_index + description: "Transaction index" + - &gas_price + name: gas_price + description: "Gas price (in WEI) of transaction" + - &gas_used + name: gas_used + description: "Amount of gas units consumed by the transaction" + - &data_fee_native + name: data_fee_native + description: "Fee spent on calldata gas by the transaction (in ETH)" + - &data_fee_usd + name: data_fee_usd + description: "Fee spent on calldata gas by the transaction (in USD)" + - &calldata_gas_used + name: calldata_gas_used + description: "Gas units used by calldata (input data) by L1 Transactions" + - &data_length + name: data_length + description: "Byte length of the data posted to l1" \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml b/models/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml new file mode 100644 index 00000000000..7371f55d1d2 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml @@ -0,0 +1,82 @@ +version: 2 + +models: + - name: rollup_economics_linea_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Linea for blob gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &block_month + name: block_month + description: "UTC event block month of each transaction" + - &block_date + name: block_date + description: "UTC event block date of each transaction" + - &block_time + name: block_time + description: "UTC event block time of each transaction" + - &block_number + name: block_number + description: "Block number of each transaction" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_index + name: tx_index + description: "Transaction index" + - &gas_price + name: gas_price + description: "Gas price of transaction (in wei)" + - &gas_used + name: gas_used + description: "Amount of gas units consumed by the transaction" + - &data_fee_native + name: data_fee_native + description: "Fee spent on calldata gas by the transaction (in ETH)" + - &calldata_gas_used + name: calldata_gas_used + description: "Gas units used by calldata (input data) by the transaction" + - &data_length + name: data_length + description: "Byte length of the data posted to l1" + + - name: rollup_economics_zksync_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by ZKsync Era for blob gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql new file mode 100644 index 00000000000..244e359d21c --- /dev/null +++ b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql @@ -0,0 +1,36 @@ +{{ config( + schema = 'rollup_economics_linea', + alias = 'l1_data_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['name', 'tx_hash'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'linea' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +AND bytearray_substring(t.data, 1, 4) IN ( + 0x7a776315 -- submitData (Aplha v2 Release at block. 19222438) + , 0x2d3c12e5 -- submitBlobData +) +AND t.block_time >= TIMESTAMP '2023-07-12' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql new file mode 100644 index 00000000000..bea9fdf46e8 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'rollup_economics_zksync', + alias = 'l1_data_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'zksync' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE ( + -- L1 transactions settle here pre-Boojum + t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 + OR + -- L1 transactions settle here post-Boojum + t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 + OR + -- L1 transactions settle here post-EIP4844 + t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD +) +AND ( + -- L1 transactions use these method ID's pre-Boojum + bytearray_substring(t.data, 1, 4) = 0x0c4dd810 -- Commit Block + OR + bytearray_substring(t.data, 1, 4) = 0xce9dcf16 -- Execute Block + OR + -- L1 transactions use these method ID's post-Boojum + bytearray_substring(t.data, 1, 4) = 0x701f58c5 -- Commit Batches + OR + bytearray_substring(t.data, 1, 4) = 0xc3d93e7c -- Execute Batches +) +AND t.block_time >= TIMESTAMP '2023-03-24' -- ZKsync Era public mainnet launch date +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql new file mode 100644 index 00000000000..9fc321ecf8a --- /dev/null +++ b/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -0,0 +1,71 @@ +{{ config( + schema = 'rollup_economics' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["lgingerich"]\') }}' +)}} + +{% set base_models = [ + ref('rollup_economics_linea_l1_data_fees') + , ref('rollup_economics_zksync_l1_data_fees') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + name + , block_month + , block_date + , block_time + , block_number + , tx_hash + , evt_index + , gas_price + , gas_used + , data_fee_native + , calldata_gas_used + , data_length + FROM + {{ base_model }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('block_time') }} + {% endif %} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +SELECT + b.name + , b.block_month + , b.block_date + , b.block_time + , b.block_number + , b.tx_hash + , b.tx_index + , b.gas_price + , b.gas_used + , b.data_fee_native + , b.data_fee_native * p.price AS data_fee_usd + , b.calldata_gas_used + , b.data_length +FROM base_union b +INNER JOIN {{ source('prices', 'usd') }} p + ON p.minute = date_trunc('minute', b.block_time) + AND p.blockchain IS NULL + AND p.symbol = 'ETH' + AND p.minute >= TIMESTAMP '2024-03-13' +{% if is_incremental() %} +WHERE {{incremental_predicate('b.block_time')}} +AND {{incremental_predicate('p.minute')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_fees.sql b/models/rollup_economics/ethereum/l1_fees.sql index 6433b07d2d5..732a0deec0c 100644 --- a/models/rollup_economics/ethereum/l1_fees.sql +++ b/models/rollup_economics/ethereum/l1_fees.sql @@ -13,59 +13,58 @@ WITH l1_data AS ( SELECT - date_trunc('day',block_time) as day, - name, - SUM(gas_spent) as l1_data_fee, - SUM(gas_spent_usd) as l1_data_fee_usd - FROM {{ ref('l1_data_fees')}} + date_trunc('day', block_time) as day + , name + , SUM(data_fee_native) as data_fee_native + , SUM(data_fee_usd) as data_fee_usd + FROM {{ ref('rollup_economics_l1_data_fees')}} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{incremental_predicate('block_time')}} {% endif %} - GROUP BY 1,2 -), + GROUP BY 1, 2 +) -l1_verification AS ( +, l1_verification AS ( SELECT - date_trunc('day',block_time) as day, - name, - SUM(gas_spent) as l1_verification_fee, - SUM(gas_spent_usd) as l1_verification_fee_usd - FROM {{ ref('l1_verification_fees')}} + date_trunc('day', block_time) as day + , name + , SUM(verification_fee_native) as verification_fee_native + , SUM(verification_fee_usd) as verification_fee_usd + FROM {{ ref('rollup_economics_l1_verification_fees')}} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{incremental_predicate('block_time')}} {% endif %} - GROUP BY 1,2 + GROUP BY 1, 2 ), l1_blobs AS ( SELECT - date_trunc('day',block_time) as day, - name, - SUM(blob_spend) as l1_blob_fee, - SUM(blob_spend_usd) as l1_blob_fee_usd - FROM {{ ref('l1_blob_fees')}} + date_trunc('day', block_time) as day + , name + , SUM(blob_fee_native) as blob_fee_native + , SUM(blob_fee_usd) as blob_fee_usd + FROM {{ ref('rollup_economics_l1_blob_fees')}} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' day) + WHERE {{incremental_predicate('block_time')}} {% endif %} - GROUP BY 1,2 + GROUP BY 1, 2 ) SELECT -d.day, -d.name, -l1_data_fee, -l1_data_fee_usd, -l1_verification_fee, -l1_verification_fee_usd, -l1_blob_fee, -l1_blob_fee_usd, -l1_data_fee + l1_verification_fee + l1_blob_fee AS l1_fee, -l1_data_fee_usd + l1_verification_fee_usd + l1_blob_fee_usd AS l1_fee_usd + d.day + , d.name + , data_fee_native + , data_fee_usd + , verification_fee_native + , verification_fee_usd + , blob_fee_native + , blob_fee_usd + , data_fee_native + verification_fee_native + blob_fee_native AS l1_fee_native + , data_fee_usd + verification_fee_usd + blob_fee_usd AS l1_fee_usd FROM l1_data d -LEFT JOIN l1_verification v - ON v.day = d.day - AND v.name = d.name -LEFT JOIN l1_blobs b - ON b.day = d.day - AND b.name = d.name - +FULL OUTER JOIN l1_verification v + ON d.day = v.day + AND d.name = v.name +FULL OUTER JOIN l1_blobs b + ON d.day = b.day + AND d.name = b.name \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees.sql deleted file mode 100644 index 03009a621a3..00000000000 --- a/models/rollup_economics/ethereum/l1_verification_fees.sql +++ /dev/null @@ -1,192 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_verification_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable"]\') }}' -)}} - -with verify_txns as ( - SELECT - 'zksync era' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - -- L1 transactions settle here post-Boojum - OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - -- L1 transactions settle here post-EIP4844 - OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD - ) - AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x7739cbe7 -- Prove Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x7f61885c -- Prove Batches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'polygon zkevm' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 24*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 - AND bytearray_substring(t.data, 1, 4) IN ( - 0x2b0006fa, -- verifyBatchesTrustedAggregator - 0x1489ed10 -- verifyBatchesTrustedAggregator (since block 19218496) - ) - AND t.block_time >= timestamp '2023-03-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'starkware' AS name, -- SHARPVerify used collectively by: Starknet, Sorare, ImmutableX, Apex, Myria, rhino.fi and Canvas Connect - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 456*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, -- proof size might get longer with more chains - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60 - AND bytearray_substring(t.data, 1, 4) = 0x9b3b76cc -- Verify Availability Proof, imx committee - AND t.block_time >= timestamp '2021-10-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'scroll' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 110*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 - AND bytearray_substring(t.data, 1, 4) IN ( - 0x31fa742d, -- finalizeBatchWithProof, - 0x00b0f4d7 -- finalizeBatchWithProof4844 - ) - AND t.block_time >= timestamp '2023-10-07' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'linea' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 0.001 AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - AND t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service - AND bytearray_substring(t.data, 1, 4) IN - ( - 0x4165d6dd, -- Finalize Blocks (proof verified immediately) - 0xd630280f -- finalizeCompressedBlocksWithProof (Aplha v2 Release at block. 19222438) - ) - AND t.block_time >= timestamp '2023-07-12' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - -,block_basefees as ( - SELECT - b.number as block_number - , b.base_fee_per_gas - , b.time - FROM {{ source('ethereum','blocks') }} as b - WHERE b.time >= timestamp '2021-10-23' - {% if is_incremental() %} - AND b.time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - - -SELECT - txs.name, - txs.hash, - txs.block_number, - bxs.time as block_time, - txs.proof_size_mb, - gas_spent, - gas_spent_usd, - gas_used, - calldata_gas_used -FROM verify_txns txs -INNER JOIN block_basefees bxs - ON txs.block_number = bxs.block_number diff --git a/models/rollup_economics/ethereum/l1_verification_fees/_schema.yml b/models/rollup_economics/ethereum/l1_verification_fees/_schema.yml new file mode 100644 index 00000000000..ee0ee01b538 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_verification_fees/_schema.yml @@ -0,0 +1,57 @@ +version: 2 + +models: + - name: rollup_economics_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by rollups for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &block_month + name: block_month + description: "UTC event block month of each transaction" + - &block_date + name: block_date + description: "UTC event block date of each transaction" + - &block_time + name: block_time + description: "UTC event block time of each transaction" + - &block_number + name: block_number + description: "Block number of each transaction" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_index + name: tx_index + description: "Transaction index" + - &gas_price + name: gas_price + description: "Gas price (in WEI) of transaction" + - &gas_used + name: gas_used + description: "Amount of gas units consumed by the transaction" + - &verification_fee_native + name: verification_fee_native + description: "Fee spent on calldata gas by the transaction (in ETH)" + - &verification_fee_usd + name: verification_fee_usd + description: "Fee spent on calldata gas by the transaction (in USD)" + - &calldata_gas_used + name: calldata_gas_used + description: "Gas units used by calldata (input data) by L1 Transactions" + - &proof_size_mb + name: proof_size_mb + description: "Size of proofs posted to Ethereum (in MBs)" diff --git a/models/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml b/models/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml new file mode 100644 index 00000000000..600cafeb3af --- /dev/null +++ b/models/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml @@ -0,0 +1,82 @@ +version: 2 + +models: + - name: rollup_economics_linea_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Linea for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - &name + name: name + description: "Name of the rollup" + - &block_month + name: block_month + description: "UTC event block month of each transaction" + - &block_date + name: block_date + description: "UTC event block date of each transaction" + - &block_time + name: block_time + description: "UTC event block time of each transaction" + - &block_number + name: block_number + description: "Block number of each transaction" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &tx_index + name: tx_index + description: "Transaction index" + - &gas_price + name: gas_price + description: "Gas price of transaction (in wei)" + - &gas_used + name: gas_used + description: "Amount of gas units consumed by the transaction" + - &verification_fee_native + name: verification_fee_native + description: "Fee spent on proof verification by the transaction (in ETH)" + - &calldata_gas_used + name: calldata_gas_used + description: "Gas units used by calldata (input data) by the transaction" + - &proof_size_mb + name: proof_size_mb + description: "Size of proofs posted to Ethereum (in MBs)" + + - name: rollup_economics_zksync_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by ZKsync Era for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *verification_fee_native + - *calldata_gas_used + - *proof_size_mb \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql new file mode 100644 index 00000000000..76ce88a29a7 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql @@ -0,0 +1,36 @@ +{{ config( + schema = 'rollup_economics_linea', + alias = 'l1_verification_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['name', 'tx_hash'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'linea' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS verification_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +AND bytearray_substring(t.data, 1, 4) IN ( + 0x7a776315 -- submitData (Aplha v2 Release at block. 19222438) + , 0x2d3c12e5 -- submitBlobData +) +AND t.block_time >= TIMESTAMP '2023-07-12' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql new file mode 100644 index 00000000000..5b736df39e7 --- /dev/null +++ b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql @@ -0,0 +1,46 @@ +{{ config( + schema = 'rollup_economics_zksync', + alias = 'l1_verification_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash'], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'zksync' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS verification_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb +FROM {{ source('ethereum', 'transactions') }} AS t +WHERE ( + -- L1 transactions settle here pre-Boojum + t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 + -- L1 transactions settle here post-Boojum + OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 + -- L1 transactions settle here post-EIP4844 + OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD +) +AND ( + -- L1 transactions use these method ID's pre-Boojum + bytearray_substring(t.data, 1, 4) = 0x7739cbe7 -- Prove Block + OR + -- L1 transactions use these method ID's post-Boojum + bytearray_substring(t.data, 1, 4) = 0x7f61885c -- Prove Batches +) +AND t.block_time >= TIMESTAMP '2023-03-24' -- ZKsync Era public mainnet launch date +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql new file mode 100644 index 00000000000..f0e1058562f --- /dev/null +++ b/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql @@ -0,0 +1,71 @@ +{{ config( + schema = 'rollup_economics' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["lgingerich"]\') }}' +)}} + +{% set base_models = [ + ref('rollup_economics_linea_l1_verification_fees') + , ref('rollup_economics_zksync_l1_verification_fees') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + name + , block_month + , block_date + , block_time + , block_number + , tx_hash + , evt_index + , gas_price + , gas_used + , verification_fee_native + , calldata_gas_used + , proof_size_mb + FROM + {{ base_model }} + {% if is_incremental() %} + WHERE {{ incremental_predicate('block_time') }} + {% endif %} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +SELECT + b.name + , b.block_month + , b.block_date + , b.block_time + , b.block_number + , b.tx_hash + , b.tx_index + , b.gas_price + , b.gas_used + , b.verification_fee_native + , b.verification_fee_native * p.price AS verification_fee_usd + , b.calldata_gas_used + , b.proof_size_mb +FROM base_union b +INNER JOIN {{ source('prices', 'usd') }} p + ON p.minute = date_trunc('minute', b.block_time) + AND p.blockchain IS NULL + AND p.symbol = 'ETH' + AND p.minute >= TIMESTAMP '2024-03-13' +{% if is_incremental() %} +WHERE {{incremental_predicate('b.block_time')}} +AND {{incremental_predicate('p.minute')}} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/l2_revenue.sql b/models/rollup_economics/ethereum/l2_revenue.sql index 06b1fdc938b..d44bdd40e14 100644 --- a/models/rollup_economics/ethereum/l2_revenue.sql +++ b/models/rollup_economics/ethereum/l2_revenue.sql @@ -9,292 +9,21 @@ post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", - \'["niftytable", "maybeYonas"]\') }}' + \'["niftytable", "maybeYonas", "lgingerich"]\') }}' )}} - -SELECT - date_trunc('day', t.block_time) AS day - , 'zksync era' AS name - , SUM((t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev - , SUM(p.price * (t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev_usd -FROM {{ source('zksync','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2022-01-01' - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'arbitrum' AS name - , SUM((t.gas_used * t.effective_gas_price)/POWER(10,18)) AS l2_rev - , SUM(p.price * (t.gas_used * t.effective_gas_price)/POWER(10,18)) AS l2_rev_usd -FROM {{ source('arbitrum','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2022-01-01' - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'op mainnet' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('optimism','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time > timestamp '2023-06-06 16:11' --when bedrock upgrade happened - {% endif %} -GROUP BY 1,2 - ---since the below is a hardcoded historical date range, only run on full refresh -{% if not is_incremental() %} -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'op mainnet (ovm2)' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('optimism','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' -WHERE t.block_time >= timestamp '2022-01-01' - AND t.block_time <= timestamp '2023-06-06 18:03' -GROUP BY 1,2 -{% endif %} - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'base' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('base','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2022-01-01' - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'zora' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('zora','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2023-06-12' --when zora network launched - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'scroll' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('scroll','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2023-10-10' --when scroll launched - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'linea' AS name - , SUM((t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev - , SUM(p.price * (t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev_usd -FROM {{ source('linea','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2023-07-06' --when linea launched - {% endif %} -GROUP BY 1,2 - -UNION ALL - -SELECT - date_trunc('day', t.block_time) AS day - , 'polygon zkevm' AS name - , SUM((t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev - , SUM(p.price * (t.gas_used * t.gas_price)/POWER(10,18)) AS l2_rev_usd -FROM {{ source('zkevm','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2023-03-24' --when polygon zkevm launched - {% endif %} -GROUP BY 1,2 - -UNION ALL SELECT - date_trunc('day', t.block_time) AS day - , 'blast' AS name - , SUM( - CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END - ) AS l2_rev - , SUM( - p.price * - (CASE WHEN cast(t.gas_price as double) = cast(0 as double) THEN 0 - ELSE (l1_fee + (cast(t.gas_used as double) * cast(t.gas_price as double))) /POWER(10,18) - END) - ) AS l2_rev_usd -FROM {{ source('blast','transactions') }} t -INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND {{incremental_predicate('p.minute')}} - {% endif %} -WHERE - 1 = 1 - {% if is_incremental() %} - AND {{incremental_predicate('t.block_time')}} - {% else %} - AND t.block_time >= timestamp '2022-01-01' - {% endif %} -GROUP BY 1,2 \ No newline at end of file + date_trunc('day', block_time) AS day + , CASE + WHEN blockchain = 'zksync' THEN 'zksync era' + WHEN blockchain = 'zkevm' THEN 'polygon zkevm' + WHEN blockchain = 'optimism' THEN 'op mainnet' + ELSE blockchain + END AS name + , SUM(tx_fee_native) AS l2_rev + , SUM(tx_fee_usd) AS l2_rev_usd +FROM {{ ref('gas_fees')}} +WHERE blockchain IN ('arbitrum', 'base', 'blast', 'linea', 'mantle', 'optimism', 'scroll', 'zksync', 'zkevm', 'zora') +{% if is_incremental() %} +AND {{ incremental_predicate('block_time') }} +{% endif %} \ No newline at end of file diff --git a/models/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml b/models/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml deleted file mode 100644 index 52354512388..00000000000 --- a/models/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml +++ /dev/null @@ -1,133 +0,0 @@ -version: 2 - -models: - - name: l1_data_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees paid by rollups for posting transaction data or state updates on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - &name - name: name - description: "name of the rollup" - - &hash - name: hash - description: "hash of the l1 transaction" - - &block_time - name: block_time - description: "UTC event block time of the transaction" - - &block_number - name: block_number - description: "Block number of the transaction" - - &data_length - name: data_length - description: "byte length of the data posted to l1" - - &gas_spent - name: gas_spent - description: "ETH spent on posting data to L1" - - &gas_spent_usd - name: gas_spent_usd - description: "fee paid to post data on L1 in usd" - - &gas_used - name: gas_used - description: "Gas units used by L1 Transactions" - - &calldata_gas_used - name: calldata_gas_used - description: "Gas units used by calldata (input data) by L1 Transactions" - - - name: l1_verification_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees paid by rollups for posting proofs on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - *name - - *hash - - *block_time - - *block_number - - &proof_size_mb - name: proof_size_mb - description: "size of proofs posted to l1 in MBs" - - *gas_spent - - *gas_spent_usd - - *gas_used - - *calldata_gas_used - - - name: l2_revenue - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees earned by rollup on L2 - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - day - columns: - - &day - name: day - description: "day gas fees were earned" - - *name - - &l2_rev - name: l2_rev - description: "revenue earned in eth" - - &l2_rev_usd - name: l2_rev_usd - description: "revenue earned in usd" - - - name: l1_blob_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Blob fees paid by rollups for posting blobs on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - *name - - *hash - - *block_time - - *block_number - - &blob_gas_used - name: blob_gas_used - description: "total blob gas used in the transaction" - - &blob_base_fee - name: blob_base_fee - description: "the base fee (wei) per blob gas" - - &blob_spend - name: blob_spend - description: "fee paid to submit blobs in ETH" - - &blob_spend_usd - name: blob_spend - description: "fee paid to submit blobs in USD" - - &blob_count - name: blob_count - description: "amount of blobs submitted in the transaction" From 51a92265b647110b1970db18accb3644456ec76e Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 25 Jul 2024 00:21:29 +0000 Subject: [PATCH 02/29] fix group by --- models/rollup_economics/ethereum/l2_revenue.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/rollup_economics/ethereum/l2_revenue.sql b/models/rollup_economics/ethereum/l2_revenue.sql index d44bdd40e14..bc5eb9b077a 100644 --- a/models/rollup_economics/ethereum/l2_revenue.sql +++ b/models/rollup_economics/ethereum/l2_revenue.sql @@ -26,4 +26,5 @@ FROM {{ ref('gas_fees')}} WHERE blockchain IN ('arbitrum', 'base', 'blast', 'linea', 'mantle', 'optimism', 'scroll', 'zksync', 'zkevm', 'zora') {% if is_incremental() %} AND {{ incremental_predicate('block_time') }} -{% endif %} \ No newline at end of file +{% endif %} +GROUP BY 1, 2 \ No newline at end of file From ed836979ec67afb29f692f8b9fa0ff753c14612a Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 25 Jul 2024 00:30:32 +0000 Subject: [PATCH 03/29] fix tx_index column name --- .../ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql | 2 +- .../rollup_economics_l1_verification_fees.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index 9fc321ecf8a..d36f11629ff 100644 --- a/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/models/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -27,7 +27,7 @@ WITH base_union AS ( , block_time , block_number , tx_hash - , evt_index + , tx_index , gas_price , gas_used , data_fee_native diff --git a/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql index f0e1058562f..e7e2868ddd4 100644 --- a/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql +++ b/models/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql @@ -27,7 +27,7 @@ WITH base_union AS ( , block_time , block_number , tx_hash - , evt_index + , tx_index , gas_price , gas_used , verification_fee_native From 5361169f7b7d1354ccca80f93f5842f872455ea0 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 25 Jul 2024 00:43:00 +0000 Subject: [PATCH 04/29] fix and format --- .../rollup_economics_l1_blob_fees.sql | 14 +++++++------- .../rollup_economics_linea_l1_data_fees.sql | 14 +++++++------- .../rollup_economics_zksync_l1_data_fees.sql | 14 +++++++------- models/rollup_economics/ethereum/l1_fees.sql | 14 +++++++------- ...ollup_economics_linea_l1_verification_fees.sql | 14 +++++++------- ...llup_economics_zksync_l1_verification_fees.sql | 14 +++++++------- models/rollup_economics/ethereum/l2_revenue.sql | 15 +++++++-------- 7 files changed, 49 insertions(+), 50 deletions(-) diff --git a/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql index 985f1399a9c..645e33dd38f 100644 --- a/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql +++ b/models/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_blob_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_ethereum' + , alias = 'l1_blob_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "maybeYonas", "lgingerich"]\') }}' diff --git a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql index 244e359d21c..b22906beb53 100644 --- a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql +++ b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_linea', - alias = 'l1_data_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_linea' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "lgingerich"]\') }}' diff --git a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql index bea9fdf46e8..5f647573dd1 100644 --- a/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql +++ b/models/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_zksync', - alias = 'l1_data_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['blockchain', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_zksync' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "lgingerich"]\') }}' diff --git a/models/rollup_economics/ethereum/l1_fees.sql b/models/rollup_economics/ethereum/l1_fees.sql index 732a0deec0c..517ad24dd29 100644 --- a/models/rollup_economics/ethereum/l1_fees.sql +++ b/models/rollup_economics/ethereum/l1_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'day'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_ethereum' + , alias = 'l1_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'day'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable"]\') }}' diff --git a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql index 76ce88a29a7..3e648a39e21 100644 --- a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql +++ b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_linea', - alias = 'l1_verification_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_linea' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "lgingerich"]\') }}' diff --git a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql index 5b736df39e7..483a74b18c0 100644 --- a/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql +++ b/models/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql @@ -1,11 +1,11 @@ {{ config( - schema = 'rollup_economics_zksync', - alias = 'l1_verification_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['blockchain', 'tx_hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_zksync' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "lgingerich"]\') }}' diff --git a/models/rollup_economics/ethereum/l2_revenue.sql b/models/rollup_economics/ethereum/l2_revenue.sql index bc5eb9b077a..df457e5f339 100644 --- a/models/rollup_economics/ethereum/l2_revenue.sql +++ b/models/rollup_economics/ethereum/l2_revenue.sql @@ -1,12 +1,11 @@ {{ config( - schema = 'rollup_economics_ethereum', - alias = 'l2_revenue', - - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['day', 'name'], - post_hook='{{ expose_spells(\'["ethereum"]\', + schema = 'rollup_economics_ethereum' + , alias = 'l2_revenue' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['day', 'name'] + , post_hook='{{ expose_spells(\'["ethereum"]\', "project", "rollup_economics", \'["niftytable", "maybeYonas", "lgingerich"]\') }}' From 8a9b74ee485568283c241928a82a111be0be199f Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 25 Jul 2024 00:51:53 +0000 Subject: [PATCH 05/29] fix unique column --- models/rollup_economics/ethereum/_schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/rollup_economics/ethereum/_schema.yml b/models/rollup_economics/ethereum/_schema.yml index cc88c4c33c6..7edcd26915b 100644 --- a/models/rollup_economics/ethereum/_schema.yml +++ b/models/rollup_economics/ethereum/_schema.yml @@ -14,7 +14,7 @@ models: - dbt_utils.unique_combination_of_columns: combination_of_columns: - name - - tx_hash + - day columns: - &name name: name From e6b496222e0c4a0d90b65bbe239864ef20ed11a9 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 25 Jul 2024 01:07:51 +0000 Subject: [PATCH 06/29] add coalesce --- models/rollup_economics/ethereum/l1_fees.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/models/rollup_economics/ethereum/l1_fees.sql b/models/rollup_economics/ethereum/l1_fees.sql index 517ad24dd29..bd45ee97938 100644 --- a/models/rollup_economics/ethereum/l1_fees.sql +++ b/models/rollup_economics/ethereum/l1_fees.sql @@ -51,16 +51,16 @@ l1_blobs AS ( ) SELECT - d.day - , d.name - , data_fee_native - , data_fee_usd - , verification_fee_native - , verification_fee_usd - , blob_fee_native - , blob_fee_usd - , data_fee_native + verification_fee_native + blob_fee_native AS l1_fee_native - , data_fee_usd + verification_fee_usd + blob_fee_usd AS l1_fee_usd + COALESCE(d.day, v.day, b.day) as day + , COALESCE(d.name, v.name, b.name) as name + , COALESCE(data_fee_native, 0) AS data_fee_native + , COALESCE(data_fee_usd, 0) AS data_fee_usd + , COALESCE(verification_fee_native, 0) AS verification_fee_native + , COALESCE(verification_fee_usd, 0) AS verification_fee_usd + , COALESCE(blob_fee_native, 0) AS blob_fee_native + , COALESCE(blob_fee_usd, 0) AS blob_fee_usd + , COALESCE(data_fee_native, 0) + COALESCE(verification_fee_native, 0) + COALESCE(blob_fee_native, 0) AS l1_fee_native + , COALESCE(data_fee_usd, 0) + COALESCE(verification_fee_usd, 0) + COALESCE(blob_fee_usd, 0) AS l1_fee_usd FROM l1_data d FULL OUTER JOIN l1_verification v ON d.day = v.day From 03d2fe5d652d7c7db36a68dfdad9332e27b51557 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Sat, 27 Jul 2024 03:10:49 +0800 Subject: [PATCH 07/29] Remove duped l2_revenue schema --- .../rollup_economics_ethereum_schema.yml | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml index 52354512388..1186f560d0b 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml @@ -71,32 +71,6 @@ models: - *gas_used - *calldata_gas_used - - name: l2_revenue - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees earned by rollup on L2 - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - day - columns: - - &day - name: day - description: "day gas fees were earned" - - *name - - &l2_rev - name: l2_rev - description: "revenue earned in eth" - - &l2_rev_usd - name: l2_rev_usd - description: "revenue earned in usd" - - name: l1_blob_fees meta: blockchain: ethereum From beb37706acfb2203ae3fe38125d663677eea448a Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 14:10:21 +0000 Subject: [PATCH 08/29] fix source --- .../models/_sector/rollup_economics/ethereum/l2_revenue.sql | 2 +- sources/_subprojects_outputs/hourly_spellbook/_sources.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql index df457e5f339..a830757e473 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql @@ -21,7 +21,7 @@ SELECT END AS name , SUM(tx_fee_native) AS l2_rev , SUM(tx_fee_usd) AS l2_rev_usd -FROM {{ ref('gas_fees')}} +FROM {{ source('gas', 'fees') }} WHERE blockchain IN ('arbitrum', 'base', 'blast', 'linea', 'mantle', 'optimism', 'scroll', 'zksync', 'zkevm', 'zora') {% if is_incremental() %} AND {{ incremental_predicate('block_time') }} diff --git a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml index f00aaa31743..2071952a118 100644 --- a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml +++ b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml @@ -42,3 +42,7 @@ sources: - name: perpetual tables: - name: trades + + - name: gas + tables: + - name: fees \ No newline at end of file From e4ee40a517fc5254c6f57d3c2084b460080a4274 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 14:58:53 +0000 Subject: [PATCH 09/29] add all chains to `l1_data_fees` --- .../rollup_economics_l1_blob_fees.sql | 9 +- ...rollup_economics_arbitrum_l1_data_fees.sql | 112 ++++++++++++++++++ .../rollup_economics_imx_l1_data_fees.sql | 39 ++++++ .../rollup_economics_linea_l1_data_fees.sql | 4 +- ...rollup_economics_loopring_l1_data_fees.sql | 37 ++++++ .../rollup_economics_mantle_l1_data_fees.sql | 45 +++++++ ...rollup_economics_optimism_l1_data_fees.sql | 49 ++++++++ .../rollup_economics_scroll_l1_data_fees.sql | 37 ++++++ ...rollup_economics_starknet_l1_data_fees.sql | 38 ++++++ .../rollup_economics_zkevm_l1_data_fees.sql | 40 +++++++ .../rollup_economics_zksync_l1_data_fees.sql | 30 ++--- ...lup_economics_zksync_lite_l1_data_fees.sql | 42 +++++++ .../rollup_economics_l1_data_fees.sql | 42 +++++-- 13 files changed, 489 insertions(+), 35 deletions(-) create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql index 645e33dd38f..2a38786a621 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -11,6 +11,13 @@ \'["niftytable", "maybeYonas", "lgingerich"]\') }}' )}} +{{ config( + schema = 'rollup_economics', + alias = 'l1_data_fees', + materialized = 'view' + ) +}} + WITH blob_txs AS ( SELECT lower(b.blob_submitter_label) AS name @@ -30,7 +37,7 @@ WITH blob_txs AS ( ON p.minute = date_trunc('minute', b.block_time) AND p.blockchain IS NULL AND p.symbol = 'ETH' - AND p.minute >= TIMESTAMP '2024-03-13' + AND p.minute >= TIMESTAMP '2024-03-13' -- EIP-4844 launch date {% if is_incremental() %} WHERE {{incremental_predicate('b.block_time')}} AND {{incremental_predicate('p.minute')}} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql new file mode 100644 index 00000000000..7719bad385a --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql @@ -0,0 +1,112 @@ +{{ config( + schema = 'rollup_economics_arbitrum' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'arbitrum' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM + ( + SELECT + evt_tx_hash as tx_hash, + evt_block_time as block_time, + evt_block_number as block_number + FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o + WHERE evt_block_time >= timestamp '2022-01-01' + {% if is_incremental() %} + AND {{incremental_predicate('evt_block_time')}} + {% endif %} + + UNION ALL + + SELECT + call_tx_hash as tx_hash, + call_block_time as block_time, + call_block_number as block_number + FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOrigin') }} o + WHERE call_success = true + AND call_tx_hash NOT IN + ( + SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o + WHERE evt_block_time >= timestamp '2022-01-01' + ) + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + call_tx_hash as tx_hash, + call_block_time as block_time, + call_block_number as block_number + FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2Batch') }} o + WHERE call_success = true + AND call_tx_hash NOT IN + ( + SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o + WHERE evt_block_time >= timestamp '2022-01-01' + ) + {% if is_incremental() %} + AND c{{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + call_tx_hash as tx_hash, + call_block_time as block_time, + call_block_number as block_number + FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOriginWithGasRefunder') }} o + WHERE call_success = true + AND call_tx_hash NOT IN + ( + SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o + WHERE evt_block_time >= timestamp '2022-01-01' + ) + {% if is_incremental() %} + AND {{incremental_predicate('call_block_time')}} + {% endif %} + + UNION ALL + + SELECT + hash as tx_hash, + block_time, + block_number + FROM {{ source('ethereum','transactions') }} + WHERE "from" = 0xC1b634853Cb333D3aD8663715b08f41A3Aec47cc + AND to = 0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6 + AND bytearray_substring(data, 1, 4) = 0x3e5aa082 --addSequencerL2BatchFromBlobs + AND block_number >= 19433943 --when arbitrum started submitting blobs + {% if is_incremental() %} + AND {{incremental_predicate('block_time')}} + {% endif %} +) b +INNER JOIN {{ source('ethereum','transactions') }} t + ON b.tx_hash = t.hash + AND b.block_number = t.block_number + AND t.success = true + AND t.block_time >= timestamp '2022-01-01' + {% if is_incremental() %} + AND {{incremental_predicate('t.block_time')}} + {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql new file mode 100644 index 00000000000..beff663d71e --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql @@ -0,0 +1,39 @@ +{{ config( + schema = 'rollup_economics_imx' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'imx' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0x5FDCCA53617f4d2b9134B29090C87D01058e27e9 + , 0x16BA0f221664A5189cf2C1a7AF0d3AbFc70aA295 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x538f9406 -- StateUpdate + , 0x504f7f6f -- Verify Availability Proof +) +AND t.block_time >= TIMESTAMP '2021-03-24' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql index b22906beb53..5413b411b5f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql @@ -25,7 +25,9 @@ SELECT , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used , (length(t.data)) AS data_length FROM {{ source('ethereum', 'transactions') }} t -WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +WHERE t.to IN ( + 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +) AND bytearray_substring(t.data, 1, 4) IN ( 0x7a776315 -- submitData (Aplha v2 Release at block. 19222438) , 0x2d3c12e5 -- submitBlobData diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql new file mode 100644 index 00000000000..8abdee289fc --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql @@ -0,0 +1,37 @@ +{{ config( + schema = 'rollup_economics_loopring' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'loopring' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0x153CdDD727e407Cb951f728F24bEB9A5FaaA8512 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0xdcb2aa31 -- submitBlocksWithCallbacks (proof verified immediately) +) +AND t.block_time >= TIMESTAMP '2021-03-23' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql new file mode 100644 index 00000000000..ecef0a3a73e --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql @@ -0,0 +1,45 @@ +{{ config( + schema = 'rollup_economics_mantle' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'mantle' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0xD1328C9167e0693B689b5aa5a024379d4e437858 -- Rollup Proxy (last used as of block 19437175) + , 0x31d543e7BE1dA6eFDc2206Ef7822879045B9f481 -- L2OutputOracle Proxy (used as of block 19440324) + , 0x50Fa427235C7C8cAA4A0C21b5009f5a0d015B23A -- BVM_EigenDataLayrChain Proxy (DA1) (last used as of block 19437271) + , 0x5BD63a7ECc13b955C4F57e3F12A64c10263C14c1 -- DataLayrServiceManager Proxy (DA2) (used as of block 19439557) +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x49cd3004 -- createAssertionWithStateBatch + , 0x9aaab648 -- proposeL2Output + , 0x5e4a3056 -- storeData (DA1) + , 0x4618ed87 -- confirmData (DA1) + , 0x58942e73 -- confirmDataStore (DA2) + , 0xdcf49ea7 -- initDataStore (DA2) +) +AND t.block_time >= TIMESTAMP '2023-06-27' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql new file mode 100644 index 00000000000..1604fdd143e --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql @@ -0,0 +1,49 @@ +{{ config( + schema = 'rollup_economics_optimism' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + -- 'optimism' AS name + lower(protocol_name) AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM ( + SELECT + protocol_name, t.block_time, t.block_number, t.hash, t.index, t.gas_used, t.gas_price, t.data + FROM {{ source('ethereum','transactions') }} as t + INNER JOIN {{ source('addresses_ethereum','optimism_batchinbox_combinations') }} as op + ON t."from" = op.l1_batch_inbox_from_address + AND t.to = op.l1_batch_inbox_to_address + WHERE t.block_time >= timestamp '2020-01-01' + + UNION ALL + + SELECT + protocol_name, t.block_time, t.block_number, t.hash, t.index, t.gas_used, t.gas_price, t.data + FROM {{ source('ethereum','transactions') }} as t + INNER JOIN {{ source('addresses_ethereum','optimism_outputoracle_combinations') }} as op + ON t."from" = op.l2_output_oracle_from_address + AND t.to = op.l2_output_oracle_to_address + WHERE t.block_time >= timestamp '2020-01-01' +) b +{% if is_incremental() %} +WHERE {{incremental_predicate('b.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql new file mode 100644 index 00000000000..732a040b0cc --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql @@ -0,0 +1,37 @@ +{{ config( + schema = 'rollup_economics_scroll' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'scroll' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x1325aca0 -- Commit Batch +) +AND t.block_time >= TIMESTAMP '2023-10-07' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql new file mode 100644 index 00000000000..ebf46dbcadf --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'rollup_economics_starknet' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'starknet' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4 -- StateUpdate proxy contract +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x77552641 -- updateState + , 0xb72d42a1 -- updateStateKzgDA +) +AND t.block_time >= TIMESTAMP '2022-01-26' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql new file mode 100644 index 00000000000..05d88a50fbe --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql @@ -0,0 +1,40 @@ +{{ config( + schema = 'rollup_economics_zkevm' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'zkevm' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 -- old proxy + , 0x519E42c24163192Dca44CD3fBDCEBF6be9130987 -- new proxy (as of block 19218878) +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x5e9145c9 -- sequenceBatches + , 0xecef3f99 -- sequenceBatches (as of block 19218878) + , 0xdef57e54 -- sequenceBatches +) +AND t.block_time >= TIMESTAMP '2023-03-01' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql index 5f647573dd1..02ce94d549c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql @@ -25,28 +25,18 @@ SELECT , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used , (length(t.data)) AS data_length FROM {{ source('ethereum', 'transactions') }} t -WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - OR - -- L1 transactions settle here post-Boojum - t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - OR - -- L1 transactions settle here post-EIP4844 - t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD +WHERE t.to IN ( + 0x3dB52cE065f728011Ac6732222270b3F2360d919 -- L1 transactions settle here pre-Boojum + , 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 -- L1 transactions settle here post-Boojum + , 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD -- L1 transactions settle here post-EIP4844 ) -AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x0c4dd810 -- Commit Block - OR - bytearray_substring(t.data, 1, 4) = 0xce9dcf16 -- Execute Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x701f58c5 -- Commit Batches - OR - bytearray_substring(t.data, 1, 4) = 0xc3d93e7c -- Execute Batches +AND bytearray_substring(t.data, 1, 4) IN ( + 0x0c4dd810 -- Commit Block, pre-Boojum + , 0xce9dcf16 -- Execute Block, pre-Boojum + , 0x701f58c5 -- Commit Batches, post-Boojum + , 0xc3d93e7c -- Execute Batches, post-Boojum ) -AND t.block_time >= TIMESTAMP '2023-03-24' -- ZKsync Era public mainnet launch date +AND t.block_time >= TIMESTAMP '2023-02-14' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql new file mode 100644 index 00000000000..ca6aeadf2f9 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql @@ -0,0 +1,42 @@ +{{ config( + schema = 'rollup_economics_zksync_lite' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'zksync_lite' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS data_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , (length(t.data)) AS data_length +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0xabea9132b05a70803a4e85094fd0e1800777fbef +) +AND t."from" IN ( + 0xda7357bbce5e8c616bc7b0c3c86f0c71c5b4eabb -- Old L2 Operator + , 0x18c208921F7a741510a7fc0CfA51E941735DAE54 -- L2 Operator + , 0x01c3a1a6890a146ac187a019f9863b3ab2bff91e -- L2 Operator V1 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x45269298 -- Commit Block +) +AND t.block_time >= TIMESTAMP '2021-29-09' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index d36f11629ff..473045c6f53 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -1,19 +1,35 @@ +-- {{ config( +-- schema = 'rollup_economics' +-- , alias = 'l1_data_fees' +-- , materialized = 'incremental' +-- , file_format = 'delta' +-- , incremental_strategy = 'merge' +-- , unique_key = ['name', 'tx_hash'] +-- , post_hook='{{ expose_spells(\'["ethereum"]\', +-- "project", +-- "rollup_economics", +-- \'["lgingerich"]\') }}' +-- )}} + {{ config( - schema = 'rollup_economics' - , alias = 'l1_data_fees' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' - , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["lgingerich"]\') }}' -)}} + schema = 'rollup_economics', + alias = 'l1_data_fees', + materialized = 'view' + ) +}} {% set base_models = [ - ref('rollup_economics_linea_l1_data_fees') + , ref('rollup_economics_arbitrum_l1_data_fees') + , ref('rollup_economics_imx_l1_data_fees') + , ref('rollup_economics_linea_l1_data_fees') + , ref('rollup_economics_loopring_l1_data_fees') + , ref('rollup_economics_mantle_l1_data_fees') + , ref('rollup_economics_optimism_l1_data_fees') + , ref('rollup_economics_scroll_l1_data_fees') + , ref('rollup_economics_starknet_l1_data_fees') + , ref('rollup_economics_zkevm_l1_data_fees') , ref('rollup_economics_zksync_l1_data_fees') + , ref('rollup_economics_zksync_lite_l1_data_fees') ] %} WITH base_union AS ( @@ -64,7 +80,7 @@ INNER JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', b.block_time) AND p.blockchain IS NULL AND p.symbol = 'ETH' - AND p.minute >= TIMESTAMP '2024-03-13' + AND p.minute >= TIMESTAMP '2020-01-01' {% if is_incremental() %} WHERE {{incremental_predicate('b.block_time')}} AND {{incremental_predicate('p.minute')}} From 0c4e1e49f72f809ab94f4d7b51706b0dea087084 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:03:00 +0000 Subject: [PATCH 10/29] finish data fees cleanup --- .../l1_data_fees/platforms/_schema.yml | 258 +++++++++++++++++- .../rollup_economics_l1_data_fees.sql | 29 +- 2 files changed, 266 insertions(+), 21 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml index 7371f55d1d2..af52bcc314e 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: rollup_economics_linea_l1_data_fees + - name: rollup_economics_arbitrum_l1_data_fees meta: blockchain: ethereum sector: rollup_economics @@ -9,7 +9,7 @@ models: contributors: niftytable, lgingerich config: tags: ['rollup', 'l2'] - description: Fees spent by Linea for blob gas on Ethereum + description: Fees spent by Arbitrum for calldata gas on Ethereum tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -53,6 +53,230 @@ models: name: data_length description: "Byte length of the data posted to l1" + - name: rollup_economics_imx_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by IMX for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_linea_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Linea for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_loopring_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Loopring for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_mantle_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Mantle for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_optimism_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Optimism for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_scroll_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Scroll for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_starknet_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Starknet for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_zkevm_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Polygon zkEVM for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + - name: rollup_economics_zksync_l1_data_fees meta: blockchain: ethereum @@ -61,7 +285,35 @@ models: contributors: niftytable, lgingerich config: tags: ['rollup', 'l2'] - description: Fees spent by ZKsync Era for blob gas on Ethereum + description: Fees spent by ZKsync Era for calldata gas on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *data_fee_native + - *calldata_gas_used + - *data_length + + - name: rollup_economics_zksync_lite_l1_data_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by ZKsync Lite for calldata gas on Ethereum tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index 473045c6f53..ff580605005 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -1,22 +1,15 @@ --- {{ config( --- schema = 'rollup_economics' --- , alias = 'l1_data_fees' --- , materialized = 'incremental' --- , file_format = 'delta' --- , incremental_strategy = 'merge' --- , unique_key = ['name', 'tx_hash'] --- , post_hook='{{ expose_spells(\'["ethereum"]\', --- "project", --- "rollup_economics", --- \'["lgingerich"]\') }}' --- )}} - {{ config( - schema = 'rollup_economics', - alias = 'l1_data_fees', - materialized = 'view' - ) -}} + schema = 'rollup_economics' + , alias = 'l1_data_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["lgingerich"]\') }}' +)}} {% set base_models = [ , ref('rollup_economics_arbitrum_l1_data_fees') From 21846be143b48c3a8483a50dc1050a669e35add7 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:16:25 +0000 Subject: [PATCH 11/29] fix date --- .../platforms/rollup_economics_starknet_l1_data_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql index ebf46dbcadf..c75aaa6cea7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql @@ -32,7 +32,7 @@ AND bytearray_substring(t.data, 1, 4) IN ( 0x77552641 -- updateState , 0xb72d42a1 -- updateStateKzgDA ) -AND t.block_time >= TIMESTAMP '2022-01-26' +AND t.block_time >= TIMESTAMP '2021-10-23' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} {% endif %} \ No newline at end of file From 1b470d0811b859cff85083a95d99b8125c8275a9 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:17:01 +0000 Subject: [PATCH 12/29] add all chains to `l1_verification_fees` --- .../platforms/_schema.yml | 84 +++++++++++++++++++ ...p_economics_linea_l1_verification_fees.sql | 8 +- ..._economics_scroll_l1_verification_fees.sql | 38 +++++++++ ...conomics_starknet_l1_verification_fees.sql | 37 ++++++++ ...llup_economics_zkevm_verification_fees.sql | 38 +++++++++ ..._economics_zksync_l1_verification_fees.sql | 22 ++--- .../rollup_economics_l1_verification_fees.sql | 5 +- 7 files changed, 214 insertions(+), 18 deletions(-) create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml index 600cafeb3af..523fb763ca2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml @@ -53,6 +53,90 @@ models: name: proof_size_mb description: "Size of proofs posted to Ethereum (in MBs)" + - name: rollup_economics_scroll_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Scroll for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *verification_fee_native + - *calldata_gas_used + - *proof_size_mb + + - name: rollup_economics_starknet_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Starknet for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *verification_fee_native + - *calldata_gas_used + - *proof_size_mb + + - name: rollup_economics_zkevm_l1_verification_fees + meta: + blockchain: ethereum + sector: rollup_economics + project: rollup_economics + contributors: niftytable, lgingerich + config: + tags: ['rollup', 'l2'] + description: Fees spent by Polygon zkEVM for proof verification on Ethereum + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - name + - tx_hash + columns: + - *name + - *block_month + - *block_date + - *block_time + - *block_number + - *tx_hash + - *tx_index + - *gas_price + - *gas_used + - *verification_fee_native + - *calldata_gas_used + - *proof_size_mb + - name: rollup_economics_zksync_l1_verification_fees meta: blockchain: ethereum diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql index 3e648a39e21..e99a68bf92a 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql @@ -25,10 +25,12 @@ SELECT , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb FROM {{ source('ethereum', 'transactions') }} t -WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +WHERE t.to IN ( + 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service +) AND bytearray_substring(t.data, 1, 4) IN ( - 0x7a776315 -- submitData (Aplha v2 Release at block. 19222438) - , 0x2d3c12e5 -- submitBlobData + 0x4165d6dd -- Finalize Blocks (proof verified immediately) + , 0xd630280f -- finalizeCompressedBlocksWithProof (Aplha v2 Release at block. 19222438) ) AND t.block_time >= TIMESTAMP '2023-07-12' {% if is_incremental() %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql new file mode 100644 index 00000000000..b9cd7741c91 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'rollup_economics_scroll' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'scroll' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS verification_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x31fa742d -- finalizeBatchWithProof + , 0x00b0f4d7 -- finalizeBatchWithProof4844 +) +AND t.block_time >= TIMESTAMP '2023-10-07' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql new file mode 100644 index 00000000000..99af515383e --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql @@ -0,0 +1,37 @@ +{{ config( + schema = 'rollup_economics_starknet' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'starkware' AS name -- SHARPVerify used collectively by: Starknet, Sorare, ImmutableX, Apex, Myria, rhino.fi and Canvas Connect + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS verification_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x9b3b76cc -- Verify Availability Proof, imx committee +) +AND t.block_time >= TIMESTAMP '2021-10-23' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql new file mode 100644 index 00000000000..fa3b4d485a8 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'rollup_economics_zkevm' + , alias = 'l1_verification_fees' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['name', 'tx_hash'] + , post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "rollup_economics", + \'["niftytable", "lgingerich"]\') }}' +)}} + +SELECT + 'zkevm' AS name + , cast(date_trunc('month', t.block_time) AS date) AS block_month + , cast(date_trunc('day', t.block_time) AS date) AS block_date + , t.block_time + , t.block_number + , t.hash AS tx_hash + , t.index AS tx_index + , t.gas_price + , t.gas_used + , (t.gas_price / 1e18) * t.gas_used AS verification_fee_native + , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used + , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb +FROM {{ source('ethereum', 'transactions') }} t +WHERE t.to IN ( + 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 +) +AND bytearray_substring(t.data, 1, 4) IN ( + 0x2b0006fa -- verifyBatchesTrustedAggregator + , 0x1489ed10 -- verifyBatchesTrustedAggregator (since block 19218496) +) +AND t.block_time >= TIMESTAMP '2023-03-01' +{% if is_incremental() %} +AND {{incremental_predicate('t.block_time')}} +{% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql index 483a74b18c0..6e8e631afe0 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql @@ -25,22 +25,16 @@ SELECT , {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used , 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb FROM {{ source('ethereum', 'transactions') }} AS t -WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - -- L1 transactions settle here post-Boojum - OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - -- L1 transactions settle here post-EIP4844 - OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD +WHERE t.to IN ( + 0x3dB52cE065f728011Ac6732222270b3F2360d919 -- L1 transactions settle here pre-Boojum + , 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 -- L1 transactions settle here post-Boojum + , 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD -- L1 transactions settle here post-EIP4844 ) -AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x7739cbe7 -- Prove Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x7f61885c -- Prove Batches +AND bytearray_substring(t.data, 1, 4) IN ( + 0x7739cbe7 -- Prove Block, pre-Boojum + , 0x7f61885c -- Prove Batches, post-Boojum ) -AND t.block_time >= TIMESTAMP '2023-03-24' -- ZKsync Era public mainnet launch date +AND t.block_time >= TIMESTAMP '2023-02-14' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql index e7e2868ddd4..aa1f73987e8 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql @@ -13,6 +13,9 @@ {% set base_models = [ ref('rollup_economics_linea_l1_verification_fees') + , ref('rollup_economics_scroll_l1_verification_fees') + , ref('rollup_economics_starknet_l1_verification_fees') + , ref('rollup_economics_zkevm_l1_verification_fees') , ref('rollup_economics_zksync_l1_verification_fees') ] %} @@ -64,7 +67,7 @@ INNER JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', b.block_time) AND p.blockchain IS NULL AND p.symbol = 'ETH' - AND p.minute >= TIMESTAMP '2024-03-13' + AND p.minute >= TIMESTAMP '2021-05-29' {% if is_incremental() %} WHERE {{incremental_predicate('b.block_time')}} AND {{incremental_predicate('p.minute')}} From e360e3237917f246dbf5ee0f74391880757c4602 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:19:25 +0000 Subject: [PATCH 13/29] remove old files --- .../ethereum/l1_blob_fees.sql | 46 -- .../ethereum/l1_data_fees.sql | 466 ------------------ .../ethereum/l1_verification_fees.sql | 192 -------- 3 files changed, 704 deletions(-) delete mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees.sql delete mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees.sql delete mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees.sql deleted file mode 100644 index ba88a6036fe..00000000000 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees.sql +++ /dev/null @@ -1,46 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_blob_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "maybeYonas"]\') }}' -)}} - -SELECT -lower(blob_submitter_label) as name, -tx_hash as hash, -block_time, -block_number, -blob_gas_used, -blob_base_fee, -(blob_gas_used*blob_base_fee)/1e18 as blob_spend, -p.price * (blob_gas_used*blob_base_fee)/1e18 as blob_spend_usd, -blob_count -FROM {{ ref('ethereum_blob_submissions')}} s -INNER JOIN {{ source('prices','usd') }} p -ON p.minute = date_trunc('minute', s.block_time) -AND p.blockchain is null -AND p.symbol = 'ETH' -AND p.minute >= timestamp '2024-03-13' -AND s.block_time >= timestamp '2024-03-13' -{% if is_incremental() %} -AND s.block_time >= date_trunc('day', now() - interval '7' day) -AND p.minute >= date_trunc('day', now() - interval '7' day) -{% endif %} -AND s.blob_submitter_label IN ('Arbitrum', -'Linea', -'zkSync Era', -'Base', -'Scroll', -'Zora', -'Public Goods Network', -'OP Mainnet', -'Starknet', -'Mode', -'Blast' -) \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees.sql deleted file mode 100644 index 1a2e609ee61..00000000000 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees.sql +++ /dev/null @@ -1,466 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_data_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable"]\') }}' -)}} - -with tx_batch_appends as ( - SELECT - 'arbitrum' as name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM - ( - SELECT - evt_tx_hash as tx_hash, - evt_block_time as block_time, - evt_block_number as block_number - FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOrigin') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2Batch') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - call_tx_hash as tx_hash, - call_block_time as block_time, - call_block_number as block_number - FROM {{ source('arbitrum_ethereum','SequencerInbox_call_addSequencerL2BatchFromOriginWithGasRefunder') }} o - WHERE call_success = true - AND call_tx_hash NOT IN - ( - SELECT evt_tx_hash FROM {{ source('arbitrum_ethereum', 'SequencerInbox_evt_SequencerBatchDeliveredFromOrigin') }} o - WHERE evt_block_time >= timestamp '2022-01-01' - ) - {% if is_incremental() %} - AND call_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - hash as tx_hash, - block_time, - block_number - FROM {{ source('ethereum','transactions') }} - WHERE "from" = 0xC1b634853Cb333D3aD8663715b08f41A3Aec47cc - AND to = 0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6 - AND bytearray_substring(data, 1, 4) = 0x3e5aa082 --addSequencerL2BatchFromBlobs - AND block_number >= 19433943 --when arbitrum started submitting blobs - {% if is_incremental() %} - AND block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - ) b - INNER JOIN {{ source('ethereum','transactions') }} t - ON b.tx_hash = t.hash - AND b.block_number = t.block_number - AND t.success = true - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - lower(protocol_name) as name, - block_number, - hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - data_length, - gas_used, - calldata_gas_used - FROM ( - SELECT protocol_name, t.block_time, t.block_number, t.hash, t.gas_used, t.gas_price, length(t.data) as data_length, {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} as t - INNER JOIN {{ source('addresses_ethereum','optimism_batchinbox_combinations') }} as op - ON t."from" = op.l1_batch_inbox_from_address - AND t.to = op.l1_batch_inbox_to_address - WHERE t.block_time >= timestamp '2020-01-01' - UNION ALL - SELECT protocol_name, t.block_time, t.block_number, t.hash, t.gas_used, t.gas_price, length(t.data) as data_length, {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} as t - INNER JOIN {{ source('addresses_ethereum','optimism_outputoracle_combinations') }} as op - ON t."from" = op.l2_output_oracle_from_address - AND t.to = op.l2_output_oracle_to_address - WHERE t.block_time >= timestamp '2020-01-01' - ) b - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', b.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - AND p.minute >= timestamp '2020-01-01' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - {% if is_incremental() %} - WHERE b.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'starknet' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - t.to = 0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4 -- StateUpdate proxy contract - AND bytearray_substring(t.data, 1, 4) IN (0x77552641, 0xb72d42a1) -- updateState, updateStateKzgDA - ) - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'imx' AS chain, -- imx state updates to L1 through the Data Availability Committee, imx uses offchain DA - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - (t.to = 0x5FDCCA53617f4d2b9134B29090C87D01058e27e9 OR t.to = 0x16BA0f221664A5189cf2C1a7AF0d3AbFc70aA295) - AND (bytearray_substring(t.data, 1, 4) = 0x538f9406 OR bytearray_substring(t.data, 1, 4) = 0x504f7f6f) -- StateUpdate & Verify Availability Proof - ) - AND t.block_time >= timestamp '2021-03-24' -- mainnet launch date - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'zksync lite' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE - ( - t."from" = 0xda7357bbce5e8c616bc7b0c3c86f0c71c5b4eabb -- Old L2 Operator - OR t."from" = 0x18c208921F7a741510a7fc0CfA51E941735DAE54 -- L2 Operator - OR t."from" = 0x01c3a1a6890a146ac187a019f9863b3ab2bff91e -- L2 Operator V1 - ) - AND t.to = 0xabea9132b05a70803a4e85094fd0e1800777fbef -- zksync - AND bytearray_substring(t.data, 1, 4) = 0x45269298 -- Commit Block - AND t.block_time >= timestamp '2022-01-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'zksync era' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - -- L1 transactions settle here post-Boojum - OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - -- L1 transactions settle here post-EIP4844 - OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD - ) - AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x0c4dd810 -- Commit Block - OR - bytearray_substring(t.data, 1, 4) = 0xce9dcf16 -- Execute Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x701f58c5 -- Commit Batches - OR - bytearray_substring(t.data, 1, 4) = 0xc3d93e7c -- Execute Batches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'polygon zkevm' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE - ( - t.to = 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 -- old proxy - OR t.to = 0x519E42c24163192Dca44CD3fBDCEBF6be9130987 -- new proxy (as of block 19218878) - ) - AND bytearray_substring(t.data, 1, 4) IN ( - 0x5e9145c9, -- sequenceBatches - 0xecef3f99, -- sequenceBatches (as of block 19218878) - 0xdef57e54 -- sequenceBatches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'linea' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service - AND bytearray_substring(t.data, 1, 4) IN ( - 0x7a776315, -- submitData (Aplha v2 Release at block. 19222438) - 0x2d3c12e5 -- submitBlobData - ) - AND t.block_time >= timestamp '2023-07-12' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'scroll' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - length(t.data) as data_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 - AND bytearray_substring(t.data, 1, 4) = 0x1325aca0 -- Commit Batch - AND t.block_time >= timestamp '2023-10-07' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'loopring' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS input_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x153CdDD727e407Cb951f728F24bEB9A5FaaA8512 - AND bytearray_substring(t.data, 1, 4) = 0xdcb2aa31 -- submitBlocksWithCallbacks (proof verified immediately) - AND t.block_time >= timestamp '2021-03-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'Mantle' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - (length(t.data)) AS input_length, - gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - t.to = 0xD1328C9167e0693B689b5aa5a024379d4e437858 -- Rollup Proxy (last used as of block 19437175) - OR t.to = 0x31d543e7BE1dA6eFDc2206Ef7822879045B9f481 -- L2OutputOracle Proxy (used as of block 19440324) - OR t.to = 0x50Fa427235C7C8cAA4A0C21b5009f5a0d015B23A -- BVM_EigenDataLayrChain Proxy (DA1) (last used as of block 19437271) - OR t.to = 0x5BD63a7ECc13b955C4F57e3F12A64c10263C14c1 -- DataLayrServiceManager Proxy (DA2) (used as of block 19439557) - ) - AND ( - bytearray_substring(t.data, 1, 4) = 0x49cd3004 -- createAssertionWithStateBatch - OR bytearray_substring(t.data, 1, 4) = 0x9aaab648 -- proposeL2Output - OR bytearray_substring(t.data, 1, 4) = 0x5e4a3056 -- storeData (DA1) - OR bytearray_substring(t.data, 1, 4) = 0x4618ed87 -- confirmData (DA1) - OR bytearray_substring(t.data, 1, 4) = 0x58942e73 -- confirmDataStore (DA2) - OR bytearray_substring(t.data, 1, 4) = 0xdcf49ea7 -- initDataStore (DA2) - ) - AND t.block_time >= timestamp '2023-06-27' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - -,block_basefees as ( - SELECT - b.number as block_number - , b.base_fee_per_gas - , b.time - FROM {{ source('ethereum','blocks') }} as b - WHERE b.time >= timestamp '2021-03-23' - {% if is_incremental() %} - AND b.time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - - -SELECT - txs.name, - txs.hash, - bxs.time as block_time, - txs.block_number, - txs.data_length, - gas_spent, - gas_spent_usd, - gas_used, - calldata_gas_used -FROM tx_batch_appends txs -INNER JOIN block_basefees bxs - ON txs.block_number = bxs.block_number diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees.sql deleted file mode 100644 index 03009a621a3..00000000000 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees.sql +++ /dev/null @@ -1,192 +0,0 @@ -{{ config( - schema = 'rollup_economics_ethereum', - alias = 'l1_verification_fees', - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['name', 'hash'], - post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable"]\') }}' -)}} - -with verify_txns as ( - SELECT - 'zksync era' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 44*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE ( - -- L1 transactions settle here pre-Boojum - t.to = 0x3dB52cE065f728011Ac6732222270b3F2360d919 - -- L1 transactions settle here post-Boojum - OR t.to = 0xa0425d71cB1D6fb80E65a5361a04096E0672De03 - -- L1 transactions settle here post-EIP4844 - OR t.to = 0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD - ) - AND ( - -- L1 transactions use these method ID's pre-Boojum - bytearray_substring(t.data, 1, 4) = 0x7739cbe7 -- Prove Block - OR - -- L1 transactions use these method ID's post-Boojum - bytearray_substring(t.data, 1, 4) = 0x7f61885c -- Prove Batches - ) - AND t.block_time >= timestamp '2023-03-01' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'polygon zkevm' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 24*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x5132a183e9f3cb7c848b0aac5ae0c4f0491b7ab2 - AND bytearray_substring(t.data, 1, 4) IN ( - 0x2b0006fa, -- verifyBatchesTrustedAggregator - 0x1489ed10 -- verifyBatchesTrustedAggregator (since block 19218496) - ) - AND t.block_time >= timestamp '2023-03-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'starkware' AS name, -- SHARPVerify used collectively by: Starknet, Sorare, ImmutableX, Apex, Myria, rhino.fi and Canvas Connect - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 456*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, -- proof size might get longer with more chains - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60 - AND bytearray_substring(t.data, 1, 4) = 0x9b3b76cc -- Verify Availability Proof, imx committee - AND t.block_time >= timestamp '2021-10-23' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'scroll' AS name, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 110*32 / cast(1024 AS double) / cast(1024 AS double) AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - WHERE t.to = 0xa13BAF47339d63B743e7Da8741db5456DAc1E556 - AND bytearray_substring(t.data, 1, 4) IN ( - 0x31fa742d, -- finalizeBatchWithProof, - 0x00b0f4d7 -- finalizeBatchWithProof4844 - ) - AND t.block_time >= timestamp '2023-10-07' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} - - UNION ALL - - SELECT - 'linea' AS chain, - t.block_number, - t.hash, - (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, - p.price * (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent_usd, - 0.001 AS proof_size_mb, - t.gas_used, - {{ evm_get_calldata_gas_from_data('t.data') }} AS calldata_gas_used - FROM {{ source('ethereum','transactions') }} AS t - INNER JOIN {{ source('prices','usd') }} p - ON p.minute = date_trunc('minute', t.block_time) - AND p.blockchain is null - AND p.symbol = 'ETH' - {% if is_incremental() %} - AND p.minute >= date_trunc('day', now() - interval '7' day) - {% endif %} - AND t.to = 0xd19d4B5d358258f05D7B411E21A1460D11B0876F -- Linea, L1 Message Service - AND bytearray_substring(t.data, 1, 4) IN - ( - 0x4165d6dd, -- Finalize Blocks (proof verified immediately) - 0xd630280f -- finalizeCompressedBlocksWithProof (Aplha v2 Release at block. 19222438) - ) - AND t.block_time >= timestamp '2023-07-12' - {% if is_incremental() %} - AND t.block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - -,block_basefees as ( - SELECT - b.number as block_number - , b.base_fee_per_gas - , b.time - FROM {{ source('ethereum','blocks') }} as b - WHERE b.time >= timestamp '2021-10-23' - {% if is_incremental() %} - AND b.time >= date_trunc('day', now() - interval '7' day) - {% endif %} -) - - -SELECT - txs.name, - txs.hash, - txs.block_number, - bxs.time as block_time, - txs.proof_size_mb, - gas_spent, - gas_spent_usd, - gas_used, - calldata_gas_used -FROM verify_txns txs -INNER JOIN block_basefees bxs - ON txs.block_number = bxs.block_number From ce188dcab32b1ed7897f30fb6ee196c7ca46df14 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:26:23 +0000 Subject: [PATCH 14/29] fix format --- .../ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index ff580605005..f4c9d5a9865 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -12,7 +12,7 @@ )}} {% set base_models = [ - , ref('rollup_economics_arbitrum_l1_data_fees') + ref('rollup_economics_arbitrum_l1_data_fees') , ref('rollup_economics_imx_l1_data_fees') , ref('rollup_economics_linea_l1_data_fees') , ref('rollup_economics_loopring_l1_data_fees') From fb475c38857a2a6f4fdb83c1cb5934fa86d6aeb3 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:36:07 +0000 Subject: [PATCH 15/29] delete old schema file --- .../rollup_economics_ethereum_schema.yml | 107 ------------------ 1 file changed, 107 deletions(-) delete mode 100644 dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml deleted file mode 100644 index 1186f560d0b..00000000000 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_schema.yml +++ /dev/null @@ -1,107 +0,0 @@ -version: 2 - -models: - - name: l1_data_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees paid by rollups for posting transaction data or state updates on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - &name - name: name - description: "name of the rollup" - - &hash - name: hash - description: "hash of the l1 transaction" - - &block_time - name: block_time - description: "UTC event block time of the transaction" - - &block_number - name: block_number - description: "Block number of the transaction" - - &data_length - name: data_length - description: "byte length of the data posted to l1" - - &gas_spent - name: gas_spent - description: "ETH spent on posting data to L1" - - &gas_spent_usd - name: gas_spent_usd - description: "fee paid to post data on L1 in usd" - - &gas_used - name: gas_used - description: "Gas units used by L1 Transactions" - - &calldata_gas_used - name: calldata_gas_used - description: "Gas units used by calldata (input data) by L1 Transactions" - - - name: l1_verification_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Gas fees paid by rollups for posting proofs on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - *name - - *hash - - *block_time - - *block_number - - &proof_size_mb - name: proof_size_mb - description: "size of proofs posted to l1 in MBs" - - *gas_spent - - *gas_spent_usd - - *gas_used - - *calldata_gas_used - - - name: l1_blob_fees - meta: - blockchain: ethereum - sector: rollup_economics - project: rollup_economics - contributors: niftytable - config: - tags: ['rollup', 'l2'] - description: Blob fees paid by rollups for posting blobs on Ethereum - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - name - - hash - columns: - - *name - - *hash - - *block_time - - *block_number - - &blob_gas_used - name: blob_gas_used - description: "total blob gas used in the transaction" - - &blob_base_fee - name: blob_base_fee - description: "the base fee (wei) per blob gas" - - &blob_spend - name: blob_spend - description: "fee paid to submit blobs in ETH" - - &blob_spend_usd - name: blob_spend - description: "fee paid to submit blobs in USD" - - &blob_count - name: blob_count - description: "amount of blobs submitted in the transaction" From 386db85c96ca9fb4af7e2a27297b59b8314a24d6 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:42:14 +0000 Subject: [PATCH 16/29] fix file name --- ...n_fees.sql => rollup_economics_zkevm_l1_verification_fees.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/{rollup_economics_zkevm_verification_fees.sql => rollup_economics_zkevm_l1_verification_fees.sql} (100%) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_l1_verification_fees.sql similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_l1_verification_fees.sql From 880f53420ddcd09b3ded6be36a9b7e2786c3b011 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 15:46:46 +0000 Subject: [PATCH 17/29] fix model name --- .../l1_blob_fees/rollup_economics_l1_blob_fees.sql | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql index 2a38786a621..5d27238f525 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -11,13 +11,6 @@ \'["niftytable", "maybeYonas", "lgingerich"]\') }}' )}} -{{ config( - schema = 'rollup_economics', - alias = 'l1_data_fees', - materialized = 'view' - ) -}} - WITH blob_txs AS ( SELECT lower(b.blob_submitter_label) AS name From 8bded1e335900b7889dc090d89cd455c0664a98e Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 16:50:58 +0000 Subject: [PATCH 18/29] fix date --- .../platforms/rollup_economics_zksync_lite_l1_data_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql index ca6aeadf2f9..87c4aa70a4c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql @@ -36,7 +36,7 @@ AND t."from" IN ( AND bytearray_substring(t.data, 1, 4) IN ( 0x45269298 -- Commit Block ) -AND t.block_time >= TIMESTAMP '2021-29-09' +AND t.block_time >= TIMESTAMP '2021-02-09' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} {% endif %} \ No newline at end of file From f2ae61620a425ce2b641313cb199ee1b967f02de Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 16:52:34 +0000 Subject: [PATCH 19/29] fix alias --- .../platforms/rollup_economics_optimism_l1_data_fees.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql index 1604fdd143e..12ff013fe97 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql @@ -43,7 +43,7 @@ FROM ( ON t."from" = op.l2_output_oracle_from_address AND t.to = op.l2_output_oracle_to_address WHERE t.block_time >= timestamp '2020-01-01' -) b +) t {% if is_incremental() %} -WHERE {{incremental_predicate('b.block_time')}} +WHERE {{incremental_predicate('t.block_time')}} {% endif %} \ No newline at end of file From 72d1979b78a64fd15cb77f12950f53ac9cf64a42 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 30 Jul 2024 18:09:25 +0000 Subject: [PATCH 20/29] fix mispell --- .../platforms/rollup_economics_arbitrum_l1_data_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql index 7719bad385a..9c8bcbf976f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql @@ -67,7 +67,7 @@ FROM WHERE evt_block_time >= timestamp '2022-01-01' ) {% if is_incremental() %} - AND c{{incremental_predicate('call_block_time')}} + AND {{incremental_predicate('call_block_time')}} {% endif %} UNION ALL From 54e85f049862c458e5de67f8fbacc382f21a051d Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 6 Aug 2024 13:41:15 +0000 Subject: [PATCH 21/29] remove post hook --- .../ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql | 4 ---- .../ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql | 4 ---- .../rollup_economics_l1_verification_fees.sql | 4 ---- 3 files changed, 12 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql index 5d27238f525..86521a8122d 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "maybeYonas", "lgingerich"]\') }}' )}} WITH blob_txs AS ( diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index f4c9d5a9865..a75e59739c1 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["lgingerich"]\') }}' )}} {% set base_models = [ diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql index aa1f73987e8..74d43192345 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["lgingerich"]\') }}' )}} {% set base_models = [ From 83890b6e14b71ad156cec0aa5e936c7d38d6b3a4 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 6 Aug 2024 13:44:42 +0000 Subject: [PATCH 22/29] change from incremental to view --- .../l1_blob_fees/rollup_economics_l1_blob_fees.sql | 10 ++-------- .../l1_data_fees/rollup_economics_l1_data_fees.sql | 13 ++----------- .../rollup_economics_l1_verification_fees.sql | 13 ++----------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql index 86521a8122d..bfae1659996 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql @@ -1,9 +1,7 @@ {{ config( schema = 'rollup_economics_ethereum' , alias = 'l1_blob_fees' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' + , materialized = 'view' , unique_key = ['name', 'tx_hash'] )}} @@ -27,11 +25,7 @@ WITH blob_txs AS ( AND p.blockchain IS NULL AND p.symbol = 'ETH' AND p.minute >= TIMESTAMP '2024-03-13' -- EIP-4844 launch date - {% if is_incremental() %} - WHERE {{incremental_predicate('b.block_time')}} - AND {{incremental_predicate('p.minute')}} - {% endif %} - AND b.blob_submitter_label IN ( + WHERE b.blob_submitter_label IN ( 'Arbitrum' , 'Linea' , 'zkSync Era' diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql index a75e59739c1..2228a2ee3e6 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql @@ -1,9 +1,7 @@ {{ config( schema = 'rollup_economics' , alias = 'l1_data_fees' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' + , materialized = 'view' , unique_key = ['name', 'tx_hash'] )}} @@ -40,9 +38,6 @@ WITH base_union AS ( , data_length FROM {{ base_model }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('block_time') }} - {% endif %} {% if not loop.last %} UNION ALL {% endif %} @@ -69,8 +64,4 @@ INNER JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', b.block_time) AND p.blockchain IS NULL AND p.symbol = 'ETH' - AND p.minute >= TIMESTAMP '2020-01-01' -{% if is_incremental() %} -WHERE {{incremental_predicate('b.block_time')}} -AND {{incremental_predicate('p.minute')}} -{% endif %} \ No newline at end of file + AND p.minute >= TIMESTAMP '2020-01-01' \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql index 74d43192345..f8a692a5cea 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql @@ -1,9 +1,7 @@ {{ config( schema = 'rollup_economics' , alias = 'l1_verification_fees' - , materialized = 'incremental' - , file_format = 'delta' - , incremental_strategy = 'merge' + , materialized = 'view' , unique_key = ['name', 'tx_hash'] )}} @@ -34,9 +32,6 @@ WITH base_union AS ( , proof_size_mb FROM {{ base_model }} - {% if is_incremental() %} - WHERE {{ incremental_predicate('block_time') }} - {% endif %} {% if not loop.last %} UNION ALL {% endif %} @@ -63,8 +58,4 @@ INNER JOIN {{ source('prices', 'usd') }} p ON p.minute = date_trunc('minute', b.block_time) AND p.blockchain IS NULL AND p.symbol = 'ETH' - AND p.minute >= TIMESTAMP '2021-05-29' -{% if is_incremental() %} -WHERE {{incremental_predicate('b.block_time')}} -AND {{incremental_predicate('p.minute')}} -{% endif %} \ No newline at end of file + AND p.minute >= TIMESTAMP '2021-05-29' \ No newline at end of file From 71d14a99ccabe469a051ff980eb8a8db9ddce65b Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Tue, 6 Aug 2024 14:31:44 +0000 Subject: [PATCH 23/29] remove duplicate source --- sources/_subprojects_outputs/hourly_spellbook/_sources.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml index 2071952a118..f00aaa31743 100644 --- a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml +++ b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml @@ -42,7 +42,3 @@ sources: - name: perpetual tables: - name: trades - - - name: gas - tables: - - name: fees \ No newline at end of file From 570abe69a5484ed969317e2619a41e100a8f6adb Mon Sep 17 00:00:00 2001 From: jeff-dude Date: Mon, 19 Aug 2024 12:04:30 -0400 Subject: [PATCH 24/29] rename files / directory paths --- .../models/_sector/rollup_economics/ethereum/_schema.yml | 4 ++-- .../rollup_economics/ethereum/l1_blob_fees/_schema.yml | 2 +- ...ob_fees.sql => rollup_economics_ethereum_l1_blob_fees.sql} | 0 .../ethereum/l1_data_fees/{platforms => chains}/_schema.yml | 0 .../rollup_economics_arbitrum_l1_data_fees.sql | 4 ---- .../rollup_economics_imx_l1_data_fees.sql | 4 ---- .../rollup_economics_linea_l1_data_fees.sql | 4 ---- .../rollup_economics_loopring_l1_data_fees.sql | 4 ---- .../rollup_economics_mantle_l1_data_fees.sql | 4 ---- .../rollup_economics_optimism_l1_data_fees.sql | 4 ---- .../rollup_economics_scroll_l1_data_fees.sql | 4 ---- .../rollup_economics_starknet_l1_data_fees.sql | 4 ---- .../rollup_economics_zkevm_l1_data_fees.sql | 4 ---- .../rollup_economics_zksync_l1_data_fees.sql | 4 ---- .../rollup_economics_zksync_lite_l1_data_fees.sql | 4 ---- .../l1_verification_fees/{platforms => chains}/_schema.yml | 0 .../rollup_economics_linea_l1_verification_fees.sql | 4 ---- .../rollup_economics_scroll_l1_verification_fees.sql | 4 ---- .../rollup_economics_starknet_l1_verification_fees.sql | 4 ---- .../rollup_economics_zkevm_l1_verification_fees.sql | 4 ---- .../rollup_economics_zksync_l1_verification_fees.sql | 4 ---- .../{l1_fees.sql => rollup_economics_ethereum_l1_fees.sql} | 0 ...2_revenue.sql => rollup_economics_ethereum_l2_revenue.sql} | 0 23 files changed, 3 insertions(+), 67 deletions(-) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/{rollup_economics_l1_blob_fees.sql => rollup_economics_ethereum_l1_blob_fees.sql} (100%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/_schema.yml (100%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_arbitrum_l1_data_fees.sql (94%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_imx_l1_data_fees.sql (82%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_linea_l1_data_fees.sql (82%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_loopring_l1_data_fees.sql (81%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_mantle_l1_data_fees.sql (87%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_optimism_l1_data_fees.sql (87%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_scroll_l1_data_fees.sql (81%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_starknet_l1_data_fees.sql (82%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_zkevm_l1_data_fees.sql (83%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_zksync_l1_data_fees.sql (85%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{platforms => chains}/rollup_economics_zksync_lite_l1_data_fees.sql (84%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/_schema.yml (100%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/rollup_economics_linea_l1_verification_fees.sql (84%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/rollup_economics_scroll_l1_verification_fees.sql (82%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/rollup_economics_starknet_l1_verification_fees.sql (83%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/rollup_economics_zkevm_l1_verification_fees.sql (83%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{platforms => chains}/rollup_economics_zksync_l1_verification_fees.sql (85%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/{l1_fees.sql => rollup_economics_ethereum_l1_fees.sql} (100%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/{l2_revenue.sql => rollup_economics_ethereum_l2_revenue.sql} (100%) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/_schema.yml index 7edcd26915b..8a35a4e5864 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: l1_fees + - name: rollup_economics_ethereum_l1_fees meta: blockchain: ethereum sector: rollup_economics @@ -47,7 +47,7 @@ models: name: l1_fee_usd description: "Total amount paid in gas fees (in USD)" - - name: l2_revenue + - name: rollup_economics_ethereum_l2_revenue meta: blockchain: ethereum sector: rollup_economics diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/_schema.yml index 8735d4b6e63..78d2cefc266 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: rollup_economics_l1_blob_fees + - name: rollup_economics_ethereum_l1_blob_fees meta: blockchain: ethereum sector: rollup_economics diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_ethereum_l1_blob_fees.sql similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_l1_blob_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_blob_fees/rollup_economics_ethereum_l1_blob_fees.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/_schema.yml similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/_schema.yml rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/_schema.yml diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql similarity index 94% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql index 9c8bcbf976f..498cf0074cd 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_arbitrum_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql similarity index 82% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql index beff663d71e..deecde7f82f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_imx_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql similarity index 82% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql index 5413b411b5f..7549bddcb3e 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_linea_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql similarity index 81% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql index 8abdee289fc..3b4d28c29d7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_loopring_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql similarity index 87% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql index ecef0a3a73e..20b3ba687ec 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_mantle_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql similarity index 87% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql index 12ff013fe97..74138a019da 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_optimism_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql similarity index 81% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql index 732a040b0cc..84e13cd6953 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_scroll_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql similarity index 82% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql index c75aaa6cea7..d6a31104aae 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_starknet_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql similarity index 83% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql index 05d88a50fbe..331859aa74c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zkevm_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql similarity index 85% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql index 02ce94d549c..bbb6bcf275e 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql similarity index 84% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql index 87c4aa70a4c..713eed763c4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/platforms/rollup_economics_zksync_lite_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/_schema.yml similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/_schema.yml rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/_schema.yml diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql similarity index 84% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql index e99a68bf92a..be1bf068a29 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_linea_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql similarity index 82% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql index b9cd7741c91..e18a5d092d0 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_scroll_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql similarity index 83% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql index 99af515383e..27f82dcd954 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_starknet_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql similarity index 83% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql index fa3b4d485a8..75715062e21 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zkevm_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql similarity index 85% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql index 6e8e631afe0..07beadcc2a3 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/platforms/rollup_economics_zksync_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql @@ -5,10 +5,6 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] - , post_hook='{{ expose_spells(\'["ethereum"]\', - "project", - "rollup_economics", - \'["niftytable", "lgingerich"]\') }}' )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l2_revenue.sql similarity index 100% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l2_revenue.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l2_revenue.sql From f760aec636c4b387a674dc2a92c1981ed2a290c5 Mon Sep 17 00:00:00 2001 From: jeff-dude Date: Mon, 19 Aug 2024 12:19:04 -0400 Subject: [PATCH 25/29] add target filters --- .../chains/rollup_economics_arbitrum_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql | 1 + .../chains/rollup_economics_loopring_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql | 1 + .../chains/rollup_economics_optimism_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql | 1 + .../chains/rollup_economics_starknet_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql | 1 + .../l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql | 1 + .../chains/rollup_economics_zksync_lite_l1_data_fees.sql | 1 + .../chains/rollup_economics_linea_l1_verification_fees.sql | 1 + .../chains/rollup_economics_scroll_l1_verification_fees.sql | 1 + .../chains/rollup_economics_starknet_l1_verification_fees.sql | 1 + .../chains/rollup_economics_zkevm_l1_verification_fees.sql | 1 + .../chains/rollup_economics_zksync_l1_verification_fees.sql | 1 + 16 files changed, 16 insertions(+) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql index 498cf0074cd..13192021b22 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_arbitrum_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql index deecde7f82f..73e02aaa809 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_imx_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql index 7549bddcb3e..27872091886 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql index 3b4d28c29d7..2ae2b883292 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_loopring_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql index 20b3ba687ec..1f2b8e4f447 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_mantle_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql index 74138a019da..b1969066668 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_optimism_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql index 84e13cd6953..d0da95f5285 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_scroll_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql index d6a31104aae..be191466e11 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_starknet_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql index 331859aa74c..04973c80f8a 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zkevm_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql index bbb6bcf275e..f2fa77b712f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql index 713eed763c4..d5d535c86ec 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_zksync_lite_l1_data_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql index be1bf068a29..6cd50bad51a 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql index e18a5d092d0..34ebc552361 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_scroll_l1_verification_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql index 27f82dcd954..8535a1e385f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_starknet_l1_verification_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql index 75715062e21..64e055fc02f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zkevm_l1_verification_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql index 07beadcc2a3..f2ca8a54590 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_zksync_l1_verification_fees.sql @@ -5,6 +5,7 @@ , file_format = 'delta' , incremental_strategy = 'merge' , unique_key = ['name', 'tx_hash'] + , incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] )}} SELECT From 6195435cd821d6bfb8f43118d216e5c25973e465 Mon Sep 17 00:00:00 2001 From: jeff-dude Date: Mon, 19 Aug 2024 12:30:14 -0400 Subject: [PATCH 26/29] fix ref name --- .../ethereum/rollup_economics_ethereum_l1_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql index bd45ee97938..f39be5437c2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql @@ -43,7 +43,7 @@ l1_blobs AS ( , name , SUM(blob_fee_native) as blob_fee_native , SUM(blob_fee_usd) as blob_fee_usd - FROM {{ ref('rollup_economics_l1_blob_fees')}} + FROM {{ ref('rollup_economics_ethereum_l1_blob_fees')}} {% if is_incremental() %} WHERE {{incremental_predicate('block_time')}} {% endif %} From 7f01bdb903185c2c03886d444e41a7cdb60da7a9 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Mon, 19 Aug 2024 19:31:51 +0000 Subject: [PATCH 27/29] fix file/schema name inconsistency --- .../_sector/rollup_economics/ethereum/l1_data_fees/_schema.yml | 2 +- ...data_fees.sql => rollup_economics_ethereum_l1_data_fees.sql} | 2 +- .../rollup_economics/ethereum/l1_verification_fees/_schema.yml | 2 +- ...s.sql => rollup_economics_ethereum_l1_verification_fees.sql} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/{rollup_economics_l1_data_fees.sql => rollup_economics_ethereum_l1_data_fees.sql} (97%) rename dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/{rollup_economics_l1_verification_fees.sql => rollup_economics_ethereum_l1_verification_fees.sql} (97%) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/_schema.yml index 9e8dc5654a4..1faa07f9250 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: rollup_economics_l1_data_fees + - name: rollup_economics_ethereum_l1_data_fees meta: blockchain: ethereum sector: rollup_economics diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_ethereum_l1_data_fees.sql similarity index 97% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_ethereum_l1_data_fees.sql index 2228a2ee3e6..b998dac6bbc 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/rollup_economics_ethereum_l1_data_fees.sql @@ -1,5 +1,5 @@ {{ config( - schema = 'rollup_economics' + schema = 'rollup_economics_ethereum' , alias = 'l1_data_fees' , materialized = 'view' , unique_key = ['name', 'tx_hash'] diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/_schema.yml index ee0ee01b538..0466ea6ae1c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/_schema.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: rollup_economics_l1_verification_fees + - name: rollup_economics_ethereum_l1_verification_fees meta: blockchain: ethereum sector: rollup_economics diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_ethereum_l1_verification_fees.sql similarity index 97% rename from dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql rename to dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_ethereum_l1_verification_fees.sql index f8a692a5cea..e170a0128d6 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/rollup_economics_ethereum_l1_verification_fees.sql @@ -1,5 +1,5 @@ {{ config( - schema = 'rollup_economics' + schema = 'rollup_economics_ethereum' , alias = 'l1_verification_fees' , materialized = 'view' , unique_key = ['name', 'tx_hash'] From f6a278ae6d22961c3f6b7eb61a555e2393905b76 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Mon, 19 Aug 2024 19:37:38 +0000 Subject: [PATCH 28/29] fix ref name --- .../ethereum/rollup_economics_ethereum_l1_fees.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql index f39be5437c2..e6c176260c6 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql @@ -17,7 +17,7 @@ WITH l1_data AS ( , name , SUM(data_fee_native) as data_fee_native , SUM(data_fee_usd) as data_fee_usd - FROM {{ ref('rollup_economics_l1_data_fees')}} + FROM {{ ref('rollup_economics_ethereum_l1_data_fees')}} {% if is_incremental() %} WHERE {{incremental_predicate('block_time')}} {% endif %} @@ -30,7 +30,7 @@ WITH l1_data AS ( , name , SUM(verification_fee_native) as verification_fee_native , SUM(verification_fee_usd) as verification_fee_usd - FROM {{ ref('rollup_economics_l1_verification_fees')}} + FROM {{ ref('rollup_economics_etheruem_l1_verification_fees')}} {% if is_incremental() %} WHERE {{incremental_predicate('block_time')}} {% endif %} From ca0e8e9680936c1ee57579852d08848f2863c22a Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Mon, 19 Aug 2024 19:39:39 +0000 Subject: [PATCH 29/29] fix --- .../ethereum/rollup_economics_ethereum_l1_fees.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql index e6c176260c6..15f20f5605e 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/rollup_economics_ethereum_l1_fees.sql @@ -30,7 +30,7 @@ WITH l1_data AS ( , name , SUM(verification_fee_native) as verification_fee_native , SUM(verification_fee_usd) as verification_fee_usd - FROM {{ ref('rollup_economics_etheruem_l1_verification_fees')}} + FROM {{ ref('rollup_economics_ethereum_l1_verification_fees')}} {% if is_incremental() %} WHERE {{incremental_predicate('block_time')}} {% endif %}