rezarwz2023-09-14 07:19 PM
    Updated 2023-09-15
    SELECT
    fa.tx_id,
    CASE
    when tx_to = 'BEYJqFx5G6whGmpJ4Ar9yyKfnDVBTcGWDSnJPPmsPWh6' then 'Stake'
    when TX_FROM = 'BEYJqFx5G6whGmpJ4Ar9yyKfnDVBTcGWDSnJPPmsPWh6' then 'UnStake'
    END as action,
    case
    when tx_to = 'BEYJqFx5G6whGmpJ4Ar9yyKfnDVBTcGWDSnJPPmsPWh6' then TX_FROM
    when TX_FROM = 'BEYJqFx5G6whGmpJ4Ar9yyKfnDVBTcGWDSnJPPmsPWh6' then tx_to
    end as user_address,
    amount
    FROM
    solana.core.fact_transfers fa
    inner join solana.core.fact_events ev on ev.tx_id = fa.tx_id
    and ev.block_timestamp = fa.block_timestamp
    and ev.block_id = fa.block_id
    and ev.index=round(fa.index)
    WHERE
    fa.MINT = 'HxhWkVpk5NS4Ltg5nij2G671CKXFRKPK8vy271Ub4uEK'
    and ev.PROGRAM_ID = '2jmux3fWV5zHirkEZCoSMEgTgdYZqkE9Qx2oQnxoHRgA'
    --and ev.index = min(ev.index)
    --and ev.tx_id = '5VGa3Qh7jYUbpNWkRxALog7JLprf6crpJfMTCJwwQpDqMVEvhkvmGDyuA8gVURKUmBWU65m9Adjf5yUZTpqMMetg'
    limit
    20
    Run a query to Download Data