File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2243,6 +2243,10 @@ pub fn fulfill_perp_order_with_amm(
22432243 direction,
22442244 order_id
22452245 ) ;
2246+ let user_order_has_builder = user. orders [ order_index] . is_has_builder ( ) ;
2247+ if user_order_has_builder && rev_share_escrow. is_none ( ) {
2248+ msg ! ( "Order has builder but no escrow account included, in the future this will fail." ) ;
2249+ }
22462250
22472251 validation:: perp_market:: validate_amm_account_for_fill ( & market. amm , order_direction) ?;
22482252
@@ -2331,7 +2335,7 @@ pub fn fulfill_perp_order_with_amm(
23312335
23322336 if builder_fee != 0 {
23332337 if let ( Some ( idx) , Some ( escrow) ) = ( builder_order_idx, rev_share_escrow. as_mut ( ) ) {
2334- let mut order = escrow. get_order_mut ( idx) ?;
2338+ let order = escrow. get_order_mut ( idx) ?;
23352339 order. fees_accrued = order. fees_accrued . safe_add ( builder_fee) ?;
23362340 } else {
23372341 msg ! ( "Order has builder fee but no escrow account found, in the future this tx will fail." ) ;
@@ -2593,6 +2597,10 @@ pub fn fulfill_perp_order_with_match(
25932597
25942598 let oracle_price = oracle_map. get_price_data ( & market. oracle_id ( ) ) ?. price ;
25952599 let taker_direction: PositionDirection = taker. orders [ taker_order_index] . direction ;
2600+ let taker_order_has_builder = taker. orders [ taker_order_index] . is_has_builder ( ) ;
2601+ if taker_order_has_builder && rev_share_escrow. is_none ( ) {
2602+ msg ! ( "Order has builder but no escrow account included, in the future this will fail." ) ;
2603+ }
25962604
25972605 let taker_price = if let Some ( taker_limit_price) = taker_limit_price {
25982606 taker_limit_price
Original file line number Diff line number Diff line change @@ -1503,6 +1503,10 @@ impl Order {
15031503 self . is_bit_flag_set ( OrderBitFlag :: SignedMessage )
15041504 }
15051505
1506+ pub fn is_has_builder ( & self ) -> bool {
1507+ self . is_bit_flag_set ( OrderBitFlag :: HasBuilder )
1508+ }
1509+
15061510 pub fn add_bit_flag ( & mut self , flag : OrderBitFlag ) {
15071511 self . bit_flags |= flag as u8 ;
15081512 }
You can’t perform that action at this time.
0 commit comments