Flippppppaaverage user copy
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 rezarwz / average user @ https://flipsidecrypto.xyz/rezarwz/q/btG5nnu7abPo/average-user
with
price_tl as (
select
date_trunc('day', hour) as date,
token_address,
avg(price) as price
from
crosschain.core.fact_hourly_prices
WHERE
token_address = '0x4200000000000000000000000000000000000006'
AND IS_IMPUTED = 'false'
and PROVIDER in ('coinmarketcap', 'coingecko')
and hour > '2023-01-20 00:00:00.000'
group by
1,
2
),
total_tx as (
SELECT
ez.BLOCK_TIMESTAMP::date as date,
ez.tx_hash,
ez.FROM_ADDRESS as user_address,
ez.TX_FEE as eth_fee,
ez.TX_FEE * price as usd_fee
FROM
optimism.core.fact_transactions ez
INNER join price_tl pr on pr.date = ez.block_timestamp::date
WHERE
ez.block_timestamp::date >= '2023-01-20'
),
total_user as(
SELECT
count(tx_hash) as number_of_transaction,
sum(eth_fee) as total_eth_fee,
Run a query to Download Data