Query editor
-- Stabletide A1: weekly net mint/burn per token-chain (last 3 years)WITH ev AS (SELECT 'USDT-Ethereum' AS token_chain, evt_block_date AS day, CAST(amount AS decimal(38,0)) AS amt FROM tether_ethereum.tether_usd_evt_issue WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDT-Ethereum', evt_block_date, -CAST(amount AS decimal(38,0)) FROM tether_ethereum.tether_usd_evt_redeem WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDT-Ethereum', evt_block_date, -CAST(_balance AS decimal(38,0)) FROM tether_ethereum.tether_usd_evt_destroyedblackfunds WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDC-Ethereum', evt_block_date, CAST(amount AS decimal(38,0)) FROM circle_ethereum.usdc_evt_mint WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDC-Ethereum', evt_block_date, -CAST(amount AS decimal(38,0)) FROM circle_ethereum.usdc_evt_burn WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDT-Tron', evt_block_date, CAST(amount AS decimal(38,0)) FROM tether_tron.tether_usd_evt_issue WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDT-Tron', evt_block_date, -CAST(amount AS decimal(38,0)) FROM tether_tron.tether_usd_evt_redeem WHERE evt_block_date >= current_date - interval '3' yearUNION ALL SELECT 'USDT-Tron', evt_block_date, -CAST(_balance AS decimal(38,0)) FROM tether_tron.tether_usd_evt_destroyedblackfunds WHERE evt_block_date >= current_date - interval '3' year)SELECTtoken_chain,date_trunc('week', day) AS week,CAST(SUM(amt) / 1e6 AS double) AS net_mintFROM evGROUP BY token_chain, date_trunc('week', day)ORDER BY week, token_chain