LTirrellstake_debug
    Updated 2023-05-25
    -- with
    -- fact_stake as (
    -- select
    -- tx_id as f_tx_id,
    -- index as f_index,
    -- event_type as f_event_type,
    -- instruction
    -- from
    -- solana.core.fact_staking_lp_actions
    -- ),
    -- latest_stake_vol as (
    -- select
    -- *,
    -- signers[0] as fee_payer,
    -- case
    -- -- when event_type = 'withdraw'
    -- -- and stake_authority is null
    -- -- and fee_payer = withdraw_destination then fee_payer
    -- -- when event_type = 'withdraw'
    -- -- and stake_authority is null
    -- -- and fee_payer != withdraw_destination then fact_stake.instruction:parsed:info:withdrawAuthority
    -- when stake_authority is null
    -- and event_type = 'authorizeChecked' then fact_stake.instruction:parsed:info:newAuthority
    -- when stake_authority is null
    -- and event_type = 'withdraw' then fact_stake.instruction:parsed:info:withdrawAuthority
    -- else stake_authority
    -- end as staker,
    -- post_tx_staked_balance / pow(10, 9) as net_stake,
    -- row_number() over (
    -- partition by
    -- stake_account
    -- order by
    -- block_timestamp desc,
    -- index desc
    -- ) as rn
    -- from
    Run a query to Download Data