Query editor
-- ============================================================-- Q1: Swap Overlap Roster-- Which card wallets (in Picnic) have done DEX swaps?-- Lightweight: just wallet + chain + flag-- ============================================================WITHcard_users AS (SELECT pay_wallet, owner, activation_timeFROM query_3707804),picnic_wallets AS (SELECT DISTINCT address, blockchainFROM dune.safe.dataset_safe_picnic_data),-- Card wallets present in Picniccard_in_picnic AS (SELECT DISTINCT c.pay_wallet, c.owner, c.activation_timeFROM card_users cINNER JOIN picnic_wallets p ON c.pay_wallet = p.address),-- Picnic wallets that appear as taker in dex.trades (per chain)swap_wallets AS (SELECT DISTINCTp.address,p.blockchainFROM picnic_wallets pINNER JOIN dex.trades tON t.taker = p.addressAND t.blockchain = p.blockchainAND t.block_date >= DATE '2024-01-01'WHERE p.blockchain IN ('gnosis','polygon','ethereum','arbitrum','base','bnb','optimism','avalanche_c')),-- Card wallets that swapped directlycard_direct_swap AS (SELECT DISTINCT ci.pay_wallet, ci.owner, ci.activation_time, sw.blockchain AS swap_chainFROM card_in_picnic ciINNER JOIN swap_wallets sw ON sw.address = ci.pay_wallet)SELECTpay_wallet,owner,activation_time,swap_chain,true AS is_swapperFROM card_direct_swapUNION ALLSELECTpay_wallet,owner,activation_time,NULL AS swap_chain,false AS is_swapperFROM card_in_picnic ci