Query editor
with s as (select tx_from,sum(casewhen topic2=0x0100002bf8f1043ce4170a16dfef57a828440984ce0e0b688fc3266f07411777 then 1 --contract that just transfer eth then refundwhen topic2=0x01000021a88a3dee3b0944ff9cbf36cb51c26df19b404d38a115a2a2e3ee5b88 then 2 --increase counterwhen topic2=0x010000939c0f641c18abe55b3a876a26f1720e4903c3f12e25b8b6214942db90 then 4 --shit tokenwhen topic2=0x0100004124426fb9ebb25e27d670c068e52f9ba631bd383279a188be47e3f86d then 8 --gnosis sefeelse 0 end ) as group_id from(select distinct tx_from, topic2 from zksync.logswheretopic2=0x0100002bf8f1043ce4170a16dfef57a828440984ce0e0b688fc3266f07411777or topic2=0x01000021a88a3dee3b0944ff9cbf36cb51c26df19b404d38a115a2a2e3ee5b88or topic2=0x010000939c0f641c18abe55b3a876a26f1720e4903c3f12e25b8b6214942db90or topic2=0x0100004124426fb9ebb25e27d670c068e52f9ba631bd383279a188be47e3f86d)group by 1),t as (select distinct "from", hash, data from zksync.transactionsinner join s on zksync.transactions."from"=tx_from andto in (select address from dune.matter_labs.dataset_zksync_era_address_labels where-- project= 'zkSwap Finance' and"type"='LP Pair'))-- select second(top_min_intervals[1]) as min_interval , group_id , count(*) as users from(select a.tx_from, txns, slice(intervals, 1, 5) as top_min_intervals , s.group_id from (select tx_from, count(*) as txns, array_agg(approve_interval order by approve_interval asc) as intervals from (select "from" as tx_from, nonce, block_time-last_block_time as approve_interval, block_time, last_block_time from(select "from", nonce, block_time, lead(block_time) over (partition by "from" order by block_number desc) as last_block_time from zksync.transactions where"from" in (select "from" from t) -- and bytearray_starts_with(data, 0x095ea7b3))) where approve_interval<=interval '31' second group by 1) a inner join s on a.tx_from=s.tx_fromwhere txns>=4-- )group by 1, 2