CryptoIcicleArbitrum Free Square Question - Swap Metrics
Updated 2023-06-13
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
›
⌄
-- Payout 125 USDC
-- Grand Prize 2000 USDC
-- Level Advanced
-- Show us what you can do with this new Arbitrum data!
with
txns as (
select
t.*,
((t.gas_price_paid/1e9) * (t.gas_used)) as gas_used_arbitrum
from arbitrum.core.fact_transactions t
join arbitrum.core.fact_event_logs e on t.tx_hash = e.tx_hash and e.event_name = 'Swap'
)
select
block_timestamp::date as date,
count(distinct from_address) as n_users,
count(distinct tx_hash) as swap_frequency,
sum(gas_used_arbitrum) as swap_gas_arbitrum,
sum(n_users) over (order by date asc rows between unbounded preceding and current row) as cum_n_users,
sum(swap_gas_arbitrum) over (order by date asc rows between unbounded preceding and current row) as cum_swap_gas_arbitrum,
sum(swap_frequency) over (order by date asc rows between unbounded preceding and current row) as cum_swap_frequency
from txns
group by date
Run a query to Download Data