CryptoIcicleOsmo-The Unstakeeeeers - LP/Swap/Redelegate
    Updated 2022-07-17
    -- How frequently do users on Osmosis unstake their Osmosis? What do they do with the OSMO once unstaked?

    -- Payout 96.3 OSMO
    -- Grand Prize 288.92 OSMO
    -- Level Intermediate

    -- How frequently do users on Osmosis unstake their Osmosis?
    -- What do they do with the OSMO once unstaked?
    -- Do they re-delegate, enter a LP position, or swap into another token?
    -- Do they re-delegate to certain validators more frequently than others?
    -- Why might this be so?

    with unstakers as (
    select
    delegator_address as wallet,
    amount,
    block_timestamp as unstake_date
    from osmosis.core.fact_staking
    where action = 'undelegate' and currency = 'uosmo'
    and block_timestamp >= CURRENT_DATE - {{n_days}}
    ),
    swappers as (
    select
    block_timestamp::date as date,
    'swappers' as type,
    count(distinct trader) as n_wallets
    from osmosis.core.fact_swaps s
    join unstakers a on s.trader = a.wallet and abs(datediff('day',s.block_timestamp, a.unstake_date)) <= 7
    and s.from_currency = 'uosmo' and s.block_timestamp >= CURRENT_DATE - {{n_days}}
    group by date
    ),
    redelegators as (
    select
    block_timestamp::date as date,
    'redelegators' as type,
    count(distinct delegator_address) as n_wallets
    Run a query to Download Data