Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Jun 11, 2024
1 parent 747ffaa commit 4f0415e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions protocol/x/clob/keeper/msg_server_place_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
33 changes: 23 additions & 10 deletions protocol/x/vault/keeper/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 4f0415e

Please sign in to comment.