Query editor
-- [v0+v1+v2] TVL by Assets — core-stats "TVL by Assets" pie (viz 10766390).-- Depends on: query_4921564 ([v1] TVL by assets), query_4572092 ([v0] Symb Vaults TVL),-- query_8291505 (base_v2_tvl_daily — Core v2)---- 2026-08-11: added the Core v2 branch, and changed UNION -> UNION ALL.-- The UNION was a latent bug, not a stylistic choice: the v0 branch emits one row PER VAULT with-- tvl_usd already ROUNDed to whole dollars (query_4572092), so two v0 vaults sharing a symbol and-- a rounded value were silently collapsed into one before the SUM. UNION ALL keeps every vault's-- contribution. This may move some slices slightly — that is the fix, not a regression.WITH all_vaults AS (--v1 vaults (already aggregated per symbol, as of CURRENT_DATE - 1)SELECT symbol, TVL_usdFROM query_4921564UNION ALL--v0 vaults (one row per vault)SELECT symbol, tvl_usd AS TVL_usdFROM query_4572092UNION ALL--v2 vaults (one row per vault, same as-of day as the v1 branch)SELECT symbol, TVL_usdFROM query_8291505WHERE dt = CURRENT_DATE - INTERVAL '1' day)SELECTSUM(TVL_usd) AS TVL_usd,symbolFROM all_vaultsWHERE symbol IS NOT NULLGROUP BY symbolHAVING SUM(TVL_usd) > 0ORDER BY TVL_usd DESC