MLDZMNLP10
Updated 2022-08-24
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 tb1 as (SELECT *
from ethereum.core.dim_dex_liquidity_pools
where PLATFORM='sushiswap'),
tb2 as (SELECT
ORIGIN_FROM_ADDRESS as LP1,
sum(amount_USD) as ADD_USD,
min(BLOCK_TIMESTAMP) as add_time
from ethereum.core.ez_token_transfers
where TO_ADDRESS in (select POOL_ADDRESS from tb1)
and ORIGIN_TO_ADDRESS='0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f'
and origin_function_signature in ('0xe8e33700', '0xded9382a', '0xf305d719')
and BLOCK_TIMESTAMP>=CURRENT_DATE-365
group by 1),
tb3 as (SELECT
ORIGIN_FROM_ADDRESS as LP2,
sum(amount_USD) as remove_usd,
max(BLOCK_TIMESTAMP)::date as remove_time
from ethereum.core.ez_token_transfers
where ORIGIN_TO_ADDRESS='0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f'
and origin_function_signature in ('0xbaa2abde', '0x2195995c', '0x02751cec')
and BLOCK_TIMESTAMP>=CURRENT_DATE-365
group by 1),
tb4 as (select
tb2.LP1 as LP,
(remove_usd - ADD_USD) as USD_proit,
remove_time as days
from tb3 left outer join tb2 on tb3.LP2=tb2.LP1
where USD_proit is not null
)
Run a query to Download Data