Query editor
WITH-- Define TGE date and key parametersconstants AS (SELECTDATE '2024-12-20' AS tge_date,10000000000 AS total_supply),-- Generate monthly date series for 60 months (5 years) from TGEdate_series AS (SELECTtge_date + INTERVAL '1' MONTH * (sequence - 1) AS unlock_date,sequence AS month_numberFROM constantsCROSS JOIN UNNEST(sequence(1, 60)) AS t(sequence)),-- Calculate Treasury unlockstreasury_unlocks AS (SELECTd.unlock_date,d.month_number,CASEWHEN d.month_number = 1 THEN 500000000.0 -- Initial unlock at TGEWHEN d.month_number >= 2 AND d.month_number <= 37 THEN 900000000.0 / 36 -- Remaining over 36 months starting month 2ELSE 0END AS treasury_tokens,'Treasury' AS categoryFROM date_series d),-- Calculate Loyalty Program unlocks (25% over 60 months)loyalty_unlocks AS (SELECTd.unlock_date,d.month_number,2500000000.0 / 60 AS loyalty_tokens, -- Vested over 60 months starting from TGE'Loyalty Program & Incentives' AS categoryFROM date_series dWHERE d.month_number <= 60),-- Calculate Investor unlocks (complex schedule)investor_unlocks AS (SELECTd.unlock_date,d.month_number,-- Tranche 1: 1B tokens, 25% cliff + 75% over 48 months (months 13-60)CASEWHEN d.month_number = 13 THEN 1000000000.0 * 0.25 + (1000000000.0 * 0.75) / 48 -- Cliff + first monthly paymentWHEN d.month_number > 13 AND d.month_number <= 60 THEN (1000000000.0 * 0.75) / 48 -- Monthly paymentsELSE 0END AS investor_tokens_tranche1,-- Tranche 2: 877,973,632 tokens, 50% cliff + 50% over 24 months (months 13-36)CASEWHEN d.month_number = 13 THEN 877973632.0 * 0.5 + (877973632.0 * 0.5) / 24 -- Cliff + first monthly paymentWHEN d.month_number > 13 AND d.month_number <= 36 THEN (877973632.0 * 0.5) / 24 -- Monthly paymentsELSE 0END AS investor_tokens_tranche2,'Investors' AS category