Query editor
-- PARAMETERS:-- {{jetton}} = your jetton root (UPPER)-- {{months}} = e.g. 48-- (optional) restrict to airdrop sender(s): uncomment the AND source IN (...) linesWITH bounds AS (SELECT CURRENT_DATE - INTERVAL '{{months}}' MONTH AS start_d),comments(c) AS (SELECT * FROM (VALUES('DRAGO Community Takeover'),('Something something testing testing')) AS t(c)),recipients AS (SELECT DISTINCT e.destination AS ownerFROM ton.jetton_events eWHERE NOT e.tx_abortedAND e.jetton_master = UPPER('{{jetton}}')AND e.amount > 0AND e.block_date >= (SELECT start_d FROM bounds)AND LOWER(TRIM(e.comment)) IN (SELECT LOWER(TRIM(c)) FROM comments)-- AND e.source IN (UPPER('0:ADDR1'), UPPER('0:ADDR2'))),airdrop_received AS (SELECT e.destination AS owner, SUM(e.amount) AS airdrop_rawFROM ton.jetton_events eWHERE NOT e.tx_abortedAND e.jetton_master = UPPER('{{jetton}}')AND e.amount > 0AND e.block_date >= (SELECT start_d FROM bounds)AND LOWER(TRIM(e.comment)) IN (SELECT LOWER(TRIM(c)) FROM comments)AND e.destination IN (SELECT owner FROM recipients)-- AND e.source IN (UPPER('0:ADDR1'), UPPER('0:ADDR2'))GROUP BY e.destination),events_touching AS (SELECT source, destination, amountFROM ton.jetton_eventsWHERE NOT tx_abortedAND jetton_master = UPPER('{{jetton}}')AND (source IN (SELECT owner FROM recipients)OR destination IN (SELECT owner FROM recipients))),owner_current AS (SELECT owner, SUM(delta) AS balance_rawFROM (SELECT destination AS owner, amount AS delta FROM events_touchingUNION ALLSELECT source AS owner, -amount AS delta FROM events_touching) uWHERE owner IN (SELECT owner FROM recipients)GROUP BY owner)SELECTCAST((SELECT COUNT(*) FROM recipients) AS DOUBLE) AS wallets_received,CAST((SELECT COUNT(*) FROM owner_current WHERE balance_raw > 0) AS DOUBLE) AS wallets_holding_now,CAST((SELECT SUM(airdrop_raw) FROM airdrop_received) / 1e9 AS DOUBLE) AS total_airdropped,