Sandeshredelegate pairs osmo
    Updated 2022-07-18
    with restakes as
    (
    (
    select
    TX_ID,
    DELEGATOR_ADDRESS,VALIDATOR_ADDRESS as dest,
    REDELEGATE_SOURCE_VALIDATOR_ADDRESS as source
    from osmosis.core.fact_staking
    where action='redelegate'
    and TX_STATUS='SUCCEEDED'
    and block_timestamp > CURRENT_DATE - interval '3 months'
    )

    ),
    top5 as(
    select source,dest,count(tx_id) as cnt from restakes
    group by source,dest
    order by cnt desc
    limit 5
    )
    select dl.label as source_name, dl2.label as dest_name,top5.cnt from top5 inner join osmosis.core.dim_labels dl
    on (top5.source=dl.address)
    inner join osmosis.core.dim_labels dl2
    on (top5.dest=dl2.address)
    order by cnt desc
    limit 5


    Run a query to Download Data