Rodolfo-LimaActive Users in Winter - Distr
Updated 2023-09-27
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 users_before_winter AS (
SELECT
MIN(DATE(BLOCK_TIMESTAMP)) AS first_date,
ORIGIN_FROM_ADDRESS,
'Users Before the Winter' AS category
FROM
ethereum.core.ez_dex_swaps
WHERE
platform = 'uniswap-v3'
AND DATE(BLOCK_TIMESTAMP) < '2021-12-01' -- Before the winter beginning
GROUP BY
ORIGIN_FROM_ADDRESS,
category
ORDER BY
first_date DESC
),
active_users AS (
SELECT
s.ORIGIN_FROM_ADDRESS,
fee_percent * amount_in_usd AS fee_usd,
COALESCE(u.category, 'Users In the Winter') AS first_interaction
FROM
ethereum.core.ez_dex_swaps s
LEFT JOIN users_before_winter u ON s.ORIGIN_FROM_ADDRESS = u.ORIGIN_FROM_ADDRESS
INNER JOIN ethereum.uniswapv3.ez_pools p ON s.contract_address = p.pool_address
WHERE
platform = 'uniswap-v3'
AND DATE(s.BLOCK_TIMESTAMP) >= '2021-12-01'
)
SELECT
first_interaction,
SUM(fee_usd) AS revenue,
COUNT( DISTINCT ORIGIN_FROM_ADDRESS ) AS total_active_users
FROM
Run a query to Download Data