Query editor
-- ============================================================-- STABLECOIN VELOCITY: monthly transfer volume ÷ supply-- -------------------------------------------------------------- Velocity separates "money being used" from "money being parked".-- velocity = monthly transfer volume (USD) / month-end supplyWITH stable_tokens AS (SELECT * FROM (VALUES('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7, 'USDT'),('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 'USDC'),('base', 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913, 'USDC'),('celo', 0x765de816845861e75a25fca122bb6898b8b1282a, 'cUSD')) AS t(blockchain, contract_address, symbol)),-- -------------------------------------------------------------- 1. Monthly transfer volume (real transfers only, no mint/burn)-- ------------------------------------------------------------monthly_volume AS (SELECTdate_trunc('month', t.block_time) AS month,st.blockchain,st.symbol,SUM(t.amount_usd) AS transfer_volume_usd,COUNT(*) AS transfer_count,COUNT(DISTINCT t."from") AS active_senders,SUM(CASE WHEN t.amount_usd < 100 THEN 1 ELSE 0 END)AS transfers_lt_100,SUM(CASE WHEN t.amount_usd >= 100 AND t.amount_usd < 1000 THEN 1 ELSE 0 END)AS transfers_100_1k,SUM(CASE WHEN t.amount_usd >= 1000 AND t.amount_usd < 10000 THEN 1 ELSE 0 END)AS transfers_1k_10k,SUM(CASE WHEN t.amount_usd >= 10000 THEN 1 ELSE 0 END)AS transfers_gte_10kFROM tokens.transfers tJOIN stable_tokens stON t.blockchain = st.blockchainAND t.contract_address = st.contract_addressLEFT JOIN (SELECT DISTINCT blockchain, tx_hashFROM dex.tradesWHERE block_time >= DATE '2023-01-01') dON d.blockchain = t.blockchainAND d.tx_hash = t.tx_hashWHERE t.block_time >= DATE '2023-01-01'AND t."from" <> 0x0000000000000000000000000000000000000000AND t."to" <> 0x0000000000000000000000000000000000000000AND t.amount_usd IS NOT NULLAND d.tx_hash IS NULLGROUP BY 1, 2, 3),-- -------------------------------------------------------------- 2. Supply: cumulative net mints, sampled at month end