Query editor
-- Metronome Recovery Dashboard: Daily LP Synth Balances (Section 6)-- On-chain, live. Cumulative synth balance held by each registered LP pool (query_8222715),-- per day. Synth-side only -- does not include the paired asset (USDC/WETH/FRAXBP/etc) on-- the other side of each pool. Base query for the LP TVL chart and per-pool drill-down.WITH daily_net AS (SELECT t.block_date AS day, t.chain, p.venue, p.pool, t.synth,SUM(CASE WHEN t."to" = p.address THEN t.amount ELSE 0 END)- SUM(CASE WHEN t."from" = p.address THEN t.amount ELSE 0 END) AS netFROM dune.matthomas.result_synth_transfers tJOIN query_8222715 p ON p.chain = t.chain AND (t."to" = p.address OR t."from" = p.address)GROUP BY 1, 2, 3, 4, 5),spine AS (SELECT d AS day, combo.chain, combo.venue, combo.pool, combo.synthFROM UNNEST(SEQUENCE((SELECT MIN(day) FROM daily_net), CURRENT_DATE)) AS t(d)CROSS JOIN (SELECT DISTINCT chain, venue, pool, synth FROM daily_net) combo)SELECTsp.day, sp.chain, sp.venue, sp.pool, sp.synth,SUM(COALESCE(dn.net, 0)) OVER (PARTITION BY sp.chain, sp.venue, sp.pool, sp.synth ORDER BY sp.day) AS balanceFROM spine spLEFT JOIN daily_net dn ON dn.day = sp.day AND dn.chain = sp.chain AND dn.venue = sp.venue AND dn.pool = sp.pool AND dn.synth = sp.synthORDER BY 1, 2, 3, 4, 5;