CryptoIcicleWhat's going on with Optimism? - Tx Metrics
Updated 2023-11-07
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
›
⌄
-- Payout 150 USDC
-- Grand Prize 450 USDC
-- Level Advanced
-- What's going on with Optimism?
-- This is an open-ended bounty, what we call a Free Square, and it’s an opportunity for you to show us what you’ve got.
-- Any topic is fair game; The goal here is to explore the data in creative ways and show off your explorations with visualizations (or even a tool/frontend if you’ve got eyes on the grand prize).
with eth_price as (
select
date_trunc('day', hour) as date,
avg(price) as price
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH' and hour >= CURRENT_DATE - {{n_days}}
group by date
),
txns as (
select
t.*,
((t.gas_price/1e9) * (t.gas_used)) * (price) as gas_used_usd
from optimism.core.fact_transactions t
join eth_price p on t.block_timestamp::date = p.date
)
select
block_timestamp::date as date,
status as type,
count(distinct from_address) as n_users,
count(distinct tx_hash) as tx_frequncy,
sum(gas_used_usd) as gas_usd,
sum(n_users) over (order by date asc rows between unbounded preceding and current row) as cum_n_users,
sum(gas_usd) over (order by date asc rows between unbounded preceding and current row) as cum_gas_usd,
sum(tx_frequncy) over (order by date asc rows between unbounded preceding and current row) as cum_tx_frequncy
from txns
group by date, type
Run a query to Download Data