Query editor
with all_logs as(select 'ethereum' as chain, contract_address, block_time, topic0, topic1, topic2, topic3, data, tx_hashfrom ethereum.logswhere block_number >= 18457118UNION ALLselect 'polygon' as chain, contract_address, block_time, topic0, topic1, topic2, topic3, data, tx_hashfrom polygon.logswhere block_number >= 45145069UNION ALLselect 'optimism' as chain, contract_address, block_time, topic0, topic1, topic2, topic3, data, tx_hashfrom optimism.logswhere block_number >= 107603860UNION ALLselect 'base' as chain, contract_address, block_time, topic0, topic1, topic2, topic3, data, tx_hashfrom base.logswhere block_number >= 1898666UNION ALLselect 'arbitrum' as chain, contract_address, block_time, topic0, topic1, topic2, topic3, data, tx_hashfrom arbitrum.logswhere block_number >= 123416397),account_deployments_logs as(select*,substr(a.topic2, 13) sender,substr(a.data, 13,20) factory,substr(a.data, 33+13,20) paymasterfrom all_logs awhere 1=1and topic0 = 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d --AccountDeployedand contract_address = 0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789and substr(data,13,20) = 0xaee9762ce625e0a8f7b184670fb57c37bfe1d0f1),account_deployments as(selecta.chain,a.block_time,a.sender,a.factory,a.paymaster,l.contract_address owner_change_contract_address,substr(l.topic1,13) user,substr(l.topic2,13) old_owner,substr(l.topic3,13) new_ownerfrom account_deployments_logs aleft join all_logs l on a.tx_hash = l.tx_hashand l.contract_address = a.sender -- alternatively could remove this line and add `where l.contract_address = 0x417f5a41305ddc99d18b5e176521b468b2a31b86where 1=1and l.topic0 = 0x381c0d11398486654573703c51ee8210ce9461764d133f9f0e53b6a539705331 -- OwnerChange topic hash),userops_agg as(selectdate_trunc('month', u.block_time) block_date,count(1) userops,count(case when u.chain = 'ethereum' then 1 end) userops_ethereum,