Query editor
-- ZORA Token Buy Pressure Analysis Dashboard-- Tracks automatic ZORA buy pressure from Content and Creator Coins on Base-- Optimized for Dune Analytics SQL EngineWITH-- Configuration constantsconfig AS (SELECT0x9ea932730A7787000042e34390B8E435dD839040 as content_hook_address,0xd61A675F8a0c67A73DC3B54FB7318B4D91409040 as creator_hook_address,0x1111111111166b7FE7bd91427724B487980aFc69 as zora_token_address,CAST('2025-07-11' AS TIMESTAMP) as start_date,CAST('2025-08-11' AS TIMESTAMP) as end_date),-- Parse Swapped events from both hooks-- Using Dune's decoded tables if available, otherwise raw logscoin_swaps AS (SELECTblock_time,DATE_TRUNC('day', block_time) as block_date,tx_hash,contract_address,CASEWHEN contract_address = 0x9ea932730A7787000042e34390B8E435dD839040 THEN 'Content'WHEN contract_address = 0xd61A675F8a0c67A73DC3B54FB7318B4D91409040 THEN 'Creator'END as coin_type,-- For raw logs, we'll need to parse the data field-- Using varbinary_to_* functions for Dunetopic1,topic2,topic3,dataFROM base.logsWHERE contract_address IN (0x9ea932730A7787000042e34390B8E435dD839040,0xd61A675F8a0c67A73DC3B54FB7318B4D91409040)-- Swapped event signatureAND topic0 = 0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982cAND block_time >= CAST('2025-07-11' AS TIMESTAMP)AND block_time <= CAST('2025-08-11' AS TIMESTAMP)),-- Simplified swap metrics without complex decoding-- We'll focus on counting events firstdaily_swap_activity AS (SELECTblock_date,coin_type,COUNT(*) as num_swaps,COUNT(DISTINCT tx_hash) as unique_txs,COUNT(DISTINCT topic2) as unique_pools -- Pool key hash is in topic2FROM coin_swapsGROUP BY block_date, coin_type),-- Get ZORA token transfers that represent buy pressure