diff --git a/protocol/x/vault/keeper/orders.go b/protocol/x/vault/keeper/orders.go index a52bd4fd69..8f3f70abe4 100644 --- a/protocol/x/vault/keeper/orders.go +++ b/protocol/x/vault/keeper/orders.go @@ -82,27 +82,6 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) ( log.ErrorLogWithError(ctx, "Failed to get vault clob orders to cancel", err, "vaultId", vaultId) return err } - // Place new CLOB orders. - ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId) - - if err != nil { - log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId) - return err - } - - for i, order := range ordersToPlace { - replacedOrder := ordersToCancel[i] - if replacedOrder.Subticks != order.Subticks { - vaultId.IncrCounter( - metrics.VaultPlaceOrderDifferentPrice, - ) - } else { - vaultId.IncrCounter( - metrics.VaultPlaceOrderSamePrice, - ) - } - } - orderExpirationSeconds := k.GetParams(ctx).OrderExpirationSeconds for _, order := range ordersToCancel { if _, exists := k.clobKeeper.GetLongTermOrderPlacement(ctx, order.OrderId); exists { @@ -120,14 +99,13 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) ( } } - // // Place new CLOB orders. - // ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId) - - // if err != nil { - // log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId) - // return err - // } + // Place new CLOB orders. + ordersToPlace, err := k.GetVaultClobOrders(ctx, vaultId) + if err != nil { + log.ErrorLogWithError(ctx, "Failed to get vault clob orders to place", err, "vaultId", vaultId) + return err + } for i, order := range ordersToPlace { err := k.PlaceVaultClobOrder(ctx, order) if err != nil { @@ -143,6 +121,10 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) ( // Otherwise, send an order place message only. replacedOrder := ordersToCancel[i] if replacedOrder.Subticks != order.Subticks { + vaultId.IncrCounter( + metrics.VaultPlaceOrderDifferentPrice, + ) + k.GetIndexerEventManager().AddTxnEvent( ctx, indexerevents.SubtypeStatefulOrder, @@ -165,6 +147,9 @@ func (k Keeper) RefreshVaultClobOrders(ctx sdk.Context, vaultId types.VaultId) ( ), ) } else { + vaultId.IncrCounter( + metrics.VaultPlaceOrderDifferentPrice, + ) k.GetIndexerEventManager().AddTxnEvent( ctx, indexerevents.SubtypeStatefulOrder,