LTirrell2023-08-12 11:00 PM
    Updated 2023-08-12
    with fact_stake as (
    select
    block_timestamp as f_block_timestamp,
    tx_id as f_tx_id,
    index as f_index,
    event_type as f_event_type,
    instruction
    from
    solana.core.fact_staking_lp_actions
    ),
    base as (
    select
    *,
    signers [0] as fee_payer,
    post_tx_staked_balance / pow(10, 9) as net_stake,
    split_part(index :: float, '.', 1) :: int as idx_major,
    case
    when contains(index :: float :: string, '.') then split_part(index :: float, '.', 2) :: int
    else 0
    end as idx_minor,
    row_number() over (
    partition by stake_account
    order by
    block_id desc,
    tx_id asc,
    idx_major desc,
    idx_minor desc,
    event_type desc
    ) as rn,
    fact_stake.instruction :parsed :info as info
    from
    solana.core.ez_staking_lp_actions
    left join fact_stake on (
    tx_id = fact_stake.f_tx_id
    and block_timestamp = fact_stake.f_block_timestamp
    and index = fact_stake.f_index
    Run a query to Download Data