Skip to content

Commit 701d930

Browse files
committed
tests that custody token and prepared order response are closed
1 parent 6ea6bde commit 701d930

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

solana/modules/matching-engine-testing/tests/test_scenarios/settle_auction.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,25 @@ pub async fn test_settle_auction_none_balance_changes_comparable() {
317317
helpers::compare_balance_changes(&balance_changes_shimful, &balance_changes_shimless);
318318
}
319319

320+
/// Test that settle auction none closes the prepared order account and the custody token account
321+
#[tokio::test]
322+
pub async fn test_settle_auction_none_closes_prepared_order_account_and_custody_token_account() {
323+
let (mut test_context, prepared_order_state, testing_engine, _initial_balances) =
324+
Box::pin(helpers::prepare_settle_auction_none_shimful()).await;
325+
let instruction_triggers = vec![InstructionTrigger::SettleAuctionNoneShim(
326+
SettleAuctionNoneInstructionConfig::default(),
327+
)];
328+
let settle_auction_none_state = testing_engine
329+
.execute(
330+
&mut test_context,
331+
instruction_triggers,
332+
Some(prepared_order_state),
333+
)
334+
.await;
335+
helpers::verify_prepared_order_accounts_closed(&settle_auction_none_state, &mut test_context)
336+
.await;
337+
}
338+
320339
/*
321340
Sad path tests section
322341
@@ -435,6 +454,25 @@ mod helpers {
435454

436455
use super::*;
437456

457+
pub async fn verify_prepared_order_accounts_closed(
458+
testing_state: &TestingEngineState,
459+
test_context: &mut ProgramTestContext,
460+
) {
461+
let prepared_order_accounts = testing_state.order_prepared().unwrap();
462+
let prepared_order_account = test_context
463+
.banks_client
464+
.get_account(prepared_order_accounts.prepared_custody_token)
465+
.await
466+
.unwrap();
467+
assert!(prepared_order_account.is_none());
468+
let prepared_custody_token_account = test_context
469+
.banks_client
470+
.get_account(prepared_order_accounts.prepared_custody_token)
471+
.await
472+
.unwrap();
473+
assert!(prepared_custody_token_account.is_none());
474+
}
475+
438476
pub async fn balance_changes_shim() -> BalanceChanges {
439477
let transfer_direction = TransferDirection::FromEthereumToArbitrum;
440478
let vaa_args = vec![VaaArgs {

0 commit comments

Comments
 (0)