Query editor
-- WSOLAddress: 'So11111111111111111111111111111111111111112'-- FeeWallet: 'AVUCZyuT35YSuj4RH7fwiyPu82Djn2Hfg7y2ND2XcnZH'-- FirstTradeTimestamp: TIMESTAMP '2024-01-08'WITHallFeePayments AS (SELECTtx_id,'SOL' AS feeTokenType,balance_change / 1e9 AS fee_token_amount,'So11111111111111111111111111111111111111112' AS fee_token_mint_address -- WSOLAddressFROMsolana.account_activityWHEREblock_time >= TIMESTAMP '2024-01-08' -- FirstTradeTimestampAND tx_successAND address = '2F6oCWmo44sxTzg228GkqKhwuhFTrUNTPCnSFBsyLZeg' -- FeeWalletAND balance_change > 0 -- SOL fee payments),botTrades AS (SELECTblock_time,amount_usd,IF(token_sold_mint_address = 'So11111111111111111111111111111111111111112', -- WSOLAddress'Buy','Sell') AS type,token_bought_amount,token_bought_symbol,token_bought_mint_address AS token_bought_address,token_sold_amount,token_sold_symbol,token_sold_mint_address AS token_sold_address,fee_token_amount * price AS fee_usd,fee_token_amount,IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol,fee_token_mint_address,project,version,token_pair,project_program_id AS project_contract_address,trader_id AS user,trades.tx_id,tx_index,outer_instruction_index,inner_instruction_indexFROMdex_solana.trades AS tradesJOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_idLEFT JOIN prices.usd AS feeTokenPrices ON (feeTokenPrices.blockchain = 'solana'AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address)AND date_trunc('minute', block_time) = minuteAND minute >= TIMESTAMP '2024-01-08' -- FirstTradeTimestamp)WHEREtrades.block_time >= TIMESTAMP '2024-01-08' -- FirstTradeTimestampAND trades.trader_id != '2F6oCWmo44sxTzg228GkqKhwuhFTrUNTPCnSFBsyLZeg' -- FeeWallet),highestInnerInstructionIndexForEachTrade AS (