Query editor
WITH staking_users AS (SELECT DISTINCTfrom_hex(substr(user_address, 3)) AS user_address -- convert staking address string to varbinaryFROM (SELECTLOWER(CONCAT('0x', substr(to_hex(topic1), 25, 40))) AS user_addressFROM linea.logsWHERE contract_address = 0xefd81eec32b9a8222d1842ec3d99c7532c31e348AND topic0 = from_hex('ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef')AND block_time BETWEEN TIMESTAMP '2025-08-06 00:00:00' AND TIMESTAMP '2025-08-29 23:59:59')),swap_users AS (SELECT DISTINCTtx_from AS user_addressFROM linea.logs_decodedWHERE event_name = 'Swap'AND contract_address IN (SELECT address FROM linea.contractsWHERE namespace = 'etherex'AND name LIKE '%Pair%')AND block_time BETWEEN TIMESTAMP '2025-08-06 00:00:00' AND TIMESTAMP '2025-08-29 23:59:59'),only_staking AS (SELECT user_address FROM staking_usersWHERE user_address NOT IN (SELECT user_address FROM swap_users)),only_swapping AS (SELECT user_address FROM swap_usersWHERE user_address NOT IN (SELECT user_address FROM staking_users)),both AS (SELECT user_address FROM staking_usersWHERE user_address IN (SELECT user_address FROM swap_users))SELECT 'Only Staked' AS user_type, COUNT(*) AS user_count FROM only_stakingUNION ALLSELECT 'Only Swapped', COUNT(*) FROM only_swappingUNION ALLSELECT 'Both Staked and Swapped', COUNT(*) FROM both;-- Swap Transactions for the AddressSELECTtx_hash,block_time,contract_address,event_name,tx_fromFROM linea.logs_decoded