Moeswapper new users
    Updated 2023-08-28
    with
    MAINTAB as
    (select
    BLOCK_TIMESTAMP ,
    tx_id from
    sei.core.fact_msg_attributes
    where
    MSG_TYPE = 'wasm'
    and
    ATTRIBUTE_KEY = 'action'
    and
    ATTRIBUTE_VALUE = 'swap' )

    , tb2 as (
    select
    block_timestamp ,
    tx_id ,
    ATTRIBUTE_VALUE as swapper ,
    row_number()over(partition by ATTRIBUTE_VALUE order by block_timestamp::date desc ) as n


    from
    sei.core.fact_msg_attributes
    where
    MSG_TYPE = 'wasm'
    and tx_id in (select tx_id from maintab)
    and
    ATTRIBUTE_KEY = 'sender'

    )

    select
    block_timestamp::date ,
    case when n = 1 then 'new user' else 'older user' end as type ,
    count(distinct swapper) as users
    from
    Run a query to Download Data