Updated 2024-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
36
›
⌄
WITH all_actions AS (
SELECT
ft.FROM_ADDRESS AS address,
'swap' AS action_type,
MIN(DATE_TRUNC('day', ez.BLOCK_TIMESTAMP)) AS first_action_day
FROM
ethereum.uniswapv3.ez_swaps ez
JOIN ethereum.core.fact_transactions ft ON ez.TX_HASH = ft.TX_HASH
GROUP BY
ft.FROM_ADDRESS
UNION
SELECT
ft.FROM_ADDRESS AS address,
'lp' AS action_type,
MIN(DATE_TRUNC('day', ez.BLOCK_TIMESTAMP)) AS first_action_day
FROM
ethereum.uniswapv3.ez_positions ez
JOIN ethereum.core.fact_transactions ft ON ez.TX_HASH = ft.TX_HASH
GROUP BY
ft.FROM_ADDRESS
),
first_actions AS (
SELECT
address,
first_action_day,
ROW_NUMBER() OVER (
PARTITION BY address
ORDER BY
first_action_day
) AS rn
FROM
all_actions
),
new_wallets AS (
SELECT
address,
QueryRunArchived: QueryRun has been archived