Skip to content

Commit

Permalink
Update order replacement protos to include old order id (dydxprotocol…
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy authored Jun 10, 2024
1 parent 5aa268e commit 1e234eb
Show file tree
Hide file tree
Showing 6 changed files with 374 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,14 +719,18 @@ export interface StatefulOrderEventV1_LongTermOrderPlacementV1 {
export interface StatefulOrderEventV1_LongTermOrderPlacementV1SDKType {
order?: IndexerOrderSDKType;
}
/** A long term order placement contains an order. */
/** A long term order replacement contains an old order ID and the new order. */

export interface StatefulOrderEventV1_LongTermOrderReplacementV1 {
/** vault replaces orders with a different order ID */
oldOrderId?: IndexerOrderId;
order?: IndexerOrder;
}
/** A long term order placement contains an order. */
/** A long term order replacement contains an old order ID and the new order. */

export interface StatefulOrderEventV1_LongTermOrderReplacementV1SDKType {
/** vault replaces orders with a different order ID */
old_order_id?: IndexerOrderIdSDKType;
order?: IndexerOrderSDKType;
}
/**
Expand Down Expand Up @@ -2733,14 +2737,19 @@ export const StatefulOrderEventV1_LongTermOrderPlacementV1 = {

function createBaseStatefulOrderEventV1_LongTermOrderReplacementV1(): StatefulOrderEventV1_LongTermOrderReplacementV1 {
return {
oldOrderId: undefined,
order: undefined
};
}

export const StatefulOrderEventV1_LongTermOrderReplacementV1 = {
encode(message: StatefulOrderEventV1_LongTermOrderReplacementV1, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.oldOrderId !== undefined) {
IndexerOrderId.encode(message.oldOrderId, writer.uint32(10).fork()).ldelim();
}

if (message.order !== undefined) {
IndexerOrder.encode(message.order, writer.uint32(10).fork()).ldelim();
IndexerOrder.encode(message.order, writer.uint32(18).fork()).ldelim();
}

return writer;
Expand All @@ -2756,6 +2765,10 @@ export const StatefulOrderEventV1_LongTermOrderReplacementV1 = {

switch (tag >>> 3) {
case 1:
message.oldOrderId = IndexerOrderId.decode(reader, reader.uint32());
break;

case 2:
message.order = IndexerOrder.decode(reader, reader.uint32());
break;

Expand All @@ -2770,6 +2783,7 @@ export const StatefulOrderEventV1_LongTermOrderReplacementV1 = {

fromPartial(object: DeepPartial<StatefulOrderEventV1_LongTermOrderReplacementV1>): StatefulOrderEventV1_LongTermOrderReplacementV1 {
const message = createBaseStatefulOrderEventV1_LongTermOrderReplacementV1();
message.oldOrderId = object.oldOrderId !== undefined && object.oldOrderId !== null ? IndexerOrderId.fromPartial(object.oldOrderId) : undefined;
message.order = object.order !== undefined && object.order !== null ? IndexerOrder.fromPartial(object.order) : undefined;
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,20 @@ export interface OrderUpdateV1SDKType {
order_id?: IndexerOrderIdSDKType;
total_filled_quantums: Long;
}
/** OrderReplace messages contain the replacement order. */
/** OrderReplace messages contain the old order ID and the replacement order. */

export interface OrderReplaceV1 {
/** vault replaces orders with a different order ID */
oldOrderId?: IndexerOrderId;
order?: IndexerOrder;
placementStatus: OrderPlaceV1_OrderPlacementStatus;
timeStamp?: Date;
}
/** OrderReplace messages contain the replacement order. */
/** OrderReplace messages contain the old order ID and the replacement order. */

export interface OrderReplaceV1SDKType {
/** vault replaces orders with a different order ID */
old_order_id?: IndexerOrderIdSDKType;
order?: IndexerOrderSDKType;
placement_status: OrderPlaceV1_OrderPlacementStatusSDKType;
time_stamp?: Date;
Expand Down Expand Up @@ -512,6 +516,7 @@ export const OrderUpdateV1 = {

function createBaseOrderReplaceV1(): OrderReplaceV1 {
return {
oldOrderId: undefined,
order: undefined,
placementStatus: 0,
timeStamp: undefined
Expand All @@ -520,16 +525,20 @@ function createBaseOrderReplaceV1(): OrderReplaceV1 {

export const OrderReplaceV1 = {
encode(message: OrderReplaceV1, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.oldOrderId !== undefined) {
IndexerOrderId.encode(message.oldOrderId, writer.uint32(10).fork()).ldelim();
}

if (message.order !== undefined) {
IndexerOrder.encode(message.order, writer.uint32(10).fork()).ldelim();
IndexerOrder.encode(message.order, writer.uint32(18).fork()).ldelim();
}

if (message.placementStatus !== 0) {
writer.uint32(16).int32(message.placementStatus);
writer.uint32(24).int32(message.placementStatus);
}

if (message.timeStamp !== undefined) {
Timestamp.encode(toTimestamp(message.timeStamp), writer.uint32(26).fork()).ldelim();
Timestamp.encode(toTimestamp(message.timeStamp), writer.uint32(34).fork()).ldelim();
}

return writer;
Expand All @@ -545,14 +554,18 @@ export const OrderReplaceV1 = {

switch (tag >>> 3) {
case 1:
message.order = IndexerOrder.decode(reader, reader.uint32());
message.oldOrderId = IndexerOrderId.decode(reader, reader.uint32());
break;

case 2:
message.placementStatus = (reader.int32() as any);
message.order = IndexerOrder.decode(reader, reader.uint32());
break;

case 3:
message.placementStatus = (reader.int32() as any);
break;

case 4:
message.timeStamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;

Expand All @@ -567,6 +580,7 @@ export const OrderReplaceV1 = {

fromPartial(object: DeepPartial<OrderReplaceV1>): OrderReplaceV1 {
const message = createBaseOrderReplaceV1();
message.oldOrderId = object.oldOrderId !== undefined && object.oldOrderId !== null ? IndexerOrderId.fromPartial(object.oldOrderId) : undefined;
message.order = object.order !== undefined && object.order !== null ? IndexerOrder.fromPartial(object.order) : undefined;
message.placementStatus = object.placementStatus ?? 0;
message.timeStamp = object.timeStamp ?? undefined;
Expand Down
6 changes: 4 additions & 2 deletions proto/dydxprotocol/indexer/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ message StatefulOrderEventV1 {
dydxprotocol.indexer.protocol.v1.IndexerOrder order = 1;
}

// A long term order placement contains an order.
// A long term order replacement contains an old order ID and the new order.
message LongTermOrderReplacementV1 {
dydxprotocol.indexer.protocol.v1.IndexerOrder order = 1;
dydxprotocol.indexer.protocol.v1.IndexerOrderId old_order_id =
1; // vault replaces orders with a different order ID
dydxprotocol.indexer.protocol.v1.IndexerOrder order = 2;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ message OrderUpdateV1 {
uint64 total_filled_quantums = 2;
}

// OrderReplace messages contain the replacement order.
// OrderReplace messages contain the old order ID and the replacement order.
message OrderReplaceV1 {
dydxprotocol.indexer.protocol.v1.IndexerOrder order = 1;
dydxprotocol.indexer.protocol.v1.IndexerOrderId old_order_id =
1; // vault replaces orders with a different order ID
dydxprotocol.indexer.protocol.v1.IndexerOrder order = 2;
dydxprotocol.indexer.off_chain_updates.OrderPlaceV1.OrderPlacementStatus
placement_status = 2;
placement_status = 3;

google.protobuf.Timestamp time_stamp = 3
google.protobuf.Timestamp time_stamp = 4
[ (gogoproto.nullable) = true, (gogoproto.stdtime) = true ];
}

Expand Down
Loading

0 comments on commit 1e234eb

Please sign in to comment.