Skip to content

Commit

Permalink
program: fix force delete user for token 22
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Dec 4, 2024
1 parent d22aceb commit 17ef24c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions programs/drift/src/instructions/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cell::RefMut;
use std::convert::{TryFrom, TryInto};

use anchor_lang::prelude::*;
use anchor_spl::associated_token::get_associated_token_address;
use anchor_spl::associated_token::{get_associated_token_address, get_associated_token_address_with_program_id};
use anchor_spl::token::spl_token;
use anchor_spl::token_2022::spl_token_2022;
use anchor_spl::token_interface::{TokenAccount, TokenInterface};
Expand Down Expand Up @@ -2245,7 +2245,7 @@ pub fn handle_force_delete_user<'c: 'info, 'info>(
.find(|acc| acc.key() == spot_market_mint.key())
.map(|acc| InterfaceAccount::try_from(acc).unwrap());

let keeper_vault = get_associated_token_address(&keeper_key, spot_market_mint);
let keeper_vault = get_associated_token_address_with_program_id(&keeper_key, spot_market_mint, &token_program_pubkey);
let keeper_vault_account_info = ctx
.remaining_accounts
.iter()
Expand Down
5 changes: 3 additions & 2 deletions sdk/src/driftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1658,16 +1658,17 @@ export class DriftClient {
isWritable: true,
pubkey: spotMarket.vault,
});
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarket);
const keeperVault = await this.getAssociatedTokenAccount(
spotPosition.marketIndex,
false
false,
tokenProgram
);
remainingAccounts.push({
isSigner: false,
isWritable: true,
pubkey: keeperVault,
});
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarket);
tokenPrograms.add(tokenProgram.toBase58());
}

Expand Down

0 comments on commit 17ef24c

Please sign in to comment.