superflyUntitled Query
Updated 2022-09-18
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
›
⌄
with min1 as (select date_trunc('day', block_timestamp) as day,
case when token0_symbol = 'WETH' then amount0_usd
when token1_symbol = 'WETH' then amount1_usd
end as WETH_USD_deposited,
case when token0_symbol = 'WETH' then amount0_adjusted
when token1_symbol = 'WETH' then amount1_adjusted
end as WETH_deposited from ethereum.uniswapv3.ez_lp_actions
where (token0_symbol = 'WETH' or token1_symbol = 'WETH')
and action = 'INCREASE_LIQUIDITY' and day >= '2022-06-01'),
min2 as (select date_trunc('day', block_timestamp) as day,
case when token0_symbol = 'WETH' then amount0_usd
when token1_symbol = 'WETH' then amount1_usd
end as WETH_USD_withdrawn,case
when token0_symbol = 'WETH' then amount0_adjusted
when token1_symbol = 'WETH' then amount1_adjusted
end as WETH_withdrawn from ethereum.uniswapv3.ez_lp_actions
where (token0_symbol = 'WETH' or token1_symbol = 'WETH')
and action = 'DECREASE_LIQUIDITY' and day >= '2022-06-01'),
min3 as (select day, sum(WETH_USD_withdrawn) as WETH_USD_withdrawnz,
sum(WETH_withdrawn) as WETH_withdrawnz
from min2 group by 1),
min4 as (select day, sum(WETH_USD_deposited) as WETH_USD_depositedz,
sum(WETH_deposited) as WETH_depositedz
from min1 group by 1),
min5 as (select a.day, case when a.day >= '2022-08-13' then '1 month before The Merge'
else 'Other Days' end as periods, WETH_depositedz - WETH_withdrawnz as net_eth_deposited
from min4 a join min3 b
on a.day = b.day) select *,
(select sum(net_eth_deposited) from min5 where periods = '1 month before The Merge') from min5
Run a query to Download Data