Query editor
-- Query 1b: Stablecoin Bridge Summary Counters-- Dashboard top-row counters: total volume, total txs, unique wallets, top protocol---- Each row is a separate counter widget on the dashboard.-- Dune counter: set Column to "value", Row number to the row you want.-- Deduplicate tokens.erc20 to avoid inflating counts from duplicate token entriesWITH stablecoin_tokens AS (SELECT DISTINCT contract_address, blockchainFROM tokens.erc20WHERE symbol IN ('USDC', 'USDC.e', 'USDbC', 'USDT', 'USDT0','DAI', 'BUSD', 'TUSD', 'FRAX', 'LUSD','USDP', 'PYUSD', 'GHO', 'USDe', 'USDS', 'crvUSD')),stablecoin_bridges AS (SELECTb.bridge_name,b.amount_usd,b.senderFROM bridges_evms.flows bINNER JOIN stablecoin_tokens tON b.deposit_token_address = t.contract_addressAND b.deposit_chain = t.blockchainWHERE b.deposit_block_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '12' MONTH)AND b.amount_usd > 0AND b.bridge_name != 'Agglayer'),totals AS (SELECTSUM(amount_usd) AS total_volume,COUNT(*) AS total_txs,COUNT(DISTINCT sender) AS unique_walletsFROM stablecoin_bridges),top_protocol AS (SELECT bridge_name, SUM(amount_usd) AS volFROM stablecoin_bridgesGROUP BY 1ORDER BY 2 DESCLIMIT 1)-- Row 1: Total Volume (counter with prefix $, suffix B or use Dune formatting)-- Row 2: Total Transactions-- Row 3: Unique Wallets-- Row 4: Top Protocol by VolumeSELECT 'Total Volume (12M)' AS metric, CAST(total_volume AS DOUBLE) AS value, '' AS label FROM totalsUNION ALLSELECT 'Total Transactions (12M)', CAST(total_txs AS DOUBLE), '' FROM totalsUNION ALLSELECT 'Unique Wallets (12M)', CAST(unique_wallets AS DOUBLE), '' FROM totalsUNION ALLSELECT 'Top Protocol', vol, bridge_name FROM top_protocol