Query editor
-- Dune Analytics SQL Query: VeeFriends S2 Long-Term Holder Attrition vs Threshold Sweep-- Contract: 0x9378368ba6b85c1fba5b131b530f5f5bedf21a18-- Purpose: For multiple thresholds (0,1,6,12,24,36,48 months), compute long-term holder attrition.-- Note: 0 months = "ALL TIME" (no minimum hold requirement).-- ============================================================================-- CONFIG-- ============================================================================WITH config AS (SELECT0x9378368ba6b85c1fba5b131b530f5f5bedf21a18 AS contract_address,CAST('2021-05-01' AS TIMESTAMP) AS start_date,CURRENT_TIMESTAMP AS end_date),-- Thresholds to sweep (months)thresholds AS (SELECT * FROM (VALUES(0), -- ALL TIME(1),(6),(12),(24),(36),(48)) AS t(holding_period_months)),-- ============================================================================-- TRUE TOKEN UNIVERSE (NO DATE FILTER)-- ============================================================================all_tokens AS (SELECT DISTINCT t.token_idFROM nft.transfers tCROSS JOIN config cWHERE t.contract_address = c.contract_addressAND t.blockchain = 'ethereum'),-- Earliest transfer time for the contract (for max possible holding calc)earliest_transfer AS (SELECT MIN(t.block_time) AS first_transfer_timeFROM nft.transfers tCROSS JOIN config cWHERE t.contract_address = c.contract_addressAND t.blockchain = 'ethereum'),-- ============================================================================-- STEP 1: Date-Filtered Transfers for Holding & Attrition Logic-- ============================================================================veefriends_transfers AS (SELECTt.block_time,t.block_number,t.tx_hash,t."from" AS sender_address,t."to" AS recipient_address,t.token_id,