Query editor
WITH senders AS (-- filters for all interactions with the MM contract in the selected time periodSELECT"from" AS address,tx_hashFROM ethereum.tracesWHERE "to" = 0x881D40237659C251811CEC9c364ef91dC08D300CAND tx_success = TRUEAND success = TRUEAND block_time >CASEWHEN {{time}} = 'Day' THEN now() - interval '1' dayWHEN {{time}} = 'Week' THEN now() - interval '7' dayWHEN {{time}} = 'Month' THEN now() - interval '1' monthWHEN {{time}} = 'Quarter' THEN now() - interval '3' monthWHEN {{time}} = 'Year' THEN now() - interval '1' yearEND),pairs_of_interest AS (-- input all tokens of interest hereWITH tokens_of_interest AS (SELECT * FROM (VALUES('USDC'), ('USDT'), ('DAI'), ('BUSD'), ('WETH')) as t(tokens))-- outputs all unique pairs of tokens listed aboveSELECTDISTINCT CASEWHEN t.tokens < t2.tokens THEN t.tokens || '-' || t2.tokensELSE t2.tokens || '-' || t.tokensEND as pairFROM tokens_of_interest tCROSS JOIN tokens_of_interest t2WHERE t.tokens != t2.tokens),mm_swaps AS (-- includes data on MM swap txs based on dex.trades filtered for tokens of interestSELECTd.tx_hash,blockchain,token_pair,project,amount_usdFROM sendersLEFT JOIN dex.trades d ON d.tx_hash = senders.tx_hashWHERE token_pair NOT IN (SELECT pair FROM pairs_of_interest))SELECTtoken_pair,