Query editor
SELECTday, mints, burns, net, burns*-1 AS burns_,SUM(net) OVER (order by day) AS total_circulatingFROM(SELECTday, SUM(COALESCE(mints, 0)) AS mints,SUM(COALESCE(burns,0)) AS burns,SUM(COALESCE(mints, 0)+COALESCE(burns, 0)) as netFROM(SELECTdate_trunc('day', evt_block_time) AS day,SUM(CAST(value as double)/1e6) FILTER (WHERE "from" = 0x0000000000000000000000000000000000000000) as mints ,SUM(-CAST(value as double)/1e6) FILTER (WHERE "to" = 0x0000000000000000000000000000000000000000) as burnsFROM erc20_ethereum.evt_transfer -- dune_user_generated.cryptuschrist_usdc_transfersWHERE ("from" = 0x0000000000000000000000000000000000000000OR "to" = 0x0000000000000000000000000000000000000000)and contract_address = 0x00000000efe302beaa2b3e6e1b18d08d69a9012a-- AND evt_block_time > NOW() - INTERVAL '1 year'GROUP BY 1UNION ALLSELECTdate_trunc('day', evt_block_time) AS day,SUM(CAST(value as double)/1e6) FILTER (WHERE "from" = 0x0000000000000000000000000000000000000000) as mints ,SUM(-CAST(value as double)/1e6) FILTER (WHERE "to" = 0x0000000000000000000000000000000000000000) as burnsFROM erc20_ethereum.evt_transferWHERE ("from" = 0x0000000000000000000000000000000000000000OR "to" = 0x0000000000000000000000000000000000000000)and contract_address = 0x00000000efe302beaa2b3e6e1b18d08d69a9012aGROUP BY 1) aGROUP BY dayORDER BY day DESC) b-- LEFT JOIN dune_user_generated.treasury_bills_2017_2023 on date_trunc('day',_date) = day-- LEFT JOIN dune_user_generated.one_year_treasury_bills on date_trunc('day',_date) = dayORDER BY day DESCLIMIT 1000-- SELECT-- day, mints, burns, net, burns*-1 AS burns_,-- SUM(net) OVER (order by day) AS total_circulating-- FROM-- (-- SELECT-- day, SUM(COALESCE(mints, 0)) AS mints,-- SUM(COALESCE(burns,0)) AS burns,-- SUM(COALESCE(mints, 0)+COALESCE(burns, 0)) as net-- FROM-- (-- SELECT-- date_trunc('day', block_time) AS day,-- SUM(usdc) FILTER (WHERE usdc_from = '\x0000000000000000000000000000000000000000') as mints ,-- SUM(-usdc) FILTER (WHERE usdc_to = '\x0000000000000000000000000000000000000000') as burns-- FROM dune_user_generated.cryptuschrist_usdc_transfers-- WHERE (usdc_from = '\x0000000000000000000000000000000000000000'-- OR usdc_to = '\x0000000000000000000000000000000000000000')-- -- AND block_time > NOW() - INTERVAL '1 year'-- GROUP BY day-- UNION ALL