Skip to content

Commit 27c792e

Browse files
authored
CUR2-552: mezo gas fees and token transfers (#8997)
* feat: mezo tokens * feat: add mezo to main models * feat: mezo gas fees * chore: mezo gas fees seed * chore: add mezo & henesys to the list
1 parent d200912 commit 27c792e

17 files changed

+311
-3
lines changed

dbt_subprojects/hourly_spellbook/models/_sector/gas/fees/_schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ models:
44
- name: gas_fees
55
meta:
66
sector: gas
7-
contributors: soispoke, ilemi, 0xRob, jeff-dude, hosuke
7+
contributors: soispoke, ilemi, 0xRob, jeff-dude, hosuke, tomfutago
88
description: >
99
Gas Fees across chains
1010
columns:

dbt_subprojects/hourly_spellbook/models/_sector/gas/fees/gas_fees.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
, "lens"
3131
, "linea"
3232
, "mantle"
33+
, "mezo"
3334
, "nova"
3435
, "opbnb"
3536
, "optimism"
@@ -57,7 +58,7 @@
5758
]\',
5859
"sector",
5960
"gas",
60-
\'["soispoke", "ilemi", "0xRob", "jeff-dude", "krishhh"]\'
61+
\'["soispoke", "ilemi", "0xRob", "jeff-dude", "krishhh", "tomfutago"]\'
6162
)
6263
}}'
6364
)
@@ -92,6 +93,7 @@
9293
, "linea"
9394
, "lens"
9495
, "mantle"
96+
, "mezo"
9597
, "nova"
9698
, "opbnb"
9799
, "optimism"
@@ -152,4 +154,4 @@ FROM
152154
UNION ALL
153155
{% endif %}
154156
{% endfor %}
155-
)
157+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% set blockchain = 'mezo' %}
2+
3+
{{ config(
4+
schema = 'gas_' + blockchain
5+
,alias = 'fees'
6+
,partition_by = ['block_month']
7+
,materialized = 'incremental'
8+
,file_format = 'delta'
9+
,incremental_strategy='merge'
10+
,unique_key = ['block_month', 'tx_hash']
11+
,incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
12+
)
13+
}}
14+
15+
{{ evm_l1_gas_fees(blockchain) }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
3+
models:
4+
- name: gas_mezo_fees
5+
meta:
6+
blockchain: mezo
7+
sector: gas
8+
contributors: tomfutago
9+
config:
10+
tags: ['mezo', 'gas', 'fees']
11+
description: >
12+
Gas Fees on mezo
13+
data_tests:
14+
- dbt_utils.unique_combination_of_columns:
15+
combination_of_columns:
16+
- block_month
17+
- tx_hash
18+
- check_seed:
19+
seed_file: ref('evm_gas_fees')
20+
filter:
21+
blockchain: mezo
22+
match_columns:
23+
- blockchain
24+
- tx_hash
25+
check_columns:
26+
- tx_fee_raw
27+
- dbt_utils.expression_is_true:
28+
expression: "tx_fee_raw = reduce(map_values(tx_fee_breakdown_raw),uint256 '0',(s, x) -> s + x,s -> s)"
29+
config:
30+
where: "block_time > now() - interval '7' day"

dbt_subprojects/hourly_spellbook/seeds/_sector/gas/evm_gas_fees.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,5 @@ story,DynamicFee,0xb5b9d0f9f6efa508f214a5ad175abe12263d50c283b47ea2e1aab85266964
172172
henesys,Legacy,0x000000dcebd92485929bd284f63e786fb94bf0cf39d2cef919ed2701bb4d316c,3671200000036712
173173
henesys,AccessList,0x00075fc13ce7318102ae363c623ed1a7dff909a28da25a936e380358ee3bc72c,3674800000036748
174174
henesys,DynamicFee,0x00000074e2a9bca175a10dbef028be5141b35497c9ceef7227c8a7edd9a0f0ce,7325000000000000
175+
mezo,DynamicFee,0x00000ee163552877ae7dfb58c8a583afb024eb30c9b5c4467234e8efe1b7a790,583551540000
176+
mezo,Legacy,0x0000151e3547284707380f631c63020230a5028f4080775cf36f587636bb44a0,352806187500

dbt_subprojects/tokens/macros/transfers_from_traces/transfers_from_traces_exposed_blockchains_macro.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
"gnosis",
2323
"goerli",
2424
"hemi",
25+
"henesys",
2526
"hyperevm",
2627
"ink",
2728
"kaia",
2829
"katana",
2930
"lens",
3031
"linea",
3132
"mantle",
33+
"mezo",
3234
"nova",
3335
"opbnb",
3436
"optimism",
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
version: 2
2+
3+
models:
4+
- name: tokens_mezo_base_transfers
5+
meta:
6+
blockchain: mezo
7+
sector: tokens
8+
contributors: tomfutago
9+
config:
10+
tags: ['tokens','transfers', 'mezo']
11+
description: >
12+
Token transfers
13+
data_tests:
14+
- dbt_utils.unique_combination_of_columns:
15+
combination_of_columns:
16+
- block_date
17+
- unique_key
18+
columns:
19+
- name: unique_key
20+
description: "Surrogate key to identify unique row"
21+
- name: blockchain
22+
description: "The blockchain of the transfers"
23+
- name: block_date
24+
description: "The date of the block"
25+
- name: block_time
26+
description: "The time of the block"
27+
- name: block_number
28+
description: "The block number"
29+
- name: tx_hash
30+
description: "The transaction hash"
31+
- name: evt_index
32+
description: "The log event index of the transfer if any"
33+
- name: trace_address
34+
description: "The trace address of the transfer if any"
35+
- name: token_standard
36+
description: "The token standard of the transfer"
37+
- name: tx_from
38+
description: "The transaction sender"
39+
- name: tx_to
40+
description: "The transaction receiver"
41+
- name: tx_index
42+
description: "The transaction index"
43+
- name: from
44+
description: "The sender of the transfer"
45+
- name: to
46+
description: "The receiver of the transfer"
47+
- name: contract_address
48+
description: "The contract address of the transfer"
49+
- name: amount_raw
50+
description: "The raw amount of the transfer"
51+
52+
- name: tokens_mezo_transfers
53+
meta:
54+
blockchain: mezo
55+
sector: tokens
56+
contributors: tomfutago
57+
config:
58+
tags: ['tokens','transfers', 'mezo']
59+
description: >
60+
Token transfers
61+
data_tests:
62+
- dbt_utils.unique_combination_of_columns:
63+
combination_of_columns:
64+
- block_date
65+
- unique_key
66+
columns:
67+
- name: unique_key
68+
description: "Surrogate key to identify unique row"
69+
- name: blockchain
70+
description: "The blockchain of the transfers"
71+
- name: block_date
72+
description: "The date of the block"
73+
- name: block_time
74+
description: "The time of the block"
75+
- name: block_number
76+
description: "The block number"
77+
- name: tx_hash
78+
description: "The transaction hash"
79+
- name: evt_index
80+
description: "The log event index of the transfer if any"
81+
- name: trace_address
82+
description: "The trace address of the transfer if any"
83+
- name: token_standard
84+
description: "The token standard of the transfer"
85+
- name: tx_from
86+
description: "The transaction sender"
87+
- name: tx_to
88+
description: "The transaction receiver"
89+
- name: tx_index
90+
description: "The transaction index"
91+
- name: from
92+
description: "The sender of the transfer"
93+
- name: to
94+
description: "The receiver of the transfer"
95+
- name: contract_address
96+
description: "The contract address of the transfer"
97+
- name: symbol
98+
description: "The token symbol transferred"
99+
- name: amount_raw
100+
description: "The raw amount of the transfer"
101+
- name: amount
102+
description: "The formatted amount of the transfer"
103+
- name: price_usd
104+
description: "The USD price used to calculate the amount_usd"
105+
- name: amount_usd
106+
description: "The USD amount of the transfer"
107+
108+
- name: tokens_mezo_net_transfers_daily
109+
meta:
110+
blockchain: mezo
111+
sector: tokens
112+
contributors: tomfutago
113+
config:
114+
tags: ['tokens', 'net_transfers', 'daily']
115+
description: "Total transfer amount per day"
116+
data_tests:
117+
- dbt_utils.unique_combination_of_columns:
118+
combination_of_columns:
119+
- blockchain
120+
- block_date
121+
122+
- name: tokens_mezo_net_transfers_daily_asset
123+
meta:
124+
blockchain: mezo
125+
sector: tokens
126+
contributors: tomfutago
127+
config:
128+
tags: ['tokens', 'net_transfers']
129+
description: "Total transfer amount per day per asset"
130+
data_tests:
131+
- dbt_utils.unique_combination_of_columns:
132+
combination_of_columns:
133+
- blockchain
134+
- block_date
135+
- contract_address
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{ config(
2+
schema = 'tokens_mezo',
3+
alias = 'base_transfers',
4+
partition_by = ['block_month'],
5+
materialized = 'incremental',
6+
file_format = 'delta',
7+
incremental_strategy = 'merge',
8+
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')],
9+
unique_key = ['block_date','unique_key'],
10+
)
11+
}}
12+
13+
{{ transfers_base(
14+
blockchain = 'mezo',
15+
traces = source('mezo','traces'),
16+
transactions = source('mezo','transactions'),
17+
erc20_transfers = source('erc20_mezo','evt_Transfer')
18+
)
19+
}}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% set blockchain = 'mezo' %}
2+
3+
{{ config(
4+
schema = 'tokens_' + blockchain
5+
, alias = 'net_transfers_daily'
6+
, materialized = 'incremental'
7+
, file_format = 'delta'
8+
, incremental_strategy = 'merge'
9+
, unique_key = ['blockchain', 'block_date']
10+
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')]
11+
)
12+
}}
13+
14+
{{ evm_net_transfers_daily(blockchain) }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% set blockchain = 'mezo' %}
2+
3+
{{ config(
4+
schema = 'tokens_' + blockchain
5+
, alias = 'net_transfers_daily_asset'
6+
, materialized = 'incremental'
7+
, file_format = 'delta'
8+
, incremental_strategy = 'merge'
9+
, unique_key = ['blockchain', 'block_date', 'contract_address']
10+
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')]
11+
)
12+
}}
13+
14+
{{ evm_net_transfers_daily_asset(
15+
blockchain = blockchain,
16+
native_contract_address = var('ETH_ERC20_ADDRESS')
17+
)
18+
}}

0 commit comments

Comments
 (0)