Query editor
-- Original SQL authored for volganin's portfolio, 2026-09-16.-- Models observed stablecoin custody flows only, not verified sale subscriptions.-- Ethereum address candidates originate in volganin query 6350971, not official contract verification.WITH sale_windows(sale_id, opens_at, closes_at, accepts_usde) AS (VALUES('Tea',from_iso8601_timestamp('2025-09-25T17:00:00Z'),from_iso8601_timestamp('2025-10-02T17:00:00Z'),true),('Bitlayer',from_iso8601_timestamp('2025-07-31T16:00:00Z'),from_iso8601_timestamp('2025-08-07T16:00:00Z'),false)), masters(address) AS (VALUES (0x8d1f2ebfaccf1136db76fdd1b86f1dede2d23852),(0xd1669ac6044269b59fa12c5822439f609ca54f41)), raw_transfers AS (SELECT block_time, unique_key, tx_hash, "from", "to", contract_address, amountFROM tokens.transfersWHERE blockchain = 'ethereum'AND block_month BETWEEN DATE '2025-07-01' AND DATE '2025-10-01'AND ((block_time >= from_iso8601_timestamp('2025-07-31T16:00:00Z')AND block_time < from_iso8601_timestamp('2025-08-14T16:00:00Z'))OR (block_time >= from_iso8601_timestamp('2025-09-25T17:00:00Z')AND block_time < from_iso8601_timestamp('2025-10-09T17:00:00Z')))AND contract_address IN (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0xdac17f958d2ee523a2206206994597c13d831ec7,0x4c9edd5852cd905f086c759e8383e09bff1e68b3)AND ("from" IN (SELECT address FROM masters) OR "to" IN (SELECT address FROM masters))), scoped AS (SELECT s.sale_id, r.block_time, r.unique_key, r.tx_hash, r.amount,CASE WHEN r.block_time < s.closes_at THEN 'sale_window' ELSE 'post_close_7d' END AS phase,CASE WHEN r."from" IN (SELECT address FROM masters) AND r."to" IN (SELECT address FROM masters)THEN 'internal'WHEN r."to" IN (SELECT address FROM masters) THEN 'inbound'ELSE 'outbound' END AS direction,CASE WHEN r."to" IN (SELECT address FROM masters) THEN r."from" ELSE r."to" END AS walletFROM raw_transfers r JOIN sale_windows sON r.block_time >= s.opens_at AND r.block_time < s.closes_at + INTERVAL '7' DAYAND (s.accepts_usde OR r.contract_address != 0x4c9edd5852cd905f086c759e8383e09bff1e68b3)), wallets AS (SELECT sale_id,wallet,SUM(IF(phase='sale_window' AND direction='inbound',amount,0)) AS inbound_units,SUM(IF(phase='sale_window' AND direction='outbound',amount,0)) AS outbound_units,SUM(IF(phase='post_close_7d' AND direction='outbound',amount,0)) AS post_close_outbound_unitsFROM scoped WHERE direction != 'internal' GROUP BY 1,2), demands AS (SELECT *,inbound_units-outbound_units AS net_funding_proxyFROM wallets), tea_levels AS (SELECT net_funding_proxy AS demand,COUNT(*) AS walletsFROM demandsWHERE sale_id='Tea' AND net_funding_proxy BETWEEN 100 AND 500000GROUP BY 1), level_stats AS (SELECT demand, wallets,COALESCE(SUM(demand*wallets) OVER (ORDER BY demand ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING),0) AS lower_demand,COALESCE(SUM(wallets) OVER (ORDER BY demand ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING),0) AS lower_wallets,SUM(wallets) OVER () AS total_wallets,SUM(demand*wallets) OVER () AS total_demandFROM tea_levels), tea_cap AS (SELECT CASE WHEN MAX(total_demand)<=2000000 THEN MAX(demand)ELSE MIN_BY((2000000-lower_demand)/(total_wallets-lower_wallets),demand)FILTER (WHERE lower_demand+(total_wallets-lower_wallets)*demand>=2000000) END AS cap_unitsFROM level_stats