Query editor
with stake_txs as (select tx_id, 'stake' as actionfrom solana.instruction_callswhereDATE(block_time) >= DATE('2024-12-10')and executing_account = 'veTbq5fF2HWYpgmkwjGKTYLVpY6miWYYmakML7R7LRf'and tx_success = Trueand any_match(log_messages, i -> i like '%Instruction: Stake%') = True-- and any_match(log_messages, i -> i like '%Instruction: StakeTo%') = True -- no records nowunion allselect tx_id, 'unstake' as actionfrom solana.instruction_callswhereDATE(block_time) >= DATE('2024-12-10')and executing_account = 'veTbq5fF2HWYpgmkwjGKTYLVpY6miWYYmakML7R7LRf'and tx_success = Trueand any_match(log_messages, i -> i like '%Instruction: Unstake%') = True),transfers as (select block_date, tx_id, amount, from_owner, to_ownerfrom tokens_solana.transferswhereblock_date >= DATE('2024-12-10')and token_mint_address = 'MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u' -- token addressand amount > 0and outer_executing_account = 'veTbq5fF2HWYpgmkwjGKTYLVpY6miWYYmakML7R7LRf' -- staking program)select block_date, a.tx_id,casewhen action = 'stake' then from_ownerwhen action = 'unstake' then to_ownerend as user,casewhen action = 'stake' then amountwhen action = 'unstake' then -amountend as amount,actionfrom stake_txs a join transfers b on a.tx_id = b.tx_id