rajsNear Amout Staked Upto 2021
    Updated 2022-11-28
    with last_tx as
    (
    SELECT
    -- *
    pool_address,
    -- tx_hash,
    max(block_timestamp) as max_time
    from near.core.dim_staking_actions
    where block_timestamp <= '2021-12-31'
    -- where action = 'Unstake'
    group by 1
    -- limit 3
    )
    ,

    txs as
    (
    SELECT
    s.*
    from near.core.dim_staking_actions s
    inner join last_tx l
    on s.pool_address = l.pool_address
    and s.block_timestamp = l.max_time
    )
    ,

    staked_amount as
    (
    SELECT
    block_timestamp,
    tx_hash,
    tx_receiver,
    tx:receipt[0]:outcome:logs[1] as log1,
    tx:receipt[0]:outcome:logs[2] as log2,
    tx:receipt[0]:outcome:logs[3] as log3,
    tx:receipt[0]:outcome:logs[4] as log4,
    Run a query to Download Data