hess3. Fees Breakdown - 90
Updated 2023-03-22Copy Reference Fork
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
›
⌄
with price as ( select hour::date as date , avg(price) as avg_price
from ethereum.core.fact_hourly_token_prices
where date >= CURRENT_DATE - 90
and symbol = 'WETH'
group by 1)
,
gas as ( select date(a.block_timestamp) as date, a.tx_hash, voter, proposal_id, voting_power, tx_fee, tx_fee*avg_price as fee_usd, avg_price
from ethereum.core.fact_transactions a join ethereum.aave.ez_votes b on a.tx_hash = b.tx_hash
left outer join price c on a.block_timestamp::date = c.date
where a.block_timestamp >= CURRENT_DATE - 90)
,
final as ( select voter, fee_usd
from gas)
select count(DISTINCT(voter)) as total_voter,
case when fee_usd <= 0.5 then 'a. Below 0.5$'
when fee_usd <= 1 then 'b. 0.5-1$'
when fee_usd <= 2 then 'c. 1-2$'
when fee_usd <= 3 then 'd. 2-3$'
when fee_usd <= 4 then 'e. 3-4$'
when fee_usd <= 5 then 'f. 4-5$'
when fee_usd <= 6 then 'g. 5-6$'
when fee_usd <= 7 then 'h. 6-7$'
when fee_usd > 7 then 'i. +7$' end as category
from final
group by 2
Run a query to Download Data