Skip to content

Commit

Permalink
add price update to finalize block events
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy04 committed Nov 20, 2024
1 parent 01818ed commit 48889e4
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StreamOrderbookFill, StreamOrderbookFillSDKType, StreamOrderbookUpdate, StreamOrderbookUpdateSDKType } from "./query";
import { StreamSubaccountUpdate, StreamSubaccountUpdateSDKType } from "../subaccounts/streaming";
import { StreamPriceUpdate, StreamPriceUpdateSDKType } from "../prices/streaming";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
/** StagedFinalizeBlockEvent is an event staged during `FinalizeBlock`. */
Expand All @@ -8,20 +9,23 @@ export interface StagedFinalizeBlockEvent {
orderFill?: StreamOrderbookFill;
subaccountUpdate?: StreamSubaccountUpdate;
orderbookUpdate?: StreamOrderbookUpdate;
priceUpdate?: StreamPriceUpdate;
}
/** StagedFinalizeBlockEvent is an event staged during `FinalizeBlock`. */

export interface StagedFinalizeBlockEventSDKType {
order_fill?: StreamOrderbookFillSDKType;
subaccount_update?: StreamSubaccountUpdateSDKType;
orderbook_update?: StreamOrderbookUpdateSDKType;
price_update?: StreamPriceUpdateSDKType;
}

function createBaseStagedFinalizeBlockEvent(): StagedFinalizeBlockEvent {
return {
orderFill: undefined,
subaccountUpdate: undefined,
orderbookUpdate: undefined
orderbookUpdate: undefined,
priceUpdate: undefined
};
}

Expand All @@ -39,6 +43,10 @@ export const StagedFinalizeBlockEvent = {
StreamOrderbookUpdate.encode(message.orderbookUpdate, writer.uint32(26).fork()).ldelim();
}

if (message.priceUpdate !== undefined) {
StreamPriceUpdate.encode(message.priceUpdate, writer.uint32(34).fork()).ldelim();
}

return writer;
},

Expand All @@ -63,6 +71,10 @@ export const StagedFinalizeBlockEvent = {
message.orderbookUpdate = StreamOrderbookUpdate.decode(reader, reader.uint32());
break;

case 4:
message.priceUpdate = StreamPriceUpdate.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -77,6 +89,7 @@ export const StagedFinalizeBlockEvent = {
message.orderFill = object.orderFill !== undefined && object.orderFill !== null ? StreamOrderbookFill.fromPartial(object.orderFill) : undefined;
message.subaccountUpdate = object.subaccountUpdate !== undefined && object.subaccountUpdate !== null ? StreamSubaccountUpdate.fromPartial(object.subaccountUpdate) : undefined;
message.orderbookUpdate = object.orderbookUpdate !== undefined && object.orderbookUpdate !== null ? StreamOrderbookUpdate.fromPartial(object.orderbookUpdate) : undefined;
message.priceUpdate = object.priceUpdate !== undefined && object.priceUpdate !== null ? StreamPriceUpdate.fromPartial(object.priceUpdate) : undefined;
return message;
}

Expand Down
2 changes: 2 additions & 0 deletions proto/dydxprotocol/clob/streaming.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package dydxprotocol.clob;

import "dydxprotocol/subaccounts/streaming.proto";
import "dydxprotocol/prices/streaming.proto";
import "dydxprotocol/clob/query.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/clob/types";
Expand All @@ -13,5 +14,6 @@ message StagedFinalizeBlockEvent {
StreamOrderbookFill order_fill = 1;
dydxprotocol.subaccounts.StreamSubaccountUpdate subaccount_update = 2;
StreamOrderbookUpdate orderbook_update = 3;
dydxprotocol.prices.StreamPriceUpdate price_update = 4;
}
}
117 changes: 101 additions & 16 deletions protocol/x/clob/types/streaming.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48889e4

Please sign in to comment.