Query editor
WITHbase AS (SELECTCONCAT('<a href="https://etherscan.io/address/', CAST(tx."from" AS VARCHAR), '" target="_blank">', CAST(tx."from" AS VARCHAR), '</a>') AS caller,tx."from" AS raw_caller,ARBITRARY(CONCAT('<a href="https://etherscan.io/tx/', CAST(tx.hash AS VARCHAR), '" target="_blank"> example tx </a>')) AS example_call,APPROX_DISTINCT(tx.hash) AS times_calledFROM ethereum.traces trLEFT JOIN ethereum.transactions tx ON tx.hash = tr.tx_hashWHERE tr.to = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 -- USDC contractAND LENGTH(tr.input) > 4 -- Only include actual function calls, not simple transfersAND tr.block_time >= CURRENT_TIMESTAMP - INTERVAL '1' DAYGROUP BY tx."from"ORDER BY times_called DESCLIMIT 50)-- Join with labels after limiting to improve performanceSELECTb.caller,b.times_called,ARRAY_AGG(DISTINCT identifier_labels.name) FILTER (WHERE identifier_labels.name IS NOT NULL) AS identifiers,ARRAY_AGG(DISTINCT nft_labels.name) FILTER (WHERE nft_labels.name IS NOT NULL) AS nft_activity_labels,ARRAY_AGG(DISTINCT dex_labels.name) FILTER (WHERE dex_labels.name IS NOT NULL) AS dex_activity_labels,b.example_callFROM base bLEFT JOIN labels.addresses identifier_labelsON identifier_labels.label_type = 'identifier'AND identifier_labels.blockchain = 'ethereum'AND b.raw_caller = identifier_labels.addressAND identifier_labels.name IS NOT NULLAND LENGTH(identifier_labels.name) > 0LEFT JOIN labels.nft nft_labelsON nft_labels.blockchain = 'ethereum'AND nft_labels.label_type = 'usage'AND b.raw_caller = nft_labels.addressAND nft_labels.name IS NOT NULLLEFT JOIN labels.dex dex_labelsON dex_labels.blockchain = 'ethereum'AND dex_labels.model_name = 'trader_frequencies'AND b.raw_caller = dex_labels.addressAND dex_labels.name IS NOT NULLGROUP BY b.caller, b.times_called, b.example_callORDER BY b.times_called DESC;