Updated 2022-11-03
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
›
⌄
WITH contracts as (
SELECT *
FROM optimism.core.dim_labels
WHERE project_name LIKE 'perpetual protocol'
)
,
m as(
SELECT
date_trunc('day', block_timestamp) as day,
COUNT(DISTINCT tx_hash) as events,
COUNT(DISTINCT ORIGIN_FROM_ADDRESS) as users,
sum(events) over(order by day asc) as Cum_events,
sum(users) over(order by day asc) as Cum_users,
Avg(users) over(order by day asc) as Avg_users
FROM optimism.core.fact_event_logs
WHERE contract_address IN (SELECT address FROM contracts)
GROUP BY 1
order by 1 asc
)
select sum(events), round((select sum(users)/count(distinct day) from m),0) as Avg_Users from m
limit 1
Run a query to Download Data