diff --git a/protocol/x/clob/keeper/msg_server_place_order.go b/protocol/x/clob/keeper/msg_server_place_order.go index 829ba1ae87..f5f04d456a 100644 --- a/protocol/x/clob/keeper/msg_server_place_order.go +++ b/protocol/x/clob/keeper/msg_server_place_order.go @@ -116,7 +116,7 @@ func (k Keeper) HandleMsgPlaceOrder( // 4. Emit the new order placement indexer event. if order.IsConditionalOrder() { - if !isInternalOrder { + if !isInternalOrder { // vault order indexer event logic is handled elsewhere k.GetIndexerEventManager().AddTxnEvent( ctx, indexerevents.SubtypeStatefulOrder, @@ -133,7 +133,7 @@ func (k Keeper) HandleMsgPlaceOrder( order.OrderId, ) } else { - if !isInternalOrder { + if !isInternalOrder { // vault order indexer event logic is handled elsewhere k.GetIndexerEventManager().AddTxnEvent( ctx, indexerevents.SubtypeStatefulOrder, diff --git a/protocol/x/vault/keeper/orders.go b/protocol/x/vault/keeper/orders.go index eaa16a6af9..30eed75d7d 100644 --- a/protocol/x/vault/keeper/orders.go +++ b/protocol/x/vault/keeper/orders.go @@ -118,17 +118,30 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) ( // Send indexer order replace messages. replacedOrder := ordersToCancel[i] - k.GetIndexerEventManager().AddTxnEvent( - ctx, - indexerevents.SubtypeStatefulOrder, - indexerevents.StatefulOrderEventVersion, - indexer_manager.GetBytes( - indexerevents.NewLongTermOrderReplacementEvent( - replacedOrder.OrderId, - *order, + if replacedOrder == nil { + k.GetIndexerEventManager().AddTxnEvent( + ctx, + indexerevents.SubtypeStatefulOrder, + indexerevents.StatefulOrderEventVersion, + indexer_manager.GetBytes( + indexerevents.NewLongTermOrderPlacementEvent( + *order, + ), ), - ), - ) + ) + } else { + k.GetIndexerEventManager().AddTxnEvent( + ctx, + indexerevents.SubtypeStatefulOrder, + indexerevents.StatefulOrderEventVersion, + indexer_manager.GetBytes( + indexerevents.NewLongTermOrderReplacementEvent( + replacedOrder.OrderId, + *order, + ), + ), + ) + } } return nil }