Query editor
with tab1 as (SELECTcasewhen not token_bought_symbol in ('USDC', 'USDT') then token_bought_symbolwhen not token_sold_symbol in ('USDC', 'USDT') then token_sold_symbolelse 'USDC-USDT Swap' end as Pair_token,tx_hashFROM dex.tradesWHERE blockchain = 'ethereum'AND block_time >= TIMESTAMP '2025-07-01 00:00:00 UTC'AND (token_bought_address IN (from_hex('dAC17F958D2ee523a2206206994597C13D831ec7'),from_hex('A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'))OR token_sold_address IN (from_hex('dAC17F958D2ee523a2206206994597C13D831ec7'),from_hex('A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'))))SELECTPair_token,sum(CAST(et.gas_price AS DECIMAL(38,0)) * CAST(et.gas_used AS DECIMAL(38,0))) / 1e18 AS fee_ethFROM ethereum.transactions etLEFT JOIN tab1 tON et.hash = t.tx_hashWHERE et.block_time >= TIMESTAMP '2025-07-01 00:00:00 UTC'and not t.tx_hash is nullgroup by 1order by 2 desclimit 40