mlhUntitled Query
Updated 2022-10-03Copy Reference Fork
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 sushiswap_pools_data as (select pool_address,--credit to naranjaninja
pool_name,
token0,
token1
from ethereum.core.dim_dex_liquidity_pools
where platform = 'sushiswap'
),
liquidity_data as (select block_timestamp,
event_inputs:amount0::numeric as amount0,
event_inputs:amount1::numeric as amount1,
contract_address as pool_address,
origin_from_address as provider,
tx_hash,
case when event_name = 'Burn' then 'removed liquidity'
when event_name = 'Mint' then 'added liquidity'
else null end as liquidity_event
from ethereum.core.fact_event_logs
where contract_address in (select pool_address
from sushiswap_pools_data
)
and liquidity_event is not null
and block_timestamp >= '2022-09-01' and block_timestamp <= '2022-09-30'
)
select liquidity_event,
period,
sum(_total_volume_usd) as total_volume_usd
from (select block_timestamp,
pool_address,
provider,
tx_hash,
liquidity_event,
pool_name,
symbol_token0,
symbol_token1,
case when liquidity_event = 'added liquidity' then _amount_usd_token0
Run a query to Download Data