Elprognerd7 - chart of top contracts with most txn fee volume
Updated 2023-03-27
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
›
⌄
with t1 as (
select
name as "Contract",
sum(tx_fee) as "Total fees"
from avalanche.core.fact_transactions x join avalanche.core.fact_event_logs y on x.tx_hash = y.tx_hash
join avalanche.core.dim_contracts z on y.contract_address = z.address
where x.block_timestamp >= '{{From_Date}}'
and x.block_timestamp <= '{{To_Date}}'
GROUP BY 1
ORDER BY 2 DESC
LIMIT 5
)
select
date_trunc('{{Time_Unit}}',x.block_timestamp) as date,
name as "Contract",
sum(tx_fee) as "Total fees"
from avalanche.core.fact_transactions x join avalanche.core.fact_event_logs y on x.tx_hash = y.tx_hash
join avalanche.core.dim_contracts z on y.contract_address = z.address
where x.block_timestamp >= '{{From_Date}}'
and x.block_timestamp <= '{{To_Date}}'
and name in (SELECT "Contract" from t1)
GROUP BY 1, 2
ORDER BY 1
Run a query to Download Data