Query editor
--- run query https://dune.com/queries/3265528 before running before running this trends query-- Step 1: https://dune.com/queries/3265773-- Step 2: https://dune.com/queries/3265528-- Step 3: https://dune.com/queries/3000480-- Step 4: https://dune.com/queries/3525427-- Step 5 : https://dune.com/queries/4103405 - check function and their trx-- Step 6: https://dune.com/agaperste/event-and-function-signature-sleuthingWITH base_txns AS (SELECTa.*,signature,DATE_TRUNC('week', block_time) AS week_numFROM evms.transactions AS aLEFT JOIN abi.signatures AS bON SUBSTRING(TRY_CAST(a.data AS VARCHAR), 1, 10) = TRY_CAST(b.id AS VARCHAR)WHEREblock_time > DATE(TRY_CAST('2024-07-01' AS TIMESTAMP))AND block_time < DATE(TRY_CAST('2024-09-22' AS TIMESTAMP))), bbase AS (SELECTblockchain,signature,CASE WHEN data = 0x THEN 'EOA transfer' ELSE TO_HEX("to") END AS "to",week_num,hash AS number_of_txns,"from" AS num_of_walletsFROM base_txns), final AS (SELECTa.*,a.blockchain AS bblockchain,b.CategoryFROM bbase AS aLEFT JOIN (select addresss, category, subcategoryfrom query_3265528-- where chain in ( 'bnb','optimism','arbitrum','ethereum','polygon','avalanche_c','fantom')group by 1,2,3) AS bON a.blockchain = b.chain AND a."to" = TRY_CAST(b.addresss AS VARCHAR))SELECTCASEWHEN "to" = 'EOA transfer'THEN 'EOA transfer'WHEN NOT Category IS NULLTHEN CategoryELSE COALESCE(signature, "to")END AS Category,week_num,COUNT(DISTINCT num_of_wallets) AS walletsFROM finalGROUP BY1,2HAVINGCOUNT(DISTINCT num_of_wallets) > 5000 /* SELECT *//* bblockchain,to as contract_address, *//* CASE WHEN to = 'EOA transfer' THEN 'DeFi' when Category is not null then Category ELSE to END AS Category, *//* CASE WHEN to = 'EOA transfer' THEN 'EOA transfer' when Subcategory is not null then Subcategory ELSE to END AS Subcategory, *//* SUM(number_of_txns) AS txns, *//* SUM(num_of_wallets) AS wallets */