Query editor
with lp_address as (SELECTlp_address,namespaceFROMquery_2031078wheretoken0 = 0x2eCBa91da63C29EA80Fbe7b52632CA2d1F8e5Be0or token1 = 0x2eCBa91da63C29EA80Fbe7b52632CA2d1F8e5Be0),tag_summary as (select lp_address as address, 'dex' as tag, 'dex' as name from lp_addressUNIONselect 0x0000000000000000000000000000000000000000 as address, 'airdrop' as tag, 'ferc_ad' as name),hourly_token_price_detail_without_seq as (-- with-- price_from_rpc as (-- select date_trunc('hour',minute)as hourly_time, AVG(price) as median_price from prices.usd where contract_address=0x2eCBa91da63C29EA80Fbe7b52632CA2d1F8e5Be0 group by date_trunc('hour',minute) limit 10-- ),-- price_from_dex as (-- select t1.hour as hourly_time,t1.median_price from dex.prices t1 left join price_from_rpc t2 on t1.hour=t2.hourly_time where t1.contract_address=0x2eCBa91da63C29EA80Fbe7b52632CA2d1F8e5Be0 and t2.hourly_time is null-- )-- select * from price_from_rpc-- UNION-- select * from price_from_dex-- unionselect hourly_time,median_price from query_2601221-- select hour as hourly_time,median_price from dex.prices where contract_address =0x2eCBa91da63C29EA80Fbe7b52632CA2d1F8e5Be0),hourly_token_price_detail as (selecttime as hourly_time,first_value(median_price)over(partition by flag order by time) as median_pricefrom(selectt2.time,t1.median_price,sum(if(t1.median_price is null,0,1)) over(order by t2.time) as flagfrom hourly_token_price_detail_without_seq t1RIGHT JOIN query_2463151 t2 on t1.hourly_time=t2.time -- minutly seqwhere t2.time < CURRENT_TIMESTAMPand t2.time > (select min(hourly_time) from hourly_token_price_detail_without_seq)) tmp-- order by 1),latest_price as (select median_price as price from hourly_token_price_detail where median_price > 0 order by hourly_time desc limit 1),transfer_detail as (SELECTevt_block_time,to as address,t3.median_price,cast(value as double)/1e18 as balance,CASEWHEN t1."from"= t2.address and tag='dex' THEN 'Bought'WHEN t1."from"= t2.address and tag='airdrop' Then 'Airdrop'ELSE 'Receive'