Query editor
with base as (select*from base.transactions), user_summary as (select"from" as user_address,count(distinct "to") as dest_address_count,count(*) as transaction_count,min(block_time) as initial_block_time,max(block_time) as last_block_time,date_diff('day', min(block_time), now()) as base_age_days,count(distinct date_trunc('day', block_time)) as active_days_count,count(distinct date_trunc('week', block_time)) as active_weeks_count,count(distinct date_trunc('month', block_time)) as active_months_count,sum(b.value*p.price)/power(10,18) as amount_usdfrom base bleft join prices.usd pon date_trunc('minute', b.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(active_months_count >= 12, 1, 0) -- Conducted transactions during 12 distinct months+ if(active_weeks_count >= 10, 1, 0) -- Conducted transactions during 10 distinct weeks+ if(active_weeks_count >= 20, 1, 0) -- Conducted transactions during 20 distinct weeks+ if(active_weeks_count >= 50, 1, 0) -- Conducted transactions during 50 distinct weeks+ if(active_weeks_count >= 100, 1, 0) -- Conducted transactions during 100 distinct weeks+ if(active_days_count >= 50, 1, 0) -- Conducted transactions during 50 distinct days+ if(active_days_count >= 100, 1, 0) -- Conducted transactions during 100 distinct days+ if(active_days_count >= 200, 1, 0) -- Conducted transactions during 200 distinct days+ if(active_days_count >= 500, 1, 0) -- Conducted transactions during 500 distinct days+ if(base_age_days >= 100, 1, 0) -- Started using Layer Zero before 100 days+ if(base_age_days >= 200, 1, 0) -- Started using Layer Zero before 200 days+ if(base_age_days >= 500, 1, 0) -- Started using Layer Zero before 500 days+ if(transaction_count >= 5, 1, 0) -- Conducted more than 5 transactions+ if(transaction_count >= 10, 1, 0) -- Conducted more than 10 transactions+ if(transaction_count >= 25, 1, 0) -- Conducted more than 25 transactions+ if(transaction_count >= 50, 1, 0) -- Conducted more than 50 transactions+ if(transaction_count >= 100, 1, 0) -- Conducted more than 100 transactions+ if(dest_address_count >= 5, 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 >= 50, 1, 0) -- Interacted more than 100 contracts on source chain+ if(dest_address_count >= 100, 1, 0) -- Interacted more than 100 contracts on source chain+ if(amount_usd > 0, 1, 0) -- Bridged funds through Layer Zero