Ramaharfee token distribution
Updated 2023-07-15Copy 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
30
31
32
›
⌄
With swap_trans as (select
DATE(block_timestamp) AS dayz,
tx_hash,
pool_name,
concat(symbol_in, '-', symbol_out) as swap_pairs,
lp_fee,
lp_fee_usd,
lp_fee_symbol
from optimism.velodrome.ez_swaps),
token_price as (select
DATE(hour) as dt,
symbol,
AVG(price) as average_price
from optimism.core.fact_hourly_token_prices
group by 1, 2 ),
details as (select
*,
lp_fee * average_price as fee_usd
from swap_trans
left join token_price ON dayz = dt AND lp_fee_symbol = symbol )
select
lp_fee_symbol,
sum(fee_usd) as fee_collected,
sum(fee_collected) over () as total_fee_collected
from details
group by 1
having fee_collected is not null
order by 2 DESC
Run a query to Download Data