1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use solana_program::instruction::{AccountMeta, Instruction};
use solana_program::pubkey::Pubkey;

use crate::program::PROGRAM_ID;
use crate::utils::sighash;

pub fn new_remove_position(
    position: &Pubkey,
    position_nft_mint: &Pubkey,
    position_ata: &Pubkey,
    payer: Pubkey,
) -> Instruction {
    let distor = sighash::sighash("global", "remove_position").to_vec();
    Instruction {
        program_id: PROGRAM_ID,
        accounts: vec![
            AccountMeta::new(payer, true),
            AccountMeta::new(*position, false),
            AccountMeta::new(*position_nft_mint, false),
            AccountMeta::new(*position_ata, false),
            AccountMeta::new_readonly(spl_token::id(), false),
        ],
        data: distor,
    }
}