Query editor
-- Params:-- {{time_granularity}} -- manual list: day|week|month-- {{lookback_periods}} -- number/text: how many periods (e.g., 12 months, 8 weeks, 30 days)WITHparams AS (SELECTCASE LOWER('{{time_granularity}}')WHEN 'week' THEN 'week'WHEN 'month' THEN 'month'ELSE 'day'END AS gran,COALESCE(TRY_CAST('{{lookback_periods}}' AS integer), 90) AS periods),window AS (SELECTgran,CASE granWHEN 'month' THEN date_add('month', -periods, now())WHEN 'week' THEN date_add('week', -periods, now())ELSE date_add('day', -periods, now())END AS start_tsFROM params),zora_addresses(address) AS (VALUES(from_hex('c90e349360c43a0217cef289f231c66d4748960f')),(from_hex('45bf86430af7cd071ea23ae52325a78c8d12ad5a')),(from_hex('7cad62748ddf516cf85bc2c05c14786d84cf861c')),(from_hex('36853f9f48faee51bd3db15db21eb4b9038bb795')),(from_hex('d88f6bdd765313cafa5888c177c325e2c3abf2d2')),(from_hex('777777751622c0d3258f214f9df38e35bf45baf3')),(from_hex('8ec7f068a77fa5fc1925110f82381374ba054ff2')),(from_hex('777777c4c14b133858c3982d41dbf02509fc18d7')),(from_hex('c8d077444625eb300a427a6dfb2b1dbf9b159040'))),-- Denominator: all tx, bucketed (counts + gas)denom AS (SELECTCASE (SELECT gran FROM params)WHEN 'week' THEN date_trunc('week', block_time)WHEN 'month' THEN date_trunc('month', block_time)ELSE date_trunc('day', block_time)END AS bucket,COUNT(*) AS total_tx,SUM(gas_used) AS total_tx_gasFROM base.transactionsCROSS JOIN windowWHERE block_time >= window.start_tsGROUP BY 1),-- Distinct set of tx that had ANY Zora trace (avoid double counting per tx)zora_tx_hashes AS (SELECT DISTINCTCASE (SELECT gran FROM params)WHEN 'week' THEN date_trunc('week', t.block_time)WHEN 'month' THEN date_trunc('month', t.block_time)ELSE date_trunc('day', t.block_time)