Query editor
WITHparams AS (SELECT0xab02bf85a7a851b6a379ea3d5bd3b9b4f5dd8461 AS sale_contract,0xdac17f958d2ee523a2206206994597c13d831ec7 AS usdt,-- sale started Oct 27, 2025 @ 00:00 UTC (adjust if you have the exact launch block timestamp)TIMESTAMP '2025-10-27 00:00:00 UTC' AS sale_start_ts,2 AS min_children),-- 1. all USDT -> sale_contract transfers = "bids"bids AS (SELECTt.evt_block_time AS bid_time,t."from" AS bidder,t."to" AS sale_contract,t.value AS raw_amount, -- USDT has 6 decimalst.contract_address AS token,t.evt_tx_hash AS tx_hashFROM erc20_ethereum.evt_Transfer tCROSS JOIN params pWHERE t."to" = p.sale_contractAND t.contract_address = p.usdt),-- 2. inbound USDT funding each bidder ANYTIME since sale_start_ts up to their bidfunding AS (SELECTb.bidder,b.bid_time,b.tx_hash AS bid_tx_hash,f."from" AS funder,f."to" AS funded_wallet,f.value AS funded_raw_amount,f.evt_block_time AS fund_timeFROM bids bCROSS JOIN params pJOIN erc20_ethereum.evt_Transfer fON f."to" = b.bidderAND f.contract_address = p.usdt-- fund_time must be BEFORE the bid, but anytime after sale startAND f.evt_block_time BETWEEN p.sale_start_tsAND b.bid_time-- exclude self-fundingAND f."from" <> b.bidder),-- 3. summarize clusters: funder -> many biddersclusters AS (SELECTfunder,COUNT(DISTINCT bidder) AS distinct_bidder_wallets,SUM(funded_raw_amount) / 1e6 AS total_usdt_sent_since_sale_start,MIN(fund_time) AS first_fund_time,MAX(fund_time) AS last_fund_timeFROM fundingGROUP BY funder