Query editor
/* XDAO — Treasury inflow by chain, all 11 indexed chains.Aggregates to (chain, dao) first, so counting funded DAOs in the grouped"Other chains" bucket counts pairs, not addresses — the same DAO address existson several chains because deployment is deterministic. */WITH daos AS (SELECT DISTINCT chain, daoFROM xdao_v2_multichain.factory_evt_daocreatedWHERE chain IN ('ethereum','arbitrum','bnb','polygon','base','optimism','fantom','avalanche_c','celo','scroll','linea')),g AS (SELECT t.blockchain AS ch,t.to AS dao,sum(t.amount_usd) AS usdFROM tokens.transfers tJOIN daos d ON d.chain = t.blockchain AND d.dao = t.toLEFT JOIN daos s ON s.chain = t.blockchain AND s.dao = t."from"WHERE t.blockchain IN ('ethereum','arbitrum','bnb','polygon','base','optimism','fantom','avalanche_c','celo','scroll','linea')AND t.block_date >= DATE '2021-11-01'AND t.amount_usd IS NOT NULLAND s.dao IS NULLGROUP BY 1, 2),h AS (SELECT CASE chWHEN 'ethereum' THEN 'Ethereum' WHEN 'arbitrum' THEN 'Arbitrum'WHEN 'bnb' THEN 'BNB Chain' WHEN 'polygon' THEN 'Polygon'ELSE 'Other'END AS chain_label,sum(usd) AS usd,count(*) AS fundedFROM gGROUP BY 1)SELECT chain_label AS "Chain",round(usd) AS "Inflow, USD",funded AS "DAOs funded"FROM hORDER BY CASE WHEN chain_label = 'Other' THEN 1 ELSE 0 END, usd DESC