mmdrezaTop 10 Delegators With Most Number of Unstakes
    Updated 2023-05-10
    with tab1 as (
    select
    delegator,
    count (distinct tx_id) as tx_count,
    count (distinct delegator) as users_count,
    sum (amount) as volume,
    avg (amount) as average_volume,
    max (amount) as max_volume,
    min (amount) as min_volume,
    case
    when action in ('DelegatorTokensCommitted','TokensCommitted') then 'Stake'
    when action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn') then 'Unstake'
    when action in ('DelegatorRewardTokensWithdrawn','RewardTokensWithdrawn') then 'Claim Reward'
    end as action
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    and Block_timestamp >= '2023-01-01'
    group by 1,action)

    select
    delegator,
    tx_count,
    volume
    from tab1
    where action = 'Unstake'
    order by 2 DESC
    limit 10
    Run a query to Download Data