Query editor
-- FUN Token Overall Claim and Behavior Aggregates-- Outputs a single row with overall summaries (% held/staked/sold/transferred across all claimed tokens, wallet counts by behavior)-- Modified to include pct_held_plus_soft_staked_overallWITH config AS (SELECT0x16ee7ecac70d1028e7712751e2ee6ba808a7dd92 AS fun_token, -- FUN token contract0xc9b3fb6d908430023cce0fb66c8a7e2afbcd69ea AS legion_distribution_contract, -- Legion distribution contract-- CEX addresses on Base (for seller detection)0xcD53c9fa6b1B6bB0Ba93e555477168C52BFc5747 AS kraken_1, -- Kraken deposit0x3c944fefe7905a90a1e9b3fd1db62e34d79e8f09 AS kraken_2, -- Kraken internal-- Add more CEX addresses as identifiedTIMESTAMP '2026-01-15 00:00' AS tge_date -- Track activity after TGE),-- Identify vesting contracts by OwnershipTransferred eventsvesting_contracts AS (SELECT DISTINCTcontract_address AS vesting_contractFROM base.logsWHERE topic0 = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0 -- OwnershipTransferred),-- Get all claims from Legion distribution contract (aggregated, excluding vesting contracts)claims AS (SELECTt."to" AS recipient_address,SUM(t.value / 1e18) AS total_claim_amount,COUNT(DISTINCT t.evt_tx_hash) AS number_of_claim_txs, -- Count unique transactionsMIN(t.evt_block_time) AS first_claim_time,MAX(t.evt_block_time) AS last_claim_time,ARRAY_AGG(DISTINCT t.evt_tx_hash) AS unique_tx_hashes -- Unique tx hashes onlyFROM erc20_base.evt_Transfer tCROSS JOIN config cLEFT JOIN vesting_contracts v ON v.vesting_contract = t."to"WHERE t.contract_address = c.fun_tokenAND t."from" = c.legion_distribution_contractAND t."to" != 0x0000000000000000000000000000000000000000AND t.evt_block_time >= c.tge_date -- Only check claims after TGEAND v.vesting_contract IS NULL -- EXCLUDE vesting contractsGROUP BY t."to"),sdf_wallets AS (SELECT DISTINCT wallet AS sdf_walletFROM query_6529373),-- Track all transfers FROM recipients (outflows)recipient_transfers AS (SELECTcl.recipient_address,cl.total_claim_amount,-- Amount sent to CEXCOALESCE(SUM(CASEWHEN t."to" IN (c.kraken_1, c.kraken_2) THEN t.value / 1e18ELSE 0