Query editor
WITH Flow_Transactions AS (-- OutflowsSELECTDATE_TRUNC('day', evt_block_time) AS date,value / -1e18 AS valueFROMerc20_ethereum.evt_TransferWHEREcontract_address = 0x83E9115d334D248Ce39a6f36144aEaB5b3456e75AND "from" = 0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7UNION ALL-- InflowsSELECTDATE_TRUNC('day', evt_block_time) AS date,value / 1e18 AS valueFROMerc20_ethereum.evt_TransferWHEREcontract_address = 0x83E9115d334D248Ce39a6f36144aEaB5b3456e75AND "to" = 0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7),Latest_Investor_Stake AS (SELECT total_staked_by_investorsFROM query_4128013--ORDER BY address DESCLIMIT 1 -- Ensure this fetches the latest row based on the desired ordering)SELECTdate,SUM(value) AS daily_flow,SUM(SUM(value)) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS circulating_beigen_supply,SUM(SUM(value)) OVER (ORDER BY date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) - (SELECT total_staked_by_investors FROM Latest_Investor_Stake) AS staked_by_usersFROM Flow_TransactionsGROUP BY dateORDER BY date DESC;