HadisehSushi and the Merge 3
Updated 2022-10-04
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 t1 as ( select
trunc(hour,'day') as date,
symbol,
token_address,
avg(price) as average_of_price,
decimals
from ethereum.core.fact_hourly_token_prices
where hour::date >= '2022-09-01'
and hour::date < '2022-10-01'
group by date,symbol,token_address,decimals),
t2 as (
select 'Add Liquidity' as cased,
trunc(block_timestamp,'day') as date,
tx_hash,
pool_name,
origin_from_address,
EVENT_INPUTS:amount0/pow(10,d.decimals)*d.average_of_price as volume_0,
EVENT_INPUTS:amount1/pow(10,c.decimals)*c.average_of_price as volume_1
from ethereum.core.fact_event_logs a join ethereum.core.dim_dex_liquidity_pools b on a.contract_address = b.pool_address
left outer join t1 d on a.block_timestamp::date = d.date and b.token0 = d.token_address
left outer join t1 c on a.block_timestamp::date = c.date and b.token1 = c.token_address
where a.origin_to_address = lower('0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f')
and a.event_name = 'Mint' or a.event_name ilike '%addl%'),
t3 as (select 'Remove Liquidity' as cased,
trunc(block_timestamp,'day') as date,
tx_hash,
pool_name,
origin_from_address,
EVENT_INPUTS:amount0/pow(10,d.decimals)*d.average_of_price as volume_0,
EVENT_INPUTS:amount1/pow(10,c.decimals)*c.average_of_price as volume_1
from ethereum.core.fact_event_logs a join ethereum.core.dim_dex_liquidity_pools b on a.contract_address = b.pool_address
left outer join t1 c on a.block_timestamp::date = c.date and b.token1 = c.token_address
left outer join t1 d on a.block_timestamp::date = d.date and b.token0 = d.token_address
where a.origin_to_address = lower('0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f')
Run a query to Download Data