Query editor
-- Asset Management Sector: Ethena + ether.fi-- Ethena: USDe minting/redeeming via decoded event tables-- ether.fi: eETH/weETH DEX trading as proxyWITH ethena_mint AS (SELECTevt_block_date AS block_date,'Ethena' AS protocol,SUM(CAST(usde_amount AS double) / 1e18) AS mint_volume_usd,COUNT(DISTINCT benefactor) AS active_users,COUNT(*) AS event_countFROM ethena_ethereum.EthenaMinting_evt_MintWHERE evt_block_date >= CURRENT_DATE - INTERVAL '90' DAYGROUP BY 1),ethena_redeem AS (SELECTevt_block_date AS block_date,'Ethena' AS protocol,SUM(CAST(usde_amount AS double) / 1e18) AS redeem_volume_usd,COUNT(DISTINCT benefactor) AS active_users,COUNT(*) AS event_countFROM ethena_ethereum.EthenaMinting_evt_RedeemWHERE evt_block_date >= CURRENT_DATE - INTERVAL '90' DAYGROUP BY 1),ethena_daily AS (SELECTCOALESCE(m.block_date, r.block_date) AS block_date,'Ethena' AS protocol,COALESCE(m.mint_volume_usd, 0) + COALESCE(r.redeem_volume_usd, 0) AS total_volume_usd,(COALESCE(m.mint_volume_usd, 0) + COALESCE(r.redeem_volume_usd, 0)) * 0.001 AS estimated_fees_usd,GREATEST(COALESCE(m.active_users, 0), COALESCE(r.active_users, 0)) AS active_users,COALESCE(m.event_count, 0) + COALESCE(r.event_count, 0) AS event_countFROM ethena_mint mFULL OUTER JOIN ethena_redeem r ON m.block_date = r.block_date),etherfi AS (SELECTCAST(block_time AS date) AS block_date,'ether.fi' AS protocol,SUM(amount_usd) AS total_volume_usd,SUM(amount_usd * 0.001) AS estimated_fees_usd,COUNT(DISTINCT CAST(tx_from AS varchar)) AS active_users,COUNT(*) AS event_countFROM dex.tradesWHERE (token_bought_symbol IN ('eETH', 'weETH') OR token_sold_symbol IN ('eETH', 'weETH'))AND block_month >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '90' DAY)AND block_time >= CURRENT_DATE - INTERVAL '90' DAYGROUP BY 1)SELECTblock_date,protocol,total_volume_usd AS volume_usd,estimated_fees_usd,