saeedmznTop 10 delegators (by total ARB) for each delegate in the top 50.
    Updated 2023-04-05
    with delegate_tx as ( select block_timestamp date,
    tx_hash,
    origin_from_address delegator_address ,
    event_inputs:delegate delegate_address ,
    ((event_inputs:newBalance/1e18) - (event_inputs:previousBalance/1e18)) delegated_amount,
    event_inputs:newBalance/1e18 voting_power,
    row_number () over (partition by delegator_address order by date desc) rank
    from arbitrum.core.fact_event_logs
    where ORIGIN_FUNCTION_SIGNATURE in ('0x5c19a95c','0x78e2b594') -- delegate , claim and delegate
    and ORIGIN_TO_ADDRESS in ('0x912ce59144191c1204e64559fe8253a0e49e6548','0x67a24ce4321ab3af51c2d0a4801c3e111d88c9d9')
    and CONTRACT_ADDRESS= '0x912ce59144191c1204e64559fe8253a0e49e6548'
    and event_inputs:delegate is not NULL
    and event_inputs:newBalance is not NULL
    and event_inputs:delegate <> '0x00000000000000000000000000000000000a4b86'
    and event_inputs:previousBalance/1e18 < event_inputs:newBalance/1e18
    and (event_inputs:newBalance/1e18) - (event_inputs:previousBalance/1e18) > 0
    ),
    fine_delegate_tx as (
    select date , tx_hash , delegator_address , delegate_address ,
    delegated_amount , voting_power
    from delegate_tx
    where rank = 1 -- Only count the last transaction per delegator
    ),

    last_voting_power_tx as (
    select delegate_address ,
    max (date ) current_voting_power_date
    from fine_delegate_tx
    group by 1
    ),
    current_voting_power as (
    select delegate_address ,
    case
    WHEN delegate_address =
    '0x0eb5b03c0303f2f47cd81d7be4275af8ed347576'
    THEN 'TreasureDAO'
    Run a query to Download Data