MostafaUntitled Query
    Updated 2022-07-19
    with undelegate as (
    select
    tx_caller_address as wallets,
    min(block_timestamp) as d1
    from osmosis.core.fact_staking
    where action = 'undelegate'
    and currency = 'uosmo'
    and tx_status = 'SUCCEEDED'
    group by 1 ),
    liquidity as (
    select
    liquidity_provider_address as wallets
    from osmosis.core.fact_liquidity_provider_actions a
    join undelegate b on a.liquidity_provider_address=b.wallets
    and a.block_timestamp>b.d1
    where action = 'pool_joined' and currency = 'uosmo' and tx_status = 'SUCCEEDED' group by 1),
    redelegate as (
    select
    tx_caller_address as wallets
    from osmosis.core.fact_staking a
    join undelegate b on a.tx_caller_address=b.wallets
    and a.block_timestamp>b.d1
    where action = 'redelegate' and currency = 'uosmo' and tx_status = 'SUCCEEDED' group by 1 ),
    swap as (
    select
    trader as wallets
    from osmosis.core.fact_swaps a
    join undelegate b on a.trader=b.wallets
    and a.block_timestamp>b.d1
    where from_currency = 'uosmo' and tx_status = 'SUCCEEDED' group by 1
    )
    select 'Swaps' as actions,
    count(distinct wallets) as counts from swap
    union
    select 'Redelegates' as actions,
    count(distinct wallets) as counts from redelegate
    Run a query to Download Data