Skip to content

Commit

Permalink
Fix withdraw 22 (#173)
Browse files Browse the repository at this point in the history
* fix withdraw 22

* fmt
  • Loading branch information
brittcyr authored Oct 10, 2024
1 parent 056fadc commit 143cd73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions programs/manifest/src/program/processor/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ pub(crate) fn process_withdraw(
invoke_signed(
&spl_token_2022::instruction::transfer_checked(
token_program.key,
trader_token.key,
vault.key,
if is_base {
dynamic_account.fixed.get_base_mint()
} else {
dynamic_account.get_quote_mint()
},
trader_token.key,
vault.key,
payer.key,
&[],
amount_atoms,
if is_base {
Expand Down
14 changes: 14 additions & 0 deletions programs/manifest/tests/cases/token22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ async fn token22_base() -> anyhow::Result<()> {
&[&payer_keypair.insecure_clone()],
)
.await?;
{
let market_account: solana_sdk::account::Account = context
.borrow_mut()
.banks_client
.get_account(market_keypair.pubkey())
.await
.unwrap()
.unwrap();

let market: manifest::state::MarketValue =
manifest::program::get_dynamic_value(market_account.data.as_slice());
let balance = market.get_trader_balance(&payer);
assert_eq!(balance.0.as_u64(), 999999000);
}

// Place orders on both sides to
let place_order_ix: Instruction = batch_update_instruction(
Expand Down

0 comments on commit 143cd73

Please sign in to comment.