lj1024contemporary-orange
    Updated 2024-09-26
    select ixs.value:data, fe.*
    from solana.core.fact_events fe
    inner JOIN solana.core.fact_transactions ft USING(block_timestamp, tx_id, succeeded)
    ,LATERAL FLATTEN(input => fe.inner_instruction:instructions) ixs,
    where
    fe.succeeded
    and fe.program_id = 'vBoNdEvzMrSai7is21XgVYik65mqtaKXuSdMBJ1xkW4'
    -- some days back; limits needed otherwise query timeouting
    and fe.block_timestamp > current_date - 7
    -- AND fe.block_timestamp < current_date
    and array_contains('Program log: Instruction: FundBond'::variant, ft.log_messages)
    -- vote account: CaraHZBReeNNYAJ326DFsvy41M2p1KWTEoBAwBL6bmWZ -> bond account: 3zVyxrxkR2a3oWoBku7CaAG7UW6JS65vqyoTdG1Djig9
    and array_contains('3zVyxrxkR2a3oWoBku7CaAG7UW6JS65vqyoTdG1Djig9'::variant, fe.instruction:accounts)
    -- from the list of inner instructions getting only those that contains the CPI event data
    -- the CPI PDA call address is always the same for bond program
    and array_contains('j6cZKhHTFuWsiCgPT5wriQpZWqWWUSQqjDJ8S2YDvDL'::variant, ixs.value:accounts)
    limit 1
    -- order by block_timestamp ASC
    ;
    QueryRunArchived: QueryRun has been archived