Skip to content

Commit

Permalink
log taker signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mschneider committed Apr 8, 2024
1 parent b234bb1 commit 7c80daf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions programs/openbook-v2/src/instructions/place_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn place_order(ctx: Context<PlaceOrder>, 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),
Expand Down
1 change: 1 addition & 0 deletions programs/openbook-v2/src/instructions/place_take_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub fn place_take_order(ctx: Context<PlaceTakeOrder>, order: Order, limit: u8) -
} = book.new_order(
&order,
&mut market,
&ctx.accounts.market.key(),
&mut event_heap,
oracle_price,
None,
Expand Down
7 changes: 6 additions & 1 deletion programs/openbook-v2/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ pub struct FillLog {
pub quantity: i64, // number of base lots
}


#[event]
pub struct PlaceOrderLog {
pub open_orders_account: Pubkey,
pub order_id: u128,
pub timestamp: u64,
}

#[event]
pub struct TakerSignatureLog {
pub market: Pubkey,
pub seq_num: u64,
}

#[event]
pub struct MarketMetaDataLog {
pub market: Pubkey,
Expand Down
2 changes: 1 addition & 1 deletion programs/openbook-v2/src/state/open_orders_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion programs/openbook-v2/src/state/orderbook/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I80F48>,
mut open_orders_account: Option<&mut OpenOrdersAccount>,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions programs/openbook-v2/src/state/orderbook/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 7c80daf

Please sign in to comment.