Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with raw as (SELECTbytearray_to_uint256(bytearray_substring(l.data,1,32)) as proposal_id, l.tx_hash, l.block_time, l.contract_address, l.tx_fromFROM (select * from zora.logsunionselect * from optimism.logsunionselect * from base.logsunionselect * from arbitrum.logsunionselect * from polygon.logs) lWHERE 1=1and topic0 = 0x9a9bca21e4e51607db64fbdbcd7b2284a909c6a8969821f0d161efbdcae70160order by l.block_time desc),base as (SELECTdistinctdate_trunc('month', block_time) as month, tx_from as userFROM raw), user_cohort as (--get the cohort start month for a specific user addressSELECTmin(month) as cohort, userFROM basegroup by 2), cohort_size as (SELECTcohort, count(*) as total_sizeFROM user_cohortgroup by 1), active_by_cohort as (SELECTcohort, month, row_number() OVER (partition by cohort order by month asc) as months, active_addressesFROM (SELECTu.cohort, b.month, count(*) as active_addresses