@@ -27,7 +27,7 @@ use crate::{
2727 metrics:: { metrics_handler, MetricsServerParams , SwiftServerMetrics } ,
2828 } ,
2929} ;
30- use anchor_lang:: AnchorDeserialize ;
30+ use anchor_lang:: { AnchorDeserialize , Discriminator } ;
3131use axum:: {
3232 extract:: State ,
3333 http:: { self , Method , StatusCode } ,
@@ -38,6 +38,7 @@ use base64::Engine;
3838use dotenv:: dotenv;
3939use drift_rs:: {
4040 constants:: high_leverage_mode_account,
41+ drift_idl,
4142 event_subscriber:: PubsubClient ,
4243 math:: account_list_builder:: AccountsListBuilder ,
4344 swift_order_subscriber:: { SignedMessageInfo , SignedOrderType } ,
@@ -408,6 +409,25 @@ pub async fn deposit_trade(
408409 ) ;
409410 }
410411
412+ // verify deposit ix exists and amount
413+ let mut has_place_ix = false ;
414+ for ix in req. deposit_tx . message . instructions ( ) {
415+ if & ix. data [ ..8 ] == drift_idl:: instructions:: PlaceSignedMsgTakerOrder :: DISCRIMINATOR {
416+ has_place_ix = true ;
417+ }
418+ }
419+
420+ if !has_place_ix {
421+ log:: info!( target: "server" , "[{uuid}] missing place order ix" ) ;
422+ return (
423+ StatusCode :: BAD_REQUEST ,
424+ Json ( ProcessOrderResponse {
425+ message : "" ,
426+ error : Some ( "missing placeSignedMsgTakerOrder ix" . into ( ) ) ,
427+ } ) ,
428+ ) ;
429+ }
430+
411431 // ensure deposit tx is valid
412432 let mut user_after_deposit = None ;
413433 match simulate_tx (
0 commit comments