Query editor
WITH protocols AS (SELECTdate_trunc('week', tr.block_time) as week, COALESCE(c.name, cast(tr."from" as varchar)) as integration_type, approx_distinct(tr.tx_hash) as times_calledFROM ethereum.traces trLEFT JOIN labels.contracts c ON c.blockchain = 'ethereum' AND c.address = tr."from"LEFT JOIN ethereum.signatures sig_fx ON bytearray_substring(tr.input, 1,5) = sig_fx.idWHERE tr.to = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 /*USDC*/AND cardinality(trace_address) != 0 --must be a contract calling not a walletAND successAND tr.block_time >= now() - interval '6' monthAND lower(c.name) NOT LIKE '%gnosis%' AND lower(c.name) NOT LIKE '%argent%' --filter safes out, they're not protocols.AND ('true' = 'false' OR (json_value(sig_fx.abi,'strict $.stateMutability') NOT IN ('pure', 'view') OR sig_fx.abi is null))GROUP BY 1,2)SELECTCOUNT(DISTINCT integration_type) AS total_unique_protocolsFROM protocols