diff --git a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs index 5035e67a1..5f0f8d556 100644 --- a/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs +++ b/programs/openbook-v2/src/instructions/cancel_all_and_place_orders.rs @@ -88,6 +88,7 @@ pub fn cancel_all_and_place_orders( } = book.new_order( order, &mut market, + &ctx.accounts.market.key(), &mut event_heap, oracle_price, Some(&mut open_orders_account), diff --git a/programs/openbook-v2/src/instructions/place_order.rs b/programs/openbook-v2/src/instructions/place_order.rs index 15428c5aa..da09cde2e 100644 --- a/programs/openbook-v2/src/instructions/place_order.rs +++ b/programs/openbook-v2/src/instructions/place_order.rs @@ -59,6 +59,7 @@ pub fn place_order(ctx: Context, order: Order, limit: u8) -> Result< } = book.new_order( &order, &mut market, + &ctx.accounts.market.key(), &mut event_heap, oracle_price, Some(&mut open_orders_account), diff --git a/programs/openbook-v2/src/instructions/place_take_order.rs b/programs/openbook-v2/src/instructions/place_take_order.rs index 83264205b..bad71804a 100644 --- a/programs/openbook-v2/src/instructions/place_take_order.rs +++ b/programs/openbook-v2/src/instructions/place_take_order.rs @@ -50,6 +50,7 @@ pub fn place_take_order(ctx: Context, order: Order, limit: u8) - } = book.new_order( &order, &mut market, + &ctx.accounts.market.key(), &mut event_heap, oracle_price, None, diff --git a/programs/openbook-v2/src/logs.rs b/programs/openbook-v2/src/logs.rs index 0a52da46d..32e260a53 100644 --- a/programs/openbook-v2/src/logs.rs +++ b/programs/openbook-v2/src/logs.rs @@ -33,7 +33,6 @@ pub struct FillLog { pub quantity: i64, // number of base lots } - #[event] pub struct PlaceOrderLog { pub open_orders_account: Pubkey, @@ -41,6 +40,12 @@ pub struct PlaceOrderLog { pub timestamp: u64, } +#[event] +pub struct TakerSignatureLog { + pub market: Pubkey, + pub seq_num: u64, +} + #[event] pub struct MarketMetaDataLog { pub market: Pubkey, diff --git a/programs/openbook-v2/src/state/open_orders_account.rs b/programs/openbook-v2/src/state/open_orders_account.rs index e462c143a..7fb498c2f 100644 --- a/programs/openbook-v2/src/state/open_orders_account.rs +++ b/programs/openbook-v2/src/state/open_orders_account.rs @@ -211,7 +211,7 @@ impl OpenOrdersAccount { maker_slot: fill.maker_slot, maker_out: fill.maker_out(), timestamp: fill.timestamp, - seq_num: fill.seq_num, + seq_num: fill.market_seq_num, maker: fill.maker, maker_client_order_id: fill.maker_client_order_id, maker_fee: maker_fees, diff --git a/programs/openbook-v2/src/state/orderbook/book.rs b/programs/openbook-v2/src/state/orderbook/book.rs index 1aa1040fa..7eaada168 100644 --- a/programs/openbook-v2/src/state/orderbook/book.rs +++ b/programs/openbook-v2/src/state/orderbook/book.rs @@ -63,6 +63,7 @@ impl<'a> Orderbook<'a> { &mut self, order: &Order, open_book_market: &mut Market, + market_pk: &Pubkey, event_heap: &mut EventHeap, oracle_price: Option, mut open_orders_account: Option<&mut OpenOrdersAccount>, @@ -235,7 +236,7 @@ impl<'a> Orderbook<'a> { maker_out, best_opposing.node.owner_slot, now_ts, - event_heap.header.seq_num, + market.seq_num, best_opposing.node.owner, best_opposing.node.client_order_id, best_opposing.node.timestamp, @@ -246,6 +247,11 @@ impl<'a> Orderbook<'a> { match_base_lots, ); + emit!(TakerSignatureLog { + market: *market_pk, + seq_num: market.seq_num, + }); + process_fill_event( fill, market, diff --git a/programs/openbook-v2/src/state/orderbook/heap.rs b/programs/openbook-v2/src/state/orderbook/heap.rs index 1d705bb23..d2ef2452e 100644 --- a/programs/openbook-v2/src/state/orderbook/heap.rs +++ b/programs/openbook-v2/src/state/orderbook/heap.rs @@ -243,7 +243,7 @@ pub struct FillEvent { pub maker_slot: u8, pub padding: [u8; 4], pub timestamp: u64, - pub seq_num: u64, + pub market_seq_num: u64, pub maker: Pubkey, @@ -269,7 +269,7 @@ impl FillEvent { maker_out: bool, maker_slot: u8, timestamp: u64, - seq_num: u64, + market_seq_num: u64, maker: Pubkey, maker_client_order_id: u64, maker_timestamp: u64, @@ -285,7 +285,7 @@ impl FillEvent { maker_out: maker_out.into(), maker_slot, timestamp, - seq_num, + market_seq_num, maker, maker_client_order_id, maker_timestamp,