gaonip[Staging] Uniswap undeployed_capital
Updated 2023-10-25
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 uni_lps as (
SELECT
liquidity_provider,
date_trunc('day', block_timestamp) as date
FROM
ethereum.uniswapv3.ez_positions
WHERE
date >= '2023-10-01' and is_active = TRUE
GROUP BY
1,2
LIMIT
1000
),
eth as (SELECT
user_address,
balance/1e18 as balance_adj,
'eth' as tokentype,
rank() over(partition by user_address order by block_timestamp desc) as rank_balance
FROM
ethereum.core.fact_eth_balances
where user_address in (select liquidity_provider from uni_lps)
qualify rank_balance = 1
),
token as (SELECT
user_address,
balance,
contract_address as tokentype,
rank() over(partition by user_address order by block_timestamp desc) as rank_balance
FROM
ethereum.core.fact_token_balances
where user_address in (select liquidity_provider from uni_lps)
qualify rank_balance = 1)
select
a.user_address,
a.balance_adj as eth_balance,
Run a query to Download Data