-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-1320] proto for FNS price updates #2586
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { MarketPrice, MarketPriceSDKType } from "./market_price"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
import { DeepPartial } from "../../helpers"; | ||
/** StreamPriceUpdate provides information on a price update. */ | ||
|
||
export interface StreamPriceUpdate { | ||
/** The `Id` of the `Market`. */ | ||
marketId: number; | ||
/** The updated price. */ | ||
|
||
price?: MarketPrice; | ||
/** Snapshot indicates if the response is from a snapshot of the price. */ | ||
|
||
snapshot: boolean; | ||
} | ||
/** StreamPriceUpdate provides information on a price update. */ | ||
|
||
export interface StreamPriceUpdateSDKType { | ||
/** The `Id` of the `Market`. */ | ||
market_id: number; | ||
/** The updated price. */ | ||
|
||
price?: MarketPriceSDKType; | ||
/** Snapshot indicates if the response is from a snapshot of the price. */ | ||
|
||
snapshot: boolean; | ||
} | ||
|
||
function createBaseStreamPriceUpdate(): StreamPriceUpdate { | ||
return { | ||
marketId: 0, | ||
price: undefined, | ||
snapshot: false | ||
}; | ||
} | ||
|
||
export const StreamPriceUpdate = { | ||
encode(message: StreamPriceUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
if (message.marketId !== 0) { | ||
writer.uint32(8).uint32(message.marketId); | ||
} | ||
|
||
if (message.price !== undefined) { | ||
MarketPrice.encode(message.price, writer.uint32(18).fork()).ldelim(); | ||
} | ||
|
||
if (message.snapshot === true) { | ||
writer.uint32(24).bool(message.snapshot); | ||
} | ||
|
||
return writer; | ||
}, | ||
|
||
decode(input: _m0.Reader | Uint8Array, length?: number): StreamPriceUpdate { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseStreamPriceUpdate(); | ||
|
||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
|
||
switch (tag >>> 3) { | ||
case 1: | ||
message.marketId = reader.uint32(); | ||
break; | ||
|
||
case 2: | ||
message.price = MarketPrice.decode(reader, reader.uint32()); | ||
break; | ||
|
||
case 3: | ||
message.snapshot = reader.bool(); | ||
break; | ||
|
||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
|
||
return message; | ||
}, | ||
|
||
fromPartial(object: DeepPartial<StreamPriceUpdate>): StreamPriceUpdate { | ||
const message = createBaseStreamPriceUpdate(); | ||
message.marketId = object.marketId ?? 0; | ||
message.price = object.price !== undefined && object.price !== null ? MarketPrice.fromPartial(object.price) : undefined; | ||
message.snapshot = object.snapshot ?? false; | ||
return message; | ||
} | ||
|
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import * as _129 from "./gogo"; | ||
export const gogoproto = { ..._129 | ||
import * as _130 from "./gogo"; | ||
export const gogoproto = { ..._130 | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import * as _130 from "./api/annotations"; | ||
import * as _131 from "./api/http"; | ||
import * as _132 from "./protobuf/descriptor"; | ||
import * as _133 from "./protobuf/duration"; | ||
import * as _134 from "./protobuf/timestamp"; | ||
import * as _135 from "./protobuf/any"; | ||
import * as _131 from "./api/annotations"; | ||
import * as _132 from "./api/http"; | ||
import * as _133 from "./protobuf/descriptor"; | ||
import * as _134 from "./protobuf/duration"; | ||
import * as _135 from "./protobuf/timestamp"; | ||
import * as _136 from "./protobuf/any"; | ||
export namespace google { | ||
export const api = { ..._130, | ||
..._131 | ||
export const api = { ..._131, | ||
..._132 | ||
}; | ||
export const protobuf = { ..._132, | ||
..._133, | ||
export const protobuf = { ..._133, | ||
..._134, | ||
..._135 | ||
..._135, | ||
..._136 | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.prices; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dydxprotocol/prices/market_price.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/prices/types"; | ||
|
||
// StreamPriceUpdate provides information on a price update. | ||
message StreamPriceUpdate { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add this to StagedFinalizeBlockEvent? We probably want price update streams to go through similar flows (store in transient store, stream in Precommit) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added! |
||
// The `Id` of the `Market`. | ||
uint32 market_id = 1; | ||
|
||
// The updated price. | ||
MarketPrice price = 2 [ (gogoproto.nullable) = false ]; | ||
|
||
// Snapshot indicates if the response is from a snapshot of the price. | ||
bool snapshot = 3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically we can derive these from the clob pair ids, but i think this is slightly more flexible