Query editor
WITH ProtocolFees AS (SELECTDATE_TRUNC('day', evt_block_time) AS DATE,TRY_CAST(SUM(protocolFeeAmount) AS DOUBLE) / 1e18 AS protocolFeeEthAmountFROM v2_ali_agents_launchpad_base.erc20bondingcurvefactoryv1_evt_tradeWHEREcontract_address = 0x400e0b7106ffc2dbc1e4c4ec096c288ae6663cc8GROUP BY1), DeploymentFees AS (SELECTDATE_TRUNC('day', evt_block_time) AS DATE,COUNT(evt_tx_hash) * 300000000000000 / 1e18 AS deployment_fee_ethFROM v2_ali_agents_launchpad_base.erc20bondingcurvefactoryv1_evt_economycreatedWHEREcontract_address = 0x400e0b7106ffc2dbc1e4c4ec096c288ae6663cc8GROUP BY1), Prices AS (SELECTDATE_TRUNC('day', minute) AS DATE,MAX(price) AS PriceFROM prices.usdWHEREsymbol = 'ETH'GROUP BY1), GraduationFees AS (SELECTDATE_TRUNC('day', evt_block_time) AS DATE,COUNT(economy) * 0.03 AS graduation_fee_ethFROM v2_ali_agents_launchpad_base.erc20bondingcurvefactoryv1_evt_liquiditygraduateWHEREcontract_address = 0x400e0b7106ffc2dbc1e4c4ec096c288ae6663cc8GROUP BY1)SELECTa.DATE,protocolFeeEthAmount,protocolFeeEthAmount * Price AS protocol_fee_usd,deployment_fee_eth,deployment_fee_eth * Price AS deployment_fee_usd,d.graduation_fee_eth,d.graduation_fee_eth * Price AS graduation_fee_usd,protocolFeeEthAmount + deployment_fee_eth + COALESCE(d.graduation_fee_eth, 0) AS final_fee_eth,(protocolFeeEthAmount + deployment_fee_eth + COALESCE(d.graduation_fee_eth, 0)) * Price AS final_fee_usd,SUM(protocolFeeEthAmount) OVER (ORDER BY a.DATE) AS cumulative_protocol_fee_eth,SUM(protocolFeeEthAmount * Price) OVER (ORDER BY a.DATE) AS cumulative_protocol_fee_usd,SUM(deployment_fee_eth) OVER (ORDER BY a.DATE) AS cumulative_deployment_fee_eth,SUM(deployment_fee_eth * Price) OVER (ORDER BY a.DATE) AS cumulative_deployment_fee_usd,SUM(COALESCE(d.graduation_fee_eth, 0)) OVER (ORDER BY a.DATE) AS cumulative_graduation_fee_eth,SUM(COALESCE(d.graduation_fee_eth * Price, 0)) OVER (ORDER BY a.DATE) AS cumulative_graduation_fee_usd,SUM(protocolFeeEthAmount + deployment_fee_eth + COALESCE(d.graduation_fee_eth, 0)) OVER (ORDER BY a.DATE) AS cumulative_final_fee_eth,SUM((protocolFeeEthAmount + deployment_fee_eth + COALESCE(d.graduation_fee_eth, 0)) * Price) OVER (ORDER BY a.DATE) AS cumulative_final_fee_usdFROM ProtocolFees AS aLEFT JOIN Prices AS bON a.DATE = b.DATELEFT JOIN DeploymentFees AS cON a.DATE = c.DATE