Query editor
WITH lock_durations AS (SELECTtokenId,amount / 1e18 as amount_hemi,timestamp as deposit_time,lockTime as unlock_time,-- Calculate lock duration in secondslockTime - timestamp as lock_duration_seconds,-- Calculate lock duration in days(lockTime - timestamp) / 86400.0 as lock_duration_days,-- Calculate lock duration in years(lockTime - timestamp) / (365.25 * 86400.0) as lock_duration_years,provider,evt_block_time,evt_tx_hashFROM hemi_hemi.vehemi_evt_depositWHERE amount > 0 -- Only include actual deposits, not just time extensions),duration_buckets AS (SELECT *,CASE-- Exact matches for airdrop staking functions (allowing small tolerance for rounding)WHEN ABS(lock_duration_days - (6 * 30.4375)) < 1 THEN '6 months' -- ~182.6 daysWHEN ABS(lock_duration_days - (24 * 30.4375)) < 1 THEN '24 months' -- ~730.5 daysWHEN ABS(lock_duration_days - (48 * 30.4375)) < 1 THEN '48 months' -- ~1461 days-- Catch other durationsWHEN lock_duration_days < 15 THEN '< 15 days'WHEN lock_duration_days < 90 THEN '< 3 months'WHEN lock_duration_days < 180 THEN '3-6 months (other)'WHEN lock_duration_days < 365 THEN '6-12 months (other)'WHEN lock_duration_days < 730 THEN '12-24 months (other)'WHEN lock_duration_days < 1095 THEN '24-36 months (other)'WHEN lock_duration_days < 1460 THEN '36-48 months (other)'ELSE '> 48 months'END as duration_bucket,-- Check if duration aligns with SIX_DAYS intervals (6.0875 days)MOD(lock_duration_seconds, (365.25 * 86400 / 60)) as six_days_remainderFROM lock_durations)SELECT-- Summary by duration bucketsduration_bucket,COUNT(*) as num_deposits,COUNT(DISTINCT tokenId) as unique_tokens,SUM(amount_hemi) as total_amount_locked,AVG(amount_hemi) as avg_amount_per_deposit,MIN(lock_duration_days) as min_duration_days,MAX(lock_duration_days) as max_duration_days,AVG(lock_duration_days) as avg_duration_days,-- Check alignment with SIX_DAYS intervalsCOUNT(CASE WHEN six_days_remainder < 1 THEN 1 END) as aligned_with_six_days,COUNT(*) - COUNT(CASE WHEN six_days_remainder < 1 THEN 1 END) as not_alignedFROM duration_bucketsGROUP BY duration_bucket