MostlyData_PF by position - tiers
Updated 2024-11-08
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- forked from PF by position @ https://flipsidecrypto.xyz/studio/queries/88bff19e-c35e-416d-9b87-7a4841aae922
with block_info as(
select
block_number
,tx_count
,block_header_json['baseFeePerGas'] as baseFeePerGas
from ethereum.core.fact_blocks
where
block_timestamp >= current_date() - interval '{{n_days}} days'
)
,tx_data as(
select
txs.position
,txs.tx_fee_precise - bi.baseFeePerGas * txs.gas_used * pow(10,-18) as pf
,case
when txs.position <='{{fee_tier_1}}' then 'Tier 1'
when txs.position >'{{fee_tier_1}}' and txs.position <='{{fee_tier_2}}' then 'Tier 2'
when txs.position >'{{fee_tier_2}}' then 'Tier 3'
end as tier
from ethereum.core.fact_transactions txs
inner join block_info bi on bi.block_number = txs.block_number
where
block_timestamp >= current_date() - interval '{{n_days}} days'
)
,group_size as(
select
tier
,cast(
pf / cast('{{binning}}' as double) as decimal (9, 5)
QueryRunArchived: QueryRun has been archived