Query editor
-- with-- bonding_curves as (-- SELECT-- account_arguments[1] as token_mint_address-- , account_arguments[3] as bonding_curve-- , account_arguments[4] as bonding_curve_vault-- FROM solana.instruction_calls-- WHERE executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P'-- AND bytearray_substring(data,1,8) = 0x181ec828051c0777 --Create https://solscan.io/tx/2Vfq4gS9nq2jvpmZSxVXJ3uHGeheENXetwUus6KnhBzFu23Brqbt5EoNiTLds6jr72yZYGJ9YbMDG1BYKMRe3hSQ-- and tx_success = true-- -- AND tx_id = '58tZNcGp1eUDG2umMg5Py42vxWmp5r1qqxPUjGzw3YjGDrJRpb8qjYfcVeLFJ3zuNh4Zc953wgK7rQZF8iMpXJ8j'-- -- and block_slot = 269868339-- )-- , swaps as (SELECT--raw data field (already convert by Dune from base58 to Hex data):--0xe445a52e51cb9a1dbddb7fd34ee661ee|aff3a830a8d140f6a380948ec975c5ad8bf464ea48d132f4fcea6e2c361f308f|5495b90c00000000|803e423410060000009bb1e2ab443b196d07bd444e4af49fe2ba690735eb3c8f0bd8b36105c7614f75df2a5f66000000000140597307000000018f5a13e5920300019435770000000001f747c753940200-- 1 byte represents 2 hex charactersbytearray_substring(data,1,16) as swapEvent-- First 16 bytes = swapEvent 0xe445a52e51cb9a1dbddb7fd34ee661ee...-- First 8 bytes is an instruction discriminator-- The next 8 bytes are the event discriminator,to_base58(bytearray_substring(data,1+16,32)) as token_mint_address-- Substring: Start at byte 1+16 = 17, include next 32 bytes (type: publicKey/address, 32bytes long) ...aff3a830a8d140f6a380948ec975c5ad8bf464ea48d132f4fcea6e2c361f308f...-- Converted to base58 because publicKey's are stored this way. example sol address: BUmWvaEF46YHAGmn3ePQLPEvt19sm6k6JRnKHHTiE4Ag, bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32,8))) as sol_amount-- Substring: Start where we left off above 1+16+32 = 49, include next 8 bytes (type = u64, unsigned 64-bit integer, 8bytes = 64bits) ...5495b90c00000000...-- reverse values-- convert from byte to uint256, bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8,8))) as token_amount, bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8,1))) as is_buy, to_base58(bytearray_substring(data,1+16+32+8+8+1,32)) as user, bytearray_to_int256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32,8))) as trade_timestamp, bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32+8,8))) as sol_reserves, bytearray_to_uint256(bytearray_reverse(bytearray_substring(data,1+16+32+8+8+1+32+8+8,8))) as token_reserves, data, tx_id, tx_index, block_time, block_slot, outer_instruction_index, inner_instruction_index, outer_executing_accountFROM solana.instruction_callsWHERE executing_account = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P' --Program that is running at row instruction levelAND bytearray_substring(data,1,16) = 0xe445a52e51cb9a1dbddb7fd34ee661ee --SwapEventand tx_success = true--and block_time >= now() - interval '10' day -- filter by block_time to speed up query timeAND tx_id = '5782i58ZHCKSANgTi3WXL5vjFAWEVJuPMGAr6gjx2qqcRP6LLNRH2g6pb61tk44H7PC9ohFNCUKQVUAMd5vYeUns' --drop tx_id here to investigateand block_slot = 269850397 -- filter by block_slot to speed up query--buy https://solscan.io/tx/5782i58ZHCKSANgTi3WXL5vjFAWEVJuPMGAr6gjx2qqcRP6LLNRH2g6pb61tk44H7PC9ohFNCUKQVUAMd5vYeUns--sell https://solscan.io/tx/4thHCu9SX166TP2cnjgwJ7mDSSMn5MBe8xLsTYzRLJmE7jPgwQatXh4ehh3At4xvVcgUefFzzsYVBaVwYyS1bA6v-- )-- , trades_base as (-- SELECT-- sp.block_time-- , 'pumpdotfun' as project-- , 1 as version