Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rollup_economics spell #6426

Merged
merged 34 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2ed9519
init
lgingerich Jul 24, 2024
51a9226
fix group by
lgingerich Jul 25, 2024
ed83697
fix tx_index column name
lgingerich Jul 25, 2024
5361169
fix and format
lgingerich Jul 25, 2024
8a9b74e
fix unique column
lgingerich Jul 25, 2024
e6b4962
add coalesce
lgingerich Jul 25, 2024
c547958
Merge branch 'main' into pr/6426
Hosuke Jul 26, 2024
03d2fe5
Remove duped l2_revenue schema
Hosuke Jul 26, 2024
147ce37
Merge branch 'main' into refactor_rollup_economics
lgingerich Jul 29, 2024
beb3770
fix source
lgingerich Jul 30, 2024
e4ee40a
add all chains to `l1_data_fees`
lgingerich Jul 30, 2024
0c4e1e4
finish data fees cleanup
lgingerich Jul 30, 2024
21846be
fix date
lgingerich Jul 30, 2024
1b470d0
add all chains to `l1_verification_fees`
lgingerich Jul 30, 2024
e360e32
remove old files
lgingerich Jul 30, 2024
ce188dc
fix format
lgingerich Jul 30, 2024
fb475c3
delete old schema file
lgingerich Jul 30, 2024
386db85
fix file name
lgingerich Jul 30, 2024
880f534
fix model name
lgingerich Jul 30, 2024
8bded1e
fix date
lgingerich Jul 30, 2024
f2ae616
fix alias
lgingerich Jul 30, 2024
72d1979
fix mispell
lgingerich Jul 30, 2024
260d8fb
Merge branch 'main' into refactor_rollup_economics
lgingerich Aug 6, 2024
54e85f0
remove post hook
lgingerich Aug 6, 2024
83890b6
change from incremental to view
lgingerich Aug 6, 2024
71d14a9
remove duplicate source
lgingerich Aug 6, 2024
6dd59d3
Merge branch 'main' into refactor_rollup_economics
0xRobin Aug 19, 2024
e7b78f8
Merge branch 'main' into refactor_rollup_economics
jeff-dude Aug 19, 2024
570abe6
rename files / directory paths
jeff-dude Aug 19, 2024
f760aec
add target filters
jeff-dude Aug 19, 2024
6195435
fix ref name
jeff-dude Aug 19, 2024
7f01bdb
fix file/schema name inconsistency
lgingerich Aug 19, 2024
f6a278a
fix ref name
lgingerich Aug 19, 2024
ca0e8e9
fix
lgingerich Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lgingerich marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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
- day
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)"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{ config(
schema = 'rollup_economics_ethereum'
, alias = 'l1_blob_fees'
, materialized = 'view'
, unique_key = ['name', 'tx_hash']
)}}

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' -- EIP-4844 launch date
WHERE 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
Loading
Loading