Maditopdelegatorsrewarded
    Updated 2023-01-03
    with claim as (select
    DELEGATOR_ADDRESS,
    sum(AMOUNT/pow(10,DECIMAL)) as claim_amount
    from osmosis.core.fact_staking_rewards where TX_STATUS = 'SUCCEEDED' and CURRENCY = 'uosmo'
    and ACTION = 'claim' group by 1
    ),
    withdraw as (
    select
    DELEGATOR_ADDRESS,
    sum(AMOUNT/pow(10,DECIMAL)) as withdraw_amount
    from osmosis.core.fact_staking_rewards
    where TX_STATUS = 'SUCCEEDED' and CURRENCY = 'uosmo'
    and ACTION = 'withdraw_rewards' group by 1
    )
    select
    a.DELEGATOR_ADDRESS, round(sum(claim_amount)) as claim_amount, round(sum(withdraw_amount)) as withdraw_amount
    from claim a join withdraw b on a.DELEGATOR_ADDRESS = b.DELEGATOR_ADDRESS
    group by 1 order by 2 desc limit 100
    Run a query to Download Data