CryptoIcicleOsmo-8.Osmo Staking - 30 Days
    Updated 2022-05-29
    -- Payout 133.93 OSMO
    -- Grand Prize 401.79 OSMO
    -- Level Advanced

    -- Q8. Over the past 30/60/90 days and since June 2021, how much OSMO has been staked per day?
    -- What is the staking percentage (OSMO staked vs. circulating supply) and how has it changed over time?

    -- Hint: Look at the msg_type to determine which transactions are staking transactions.
    -- For payment, submit the address of your Osmosis wallet.

    with txns as (
    select
    split(attribute_value,'u')[0]/1e6 as amount,
    *
    from osmosis.core.fact_msg_attributes
    where msg_type = 'delegate'
    and attribute_key = 'amount'
    and block_timestamp >= CURRENT_DATE - 30
    )


    select
    block_timestamp::date as date,
    sum(amount) as staked_amount,
    sum(staked_amount) over (order by date asc rows between unbounded preceding and current row) as cum_amount_staked
    from txns
    group by date
    Run a query to Download Data