bachiosmosis holders
    Updated 2022-07-13
    with stakers as (
    SELECT DISTINCT DELEGATOR_ADDRESS from osmosis.core.fact_staking where TX_STATUS = 'SUCCEEDED'
    ),
    LPers as (
    SELECT DISTINCT LIQUIDITY_PROVIDER_ADDRESS from osmosis.core.fact_liquidity_provider_actions
    where TX_STATUS = 'SUCCEEDED' and CURRENCY = 'uosmo')


    SELECT date(BLOCK_TIMESTAMP) as day,
    count(DISTINCT tx_id) as no_of_txns,
    sum(no_of_txns) over (order by day) as cumulative_txns,
    count(DISTINCT TX_FROM) as no_of_users,
    sum(no_of_users) over (order by day) as cumulative_wallets,
    case when TX_FROM in (SELECT DELEGATOR_ADDRESS from stakers) THEN 'Stakers'
    when TX_FROM in (SELECT LIQUIDITY_PROVIDER_ADDRESS from lpers) THEN 'LPers'
    else 'Holders' end as user_type
    from osmosis.core.fact_transactions
    where BLOCK_TIMESTAMP >= dateadd(month, -6, getdate())
    and tx_from is not null
    and tx_status = 'SUCCEEDED'
    GROUP by day,user_type
    Run a query to Download Data