Query editor
WITH multisig_list AS (-- Get the list of distinct multisigsSELECT DISTINCT multisigFROM autonolas_gnosis.StakingProxy_Quickstart_Beta_Expert_evt_ServiceStakedWHEREcontract_address = 0xeF44Fb0842DDeF59D37f85D61A1eF492bbA6135dORcontract_address = 0x1c2F82413666d2a3fD8bC337b0268e62dDF67434),first_activity AS (-- Get the first transaction date for each multisig and assign them to a cohort weekSELECTtxs."to" AS multisig,MIN(txs.block_time) AS first_activity_date,DATE_TRUNC('week', MIN(txs.block_time)) AS cohort_weekFROMgnosis.transactions AS txsWHEREtxs."to" IN (SELECT multisig FROM multisig_list)GROUP BYtxs."to"),multisig_transactions AS (-- Get the activity for each multisig within their first 28 daysSELECTtxs."to" AS multisig,DATE_TRUNC('day', txs.block_time) AS active_day,fa.cohort_weekFROMgnosis.transactions AS txsINNER JOINfirst_activity fa ON txs."to" = fa.multisigWHEREtxs.block_time BETWEEN fa.first_activity_dateAND fa.first_activity_date + INTERVAL '28' day -- First 28 days of activity),cohort_activity AS (-- Subquery to count the number of distinct active days for each multisig in their first 28 daysSELECTmultisig,cohort_week,COUNT(DISTINCT active_day) AS active_days -- Count of distinct active days in the first 28 daysFROMmultisig_transactionsGROUP BYmultisig, cohort_week),valid_cohorts AS (-- Identify valid cohorts, excluding the last 4SELECT DISTINCT cohort_weekFROM cohort_activityORDER BY cohort_week DESCOFFSET 4 -- Skip the last 4 cohorts),cohort_retention AS (