Afonso_Diaz2023-02-19 02:48 AM
    Updated 2023-02-18
    with
    t1 as (
    select
    block_timestamp,
    tx_signer as user_address,
    -1 * deposit / pow(10, 24) as amount_near
    from near.core.fact_transfers
    where status = 1
    and deposit > 0
    ),

    t2 as (
    select
    block_timestamp,
    tx_receiver as user_address,
    deposit / pow(10, 24) as amount_near
    from near.core.fact_transfers
    where status = 1
    and deposit > 0
    ),

    t3 as (
    select
    block_timestamp,
    tx_signer as user_address,
    case
    when method_name = 'unstake' then try_parse_json(args):min_expected_near / pow(10, 24)
    when method_name = 'instant_unstake' then try_parse_json(args):min_Amount_out / pow(10, 24)
    when method_name in ('stake', 'deposit_and_stake') then (-1 * deposit) / pow(10, 24)
    end as amount_near
    from near.core.fact_actions_events_function_call
    join near.core.fact_transactions
    using(tx_hash)
    where method_name in ('unstake', 'liquid_unstake', 'instant_unstake', 'stake', 'deposit_and_stake')
    and amount_near > 0
    ),
    Run a query to Download Data