Query editor
with transactions as (select *from zksync.transactionswhere block_time <= try_cast('2024-03-24' AS TIMESTAMP)),user_summary as (select"from" as user_address,count(distinct "to") as dest_address_count,count(distinct date_trunc('month', block_time)) as active_months_count,sum(z.value*p.price)/power(10,18) as amount_usdfrom transactions zleft join prices.usd pon date_trunc('minute', z.block_time) = p.minute and p.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2group by 1),user_summary_with_rank as (select *,(+ if(active_months_count >= 2, 1, 0) -- Conducted transactions during 2 distinct months+ if(active_months_count >= 6 , 1, 0) -- Conducted transactions during 6 distinct months+ if(active_months_count >= 9, 1, 0) -- Conducted transactions during 9 distinct months+ if(dest_address_count >= 4, 1, 0) -- Interacted more than 5 contracts on source chain+ if(dest_address_count >= 10, 1, 0) -- Interacted more than 10 contracts on source chain+ if(dest_address_count >= 25, 1, 0) -- Interacted more than 25 contracts on source chain+ if(dest_address_count >= 100, 1, 0) -- Interacted more than 100 contracts on source chain+ if(amount_usd > 10000, 1, 0) -- Bridged more than $10,000 of assets through ZKSync+ if(amount_usd > 50000, 1, 0) -- Bridged more than $50,000 of assets through ZKSync+ if(amount_usd > 250000, 1, 0) -- Bridged more than $250,000 of assets through ZKSync) as rank_scorefrom user_summary)select row_number() over (order by rank_score desc, amount_usd desc) as "Rank",user_address,rank_score as "Score",dest_address_count as "Unique Contracts",round(amount_usd, 2) as "Amount (in USD) of total transactions",cast(active_months_count as varchar) as "Unique Active Months"from user_summary_with_rankorder by rank_score desc, amount_usd desc