Updated 2023-12-04
    -- forked from 4 @ https://flipsidecrypto.xyz/edit/queries/0f43c037-b96c-4e4c-b132-846ed5650320

    -- forked from part1 copy copy @ https://flipsidecrypto.xyz/edit/queries/6c883e3a-13ff-42b1-867c-71f5e4a9da02

    -- forked from part1 copy @ https://flipsidecrypto.xyz/edit/queries/faf260c3-ef1b-479d-b906-03815e3f5f45

    -- forked from part1 @ https://flipsidecrypto.xyz/edit/queries/d402636b-d7ee-48a4-8447-82444a01fa42


    with t as (
    select
    tx_id,
    block_timestamp,
    nvl(signers[1], signers[0]) as user,
    (post.value:uiTokenAmount:amount - pre.value:uiTokenAmount:amount)/1e6 as amount_acs
    from solana.core.fact_transactions
    join lateral flatten (input => pre_token_balances) pre
    join lateral flatten (input => post_token_balances) post
    where log_messages::string ilike '%6HW8dXjtiTGkD4jzXs7igdFmZExPpmwUrRN5195xGup%'
    and log_messages::string ilike '%Program log: Instruction: Unstake%'
    and succeeded = 1
    and pre.value:owner = user
    and pre.value:owner = post.value:owner
    )

    select * from t
    where block_timestamp::date >= '2023-05-01' and block_timestamp::date < '2023-07-01'
    limit 15000
    offset 15000;




    Run a query to Download Data