Query editor
/* XDAO — Dashboard headline. Every number on the dashboard comes from this query,so any reader can press Run and reproduce the whole top row.Covers all 11 EVM chains indexed by Dune. TON is added to the "DAOs created" count only(via c_ton) — TON treasury inflow is measured separately and is not yet in the money metrics,because TON funds sit in a per-DAO treasury contract, not the GP-token master. Keeping `daos`EVM-only preserves the tokens.transfers join (EVM `dao` is varbinary; the TON set is varchar). */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.to AS dao,t.blockchain AS ch,coalesce(t.symbol,'unknown') AS sym,sum(t.amount_usd) AS usd,count(*) AS nFROM 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, 3),a AS (SELECT sum(n) AS tx, count(DISTINCT sym) AS assets, sum(usd) AS total,sum(CASE WHEN sym IN ('USDT','USDT0','USD₮0','USDC','USDC.e','DAI','BUSD','TUSD','USDP','FDUSD','USDD','LUSD','FRAX','GUSD','PYUSD','USDe','crvUSD')THEN usd ELSE 0 END) AS stablesFROM g),p AS (SELECT ch, dao, sum(usd) AS total FROM g GROUP BY 1, 2),b AS (SELECT count(*) AS funded, count_if(total >= 100000) AS d100k,count_if(total >= 1000000) AS d1m, max(total) AS mxFROM p),c AS (SELECT count(*) AS created FROM daos),/* TON DAOs added to the created count only — GP-token jetton masters by contract code_hash.count(DISTINCT address): jetton_metadata has duplicate rows per address. Validated = 6,269. */c_ton AS (SELECT count(DISTINCT address) AS created_tonFROM ton.jetton_metadataWHERE code_hash = 'lm2+1vuJqXOUMuVVSb3quaQ8ZBbo6pQOIqwmq+wKDz4=')SELECT round(a.total) AS "Total inflow, USD",round(100.0 * a.stables / a.total) AS "Stablecoin share, %",c.created + c_ton.created_ton AS "DAOs created",b.funded AS "DAOs funded",b.d100k AS "DAOs over $100k",b.d1m AS "DAOs over $1M",a.tx AS "Treasury transactions",a.assets AS "Distinct assets held",round(b.mx) AS "Largest single DAO, USD",/* Начало периода — дата создания первого DAO, проверяется по factory_evt_daocreated */'14 Nov 2021 — ' || format_datetime(now(), 'd MMM yyyy') AS "Period"FROM a CROSS JOIN b CROSS JOIN c CROSS JOIN c_ton