eferfanDecentralizing Power 10
    Updated 2022-11-03
    WITH Base_Data as (
    SELECT
    block_timestamp::Date as Date,
    tx_id,
    validator,
    sum(staked) as osmo_staked
    FROM (

    SELECT
    block_timestamp,
    tx_id,
    REDELEGATE_SOURCE_VALIDATOR_ADDRESS as validator,
    (amount / power(10,6))*(-1) as staked
    FROM osmosis.core.fact_staking
    where currency LIKE 'uosmo'
    AND REDELEGATE_SOURCE_VALIDATOR_ADDRESS is not null
    union
    SELECT
    block_timestamp,
    tx_id,
    validator_address as validator,
    CASE WHEN action = 'undelegate' then (amount / power(10,6))*(-1)
    else amount/power(10,6) end as staked
    FROM osmosis.core.fact_staking
    where currency LIKE 'uosmo'
    AND REDELEGATE_SOURCE_VALIDATOR_ADDRESS is NULL

    )

    WHERE staked is not null group by 1,2,3
    ),
    totals as (
    SELECT
    Date,
    sum(osmo_staked) as month_osmo_staked,
    sum(month_osmo_staked) over (order by Date)as total_osmo_staked
    Run a query to Download Data