jackguyop mega 4
Updated 2023-02-06
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
›
⌄
with tab1 as (
SELECT
SPLIT_PART(date_trunc('day', block_timestamp), ' ', 1) as day,
count(DISTINCT tx_hash) as transactions,
--count(DISTINCT FROM_ADDRESS) as users,
count(DISTINCT TO_ADDRESS) as active_contracts,
sum(ETH_VALUE) as eth_transfered
FROM optimism.core.fact_transactions
WHERE block_timestamp > CURRENT_DATE - 180
AND STATUS LIKE 'SUCCESS'
GROUP BY 1
ORDER BY 1
), tab2 as (
SELECT
min_day as day1,
count(*) as users
FROM (
SELECT
from_address,
min(SPLIT_PART(date_trunc('day', block_timestamp), ' ', 1)) as min_day
FROM optimism.core.fact_transactions
GROUP BY 1
)
GROUP BY 1
)
SELECT
day,
transactions,
users,
active_contracts,
eth_transfered
FROM tab1
LEFT outer join tab2
ON day = day1
Run a query to Download Data