maybeyonasnearx_stake_unstake_overall_vol
    Updated 2022-10-05
    with
    flat_logs as (
    select
    block_timestamp,
    tx_hash,
    receiver_id,
    value as log,
    try_parse_json(replace(log,'EVENT_JSON:','')) as log_json
    from near.core.fact_receipts r,
    lateral flatten(input => r.logs)
    ),
    stader_logs as (
    select
    block_timestamp,
    tx_hash,
    receiver_id,
    log_json:event as event,
    log_json:data[0]:account_id as user,
    case
    when log_json:event='unstake'
    then log_json:data[0]:unstaked_amount /pow(10,24)
    else log_json:data[0]:amount /pow(10,24)
    end as amt
    from flat_logs
    where true
    and receiver_id in (
    'v2-nearx.stader-labs.near',
    'nearx.stader-labs.near'
    )
    and log_json:standard = 'nearx'
    and log_json:event in (
    'deposit_and_stake',
    'unstake',
    'withdraw'
    /*
    @notice nearx token functions
    Run a query to Download Data