Query editor
WITH community_contracts AS (SELECT DISTINCTc.address as community_addressFROMpolygon.transactions tJOINpolygon.creation_traces cON t.hash = c.tx_hashWHEREt."to" = 0x57a9835B204DbCc101Dbf981625A3625e8043B9c --Gardens Factory contract),all_transactions AS (-- Get all transactions involving created contractsSELECTDATE_TRUNC('week', block_time) as weekFROMpolygon.transactionsWHERE("from" IN (SELECT community_address FROM community_contracts)OR "to" IN (SELECT community_address FROM community_contracts))AND block_time >= date_trunc('day', cast('2024-09-01' as timestamp))UNION ALL-- Add transactions from the factory contract itselfSELECTDATE_TRUNC('week', block_time) as weekFROMpolygon.transactionsWHERE("from" = 0x57a9835B204DbCc101Dbf981625A3625e8043B9c --Gardens Factory contractOR "to" = 0x57a9835B204DbCc101Dbf981625A3625e8043B9c)AND block_time >= date_trunc('day', cast('2024-09-01' as timestamp))UNION ALL-- Allo contract transactionsSELECTDATE_TRUNC('week', block_time) as weekFROMpolygon.transactionsWHERE("from" = 0x1133eA7Af70876e64665ecD07C0A0476d09465a1 --Allo contractOR "to" = 0x1133eA7Af70876e64665ecD07C0A0476d09465a1)AND block_time >= date_trunc('day', cast('2024-09-01' as timestamp)))SELECTweek,COUNT(*) as transactions_this_week,SUM(COUNT(*)) OVER (ORDER BY week ASC) as total_transactionsFROMall_transactionsGROUP BYweekORDER BYweek DESC;