hessOverview of Top 500 Stakers
    Updated 2024-10-05
    with stake as ( select block_timestamp,
    tx_hash,
    signer_id as user,
    ARGS:"amount"/pow(10,18) as amount,
    args
    from near.core.fact_actions_events_function_call
    where ARGS:"receiver_id" = 'xtoken.ref-finance.near'
    and method_name = 'ft_transfer_call'
    and RECEIVER_ID = 'token.v2.ref-finance.near'
    and ARGS:"amount"/pow(10,18) < 1e8
    and RECEIPT_SUCCEEDED != 'FALSE'
    )
    ,
    unstake as ( select block_timestamp,
    tx_hash,
    signer_id as user,
    ARGS:"amount"/pow(10,18) as amount
    from near.core.fact_actions_events_function_call
    where method_name = 'callback_post_unstake'
    and RECEIVER_ID = 'xtoken.ref-finance.near'
    and ARGS:"amount"/pow(10,18) < 1e8
    and RECEIPT_SUCCEEDED != 'FALSE'
    )
    ,
    stakers as (select 'Stake' as type,
    user,
    count(DISTINCT user) as users,
    count(DISTINCT tx_hash) as txns,
    sum(amount) as amount,
    avg(amount) as avg_stake_amount,
    median(amount) as median_amount,
    max(amount) as max_amount
    from stake
    group by 1,2)
    ,
    unstakers as (select 'Unstake' as type,
    QueryRunArchived: QueryRun has been archived