Query editor
WITH mint_events AS (SELECTDATE_TRUNC('day', block_time) AS date,tx_hash,block_time,VARBINARY_TO_UINT256(data) / 1e18 AS tokens_mintedFROM monad_testnet.logsWHEREcontract_address = 0x3a98250F98Dd388C211206983453837C8365BDc1 /* LST contract */AND topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef /* Transfer event */AND topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 /* from zero address (mint) */AND topic2 <> 0x0000000000000000000000000000000000000000000000000000000000000000 /* to non-zero address */), burn_events AS (SELECTDATE_TRUNC('day', block_time) AS date,tx_hash,block_time,VARBINARY_TO_UINT256(data) / 1e18 AS tokens_burnedFROM monad_testnet.logsWHEREcontract_address = 0x3a98250F98Dd388C211206983453837C8365BDc1 /* LST contract */AND topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef /* Transfer event */AND topic1 <> 0x0000000000000000000000000000000000000000000000000000000000000000 /* from non-zero address */AND topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000 /* to zero address (burn) */), mon_outflows AS (SELECTdate,SUM(tokens_burned) AS mon_withdrawn,COUNT(*) AS burn_countFROM burn_eventsGROUP BYdate), daily_flows AS (SELECTdate,SUM(tokens_minted) AS daily_mon_inflow,COUNT(*) AS mint_countFROM mint_eventsGROUP BYdate)SELECTCOALESCE(d.date, o.date) AS date,COALESCE(d.daily_mon_inflow, 0) AS daily_mon_inflow,COALESCE(o.mon_withdrawn, 0) AS daily_mon_outflow,COALESCE(d.daily_mon_inflow, 0) - COALESCE(o.mon_withdrawn, 0) AS net_mon_flow,SUM(COALESCE(d.daily_mon_inflow, 0) - COALESCE(o.mon_withdrawn, 0)) OVER (ORDER BY COALESCE(d.date, o.date) ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_mon_balance,COALESCE(d.mint_count, 0) AS mint_count,COALESCE(o.burn_count, 0) AS burn_countFROM daily_flows AS dFULL OUTER JOIN mon_outflows AS oON d.date = o.dateORDER BYdate DESC