Query editor
WITH pondex_swaps AS (SELECTa.hash AS hash,a.block_number AS block_number,a.block_time AS block_time,a."from" AS swapper,'WETH' AS token_sold_symbol,a."value" / 1e18 AS token_sold_amount,e.symbol AS token_purchased_symbol,c."value" / POWER(10, e.decimals) / 0.010101010101 AS token_received_amount,c."value" / POWER(10, e.decimals) AS swap_fee,d."amount_usd" AS swap_value_usdFROM ethereum.transactions AS aINNER JOIN ethereum.traces_decoded AS bON a.hash = b.tx_hashINNER JOIN erc20_ethereum.evt_Transfer AS cON a.hash = c.evt_tx_hashINNER JOIN dex.trades AS dON a.hash = d.tx_hashINNER JOIN tokens.erc20 AS eON c.contract_address = e.contract_addressWHEREa.to = 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FADAND a.value > 0AND a.success = TRUEAND b.function_name = 'execute'AND c.to = 0x17CC6042605381c158D2adab487434Bde79Aa61CAND d.blockchain = 'ethereum'ORDER BYa.block_number)SELECThash,block_number,block_time,swapper,token_sold_symbol,SUM(DISTINCT token_sold_amount) AS token_sold_amount,token_purchased_symbol,MAX(token_received_amount) AS token_received_amount,MAX(swap_fee) AS swap_fee,SUM(DISTINCT swap_value_usd) AS swap_value_usdFROM pondex_swapsGROUP BYhash,block_number,block_time,swapper,token_sold_symbol,token_purchased_symbolORDER BYblock_number