Query editor
/* WSOLAddress: 'So11111111111111111111111111111111111111112' *//* FeeWallet: 'ZG98FUCjb8mJ824Gbs6RsgVmr1FhXb2oNiJHa2dwmPd' *//* FirstTradeTimestamp: TIMESTAMP '2023-08-17' *//* ReferralWallet: '84DGj4Qpypcaa5uxdzphYzkutEUTvxLWSuWq3BoJLxkp' */WITHbotTradesWithFees AS (SELECTblock_time,block_date,amount_usd,fee_usd,--type,project_contract_address,user AS userAddress,tx_idFROMbonkbot_solana.bot_tradesWHEREis_last_trade_in_transaction = true -- This prevents over counting for multi-hop trades and excludes tax distributions),bonkReferralPayments AS (SELECTcall_block_time AS block_time,amount / 1e5 AS amountBONK,account_destination AS destinationAccount,token_balance_owner AS destinationAccountOwner,call_tx_id AS tx_idFROMspl_token_solana.spl_token_call_transferCheckedLEFT JOIN solana_utils.token_accounts ON account_destination = addressWHEREaccount_mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' -- BONKAddressAND account_authority = '84DGj4Qpypcaa5uxdzphYzkutEUTvxLWSuWq3BoJLxkp'AND call_block_time >= TIMESTAMP '2023-08-17' -- FirstTradeTimestamp),fundsFromBotWallets AS (-- Check for any token transfers from the two wallet addressesSELECTtoken_balance_owner AS recipientAddress,account_authority AS senderWallet,account_mint AS tokenMint,COUNT(*) AS transferCount,SUM(amount) AS totalAmountReceivedFROMspl_token_solana.spl_token_call_transferCheckedLEFT JOIN solana_utils.token_accounts ON account_destination = addressWHEREaccount_authority IN ('84DGj4Qpypcaa5uxdzphYzkutEUTvxLWSuWq3BoJLxkp','ZG98FUCjb8mJ824Gbs6RsgVmr1FhXb2oNiJHa2dwmPd')AND call_block_time >= TIMESTAMP '2023-08-17'GROUP BYtoken_balance_owner,account_authority,account_mint),-- START: Solana Name Service (SNS) Domain Resolutioncutoff AS (SELECT LEAST(