Query editor
with ev as (select 'M' as typ, evt_tx_hash as h, evt_block_time as t, evt_block_number as b, evt_index as i, owner, tickLower as tl, tickUpper as tu,cast(amount as double) as l, cast(amount0 as double) as a0, cast(amount1 as double) as a1from uniswap_v3_ethereum.uniswapv3pool_evt_mintwhere contract_address = 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 and evt_block_time < timestamp '2026-08-23' and amount > 0union allselect 'B', evt_tx_hash, evt_block_time, evt_block_number, evt_index, owner, tickLower, tickUpper,-cast(amount as double), cast(amount0 as double), cast(amount1 as double)from uniswap_v3_ethereum.uniswapv3pool_evt_burnwhere contract_address = 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 and evt_block_time < timestamp '2026-08-23' and amount > 0),nh as (select distinct h from ev where owner = 0xc36442b4a4522e871399cd717abdd847ab11fe88),npm as (select 'M' as typ, evt_tx_hash as h, evt_index as i, tokenId, cast(liquidity as double) as lfrom uniswap_v3_ethereum.nonfungiblepositionmanager_evt_increaseliquidity where evt_tx_hash in (select h from nh)union allselect 'B', evt_tx_hash, evt_index, tokenId, -cast(liquidity as double)from uniswap_v3_ethereum.nonfungiblepositionmanager_evt_decreaseliquidity where evt_tx_hash in (select h from nh)),m as (select ev.*, n.tokenId,row_number() over (partition by ev.h, ev.i order by n.i - ev.i) as rfrom ev left join npm n on ev.owner = 0xc36442b4a4522e871399cd717abdd847ab11fe88 and n.h = ev.h and n.typ = ev.typ and n.l = ev.l and n.i > ev.i),e as (select typ, t, b, i, tl, tu, l, a0, a1, to_hex(h) as h,case when owner = 0xc36442b4a4522e871399cd717abdd847ab11fe88 then concat('nft', cast(tokenId as varchar))else concat(to_hex(owner), '_', cast(tl as varchar), '_', cast(tu as varchar)) end as pid,to_hex(owner) as ownerfrom m where r = 1),st as (select pid, min(owner) as owner, min(tl) as tl, min(tu) as tu, sum(l) as lfrom e where t < timestamp '2026-05-30' group by pid having sum(l) > 1)select 'S' as typ, pid, owner, tl, tu, cast(null as varchar) as t, cast(null as bigint) as b, cast(null as bigint) as i, l, cast(null as double) as a0, cast(null as double) as a1, '' as h from stunion allselect typ, pid, owner, tl, tu, cast(t as varchar), b, i, l, a0, a1, h from e where t >= timestamp '2026-05-30'