Arkannstaking 6
    Updated 2023-01-20
    with
    Unstakers_Table as (
    select
    tx_caller_address as Unstakers_User,
    count (distinct tx_id) as Unstake_Actions
    from
    osmosis.core.fact_staking
    where
    tx_succeeded = 'TRUE'
    and currency = 'uosmo'
    and action = 'undelegate'
    group by 1
    ),
    LPers_Table as (
    select
    liquidity_provider_address as LPer_User,
    count(distinct tx_id) as LPs_Actions
    from
    osmosis.core.fact_liquidity_provider_actions
    where
    tx_succeeded = 'TRUE'
    and currency = 'uosmo'
    and action = 'pool_joined'
    and liquidity_provider_address in (select Unstakers_User from Unstakers_Table)
    group by 1
    ),
    ReDelegators_Table as (
    select
    tx_caller_address as Redelegator_User,
    count (distinct tx_id) as Redelegate_Actions
    from
    osmosis.core.fact_staking
    where
    tx_succeeded = 'TRUE'
    and currency = 'uosmo'
    and action = 'redelegate'
    Run a query to Download Data