Query editor
-- =====================================================================-- STABLECOIN VAULT BENCHMARK — Money Account (mUSD, Monad) vs. peers-- One row per vault. Built for a comparison table + per-metric bar charts.---- Methodology mirrors Money Account headline query 8252966 so the mUSD-- row reconciles with the existing dashboard:-- * Balances come from the FULL share Transfer ledger (not dep - wd).-- * Cohorts are DEPOSITOR-anchored: an address counts only if it was the-- recipient of a deposit event (Veda Enter.to / ERC-4626 Deposit.owner).-- Share holders that never deposited (queues, fee recipients, p2p-- receivers, adapters) are excluded from depositor metrics.-- * ACTIVE depositor = live balance >= $1 (dust_usd in params).-- * Share price = rate implied by the last 3 days of exits-- (fallback: all flows in last 30d, then last event).-- * TOTAL ACTIVE DEPOSITS = TVL = shares outstanding across all chains-- x share price (includes pooled holders, e.g. ether.fi's Aave v4 hub).-- * 30D DEPOSIT GROWTH = total active deposits now vs. at close 30 days ago.-- * Rolling windows exclude today (complete days only).---- PRODUCT-LEVEL: shares are summed across every chain a vault lives on-- (see deployments). Price comes from the vault's rate_chain only.-- Reads raw {chain}.logs so every vault goes through identical logic,-- whether or not Dune has decoded the contract.---- Event layouts used (topic0 verified via keccak):-- Transfer(from idx, to idx, value) 0xddf252ad…-- Veda Enter(from idx, asset idx, amount, to idx, shares) 0xea00f887… user = topic3-- Veda Exit(to idx, asset idx, amount, from idx, shares) 0xe0c82280… user = topic3-- ERC4626 Deposit(sender idx, owner idx, assets, shares) 0xdcbc1c05… user = topic2-- ERC4626 Withdraw(sender, receiver, owner idx, a, s) 0xfbde797d… user = topic3-- =====================================================================WITH params AS (SELECT 1.00 AS dust_usd -- same threshold as Money Account. State it next to counts.),-- ── VAULT REGISTRY ────────────────────────────────────────────────────-- One row per PRODUCT. rate_chain = chain whose deposit/exit events set the-- share price (the accountant's home chain). rate_asset: only set for-- multi-asset vaults so price is derived from one 6-decimal asset.-- share_decimals: only used for the display column usd_per_share.vaults (vault_key, vault_name, home_chain, rate_chain, vault, curator, vault_type,rate_asset, asset_decimals, share_decimals, sort_order) AS (VALUES('mm_musd', 'MetaMask Money Account (mUSD)', 'monad', 'monad',0x1c8a336051d2024e318a229d01f9f6cf96efd316, 'Steakhouse', 'Veda BoringVault',CAST(0xaca92e438df0b2401ff60da7e4337b687a2435da AS varbinary), 6, 6, 1),('kraken_usdc', 'Kraken DeFi Earn Advanced Strategies USDC', 'ink', 'ink',0x9761ddf8e79930b334f1be1bd93abe3695061cca, 'Sentora', 'Veda BoringVault',CAST(NULL AS varbinary), 6, 6, 2),('etherfi_usd', 'ether.fi Liquid USD', 'ethereum + optimism + scroll', 'ethereum',0x08c6f91e2b681faf5e17227f2a44c307b3c1364c, 'Nonce Capital', 'Veda BoringVault',CAST(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 AS varbinary), 6, 6, 3),('plasma_usd', 'Plasma USD Vault', 'plasma + ethereum', 'plasma',0xd1074e0ae85610ddba0147e29ebe0d8e5873a000, 'Veda', 'Veda BoringVault',CAST(NULL AS varbinary), 6, 6, 4),('rh_usdg', 'Robinhood Earn Steakhouse USDG', 'robinhood', 'robinhood',0xbeeff033f34c046626b8d0a041844c5d1a5409dd, 'Steakhouse', 'Morpho Vault V2',CAST(NULL AS varbinary), 6, 18, 5),('cb_prime', 'Coinbase Steakhouse Prime USDC', 'base', 'base',