Afonso_DiazRetention Rate
    Updated 2025-02-20
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    utils.udf_hex_to_int(data)::bigint / 1e18 as amount,
    iff(topics[1] = '0x0000000000000000000000000000000000000000000000000000000000000000', 'Stake', 'Unstake') as event_name
    from
    monad.testnet.fact_event_logs
    where
    tx_succeeded
    and origin_to_address = '0xb2f82d0f38dc453d596ad40a37799446cc89274a'
    and topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
    and contract_address = lower('0xb2f82D0f38dc453D596Ad40A37799446Cc89274A')
    ),

    user_activity as (
    select
    user,
    block_timestamp::date as activity_date
    from main
    group by 1, 2
    ),

    first_seen as (
    select
    user,
    min(activity_date) as first_seen_date
    from user_activity
    group by 1
    ),

    retention_30d as (
    select
    Last run: 29 days ago
    COHORT_DATE
    RETAINED_USERS
    TOTAL_USERS
    RETENTION_RATE
    1
    2025-01-20 00:00:00.0001250
    2
    2025-01-22 00:00:00.0001250
    3
    2025-01-23 00:00:00.000020
    4
    2025-01-27 00:00:00.000030
    5
    2025-02-06 00:00:00.0001250
    6
    2025-02-11 00:00:00.000010
    7
    2025-02-14 00:00:00.0001250
    8
    2025-02-17 00:00:00.000020
    9
    2025-02-18 00:00:00.000010
    10
    2025-02-19 00:00:00.00018831151416.35
    11
    2025-02-20 00:00:00.0000275660
    11
    394B
    3s