From 2dce1398d3b54d566afab0ddc7d04007ef9381dc Mon Sep 17 00:00:00 2001 From: Nicholas Clarke Date: Tue, 25 Apr 2023 04:38:31 -0700 Subject: [PATCH] Fix to seq num logging. Seq num was incremented between event and logging (#556) --- mango_v4.json | 17 ++++++++++ programs/mango-v4/src/state/orderbook/book.rs | 5 +-- ts/client/src/mango_v4.ts | 34 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/mango_v4.json b/mango_v4.json index 9b6f7f89f..2d8ec85f9 100644 --- a/mango_v4.json +++ b/mango_v4.json @@ -7202,6 +7202,23 @@ ] } }, + { + "name": "CheckLiquidatable", + "type": { + "kind": "enum", + "variants": [ + { + "name": "NotLiquidatable" + }, + { + "name": "Liquidatable" + }, + { + "name": "BecameNotLiquidatable" + } + ] + } + }, { "name": "OracleType", "type": { diff --git a/programs/mango-v4/src/state/orderbook/book.rs b/programs/mango-v4/src/state/orderbook/book.rs index 9d9d61aa9..bd5f1a37f 100644 --- a/programs/mango-v4/src/state/orderbook/book.rs +++ b/programs/mango-v4/src/state/orderbook/book.rs @@ -138,12 +138,13 @@ impl<'a> Orderbook<'a> { matched_order_changes.push((best_opposing.handle, new_best_opposing_quantity)); } + let seq_num = event_queue.header.seq_num; let fill = FillEvent::new( side, maker_out, best_opposing.node.owner_slot, now_ts, - event_queue.header.seq_num, + seq_num, best_opposing.node.owner, best_opposing.node.client_order_id, market.maker_fee, @@ -160,7 +161,7 @@ impl<'a> Orderbook<'a> { emit!(FilledPerpOrderLog { mango_group: market.group.key(), perp_market_index: market.perp_market_index, - seq_num: event_queue.header.seq_num, + seq_num: seq_num, }); } let total_quote_lots_taken = order.max_quote_lots - remaining_quote_lots; diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index c477dc940..39e090132 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -7202,6 +7202,23 @@ export type MangoV4 = { ] } }, + { + "name": "CheckLiquidatable", + "type": { + "kind": "enum", + "variants": [ + { + "name": "NotLiquidatable" + }, + { + "name": "Liquidatable" + }, + { + "name": "BecameNotLiquidatable" + } + ] + } + }, { "name": "OracleType", "type": { @@ -16234,6 +16251,23 @@ export const IDL: MangoV4 = { ] } }, + { + "name": "CheckLiquidatable", + "type": { + "kind": "enum", + "variants": [ + { + "name": "NotLiquidatable" + }, + { + "name": "Liquidatable" + }, + { + "name": "BecameNotLiquidatable" + } + ] + } + }, { "name": "OracleType", "type": {