diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts index fd54ef914b..ce7dc7b83c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts @@ -59,7 +59,7 @@ export interface StreamSubaccountUpdateSDKType { export interface SubaccountPerpetualPosition { /** The `Id` of the `Perpetual`. */ perpetualId: number; - /** The size of the position in base quantums. */ + /** The size of the position in base quantums. Negative means short. */ quantums: Long; } @@ -71,7 +71,7 @@ export interface SubaccountPerpetualPosition { export interface SubaccountPerpetualPositionSDKType { /** The `Id` of the `Perpetual`. */ perpetual_id: number; - /** The size of the position in base quantums. */ + /** The size of the position in base quantums. Negative means short. */ quantums: Long; } @@ -178,7 +178,7 @@ export const StreamSubaccountUpdate = { function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition { return { perpetualId: 0, - quantums: Long.UZERO + quantums: Long.ZERO }; } @@ -189,7 +189,7 @@ export const SubaccountPerpetualPosition = { } if (!message.quantums.isZero()) { - writer.uint32(16).uint64(message.quantums); + writer.uint32(16).int64(message.quantums); } return writer; @@ -209,7 +209,7 @@ export const SubaccountPerpetualPosition = { break; case 2: - message.quantums = (reader.uint64() as Long); + message.quantums = (reader.int64() as Long); break; default: @@ -224,7 +224,7 @@ export const SubaccountPerpetualPosition = { fromPartial(object: DeepPartial): SubaccountPerpetualPosition { const message = createBaseSubaccountPerpetualPosition(); message.perpetualId = object.perpetualId ?? 0; - message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; + message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.ZERO; return message; } diff --git a/proto/dydxprotocol/subaccounts/streaming.proto b/proto/dydxprotocol/subaccounts/streaming.proto index 13b71ee1ae..9351391008 100644 --- a/proto/dydxprotocol/subaccounts/streaming.proto +++ b/proto/dydxprotocol/subaccounts/streaming.proto @@ -28,8 +28,8 @@ message StreamSubaccountUpdate { message SubaccountPerpetualPosition { // The `Id` of the `Perpetual`. uint32 perpetual_id = 1; - // The size of the position in base quantums. - uint64 quantums = 2; + // The size of the position in base quantums. Negative means short. + int64 quantums = 2; } // SubaccountAssetPosition provides information on a subaccount's updated asset diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 52d4c05bb3..a047d9e2c9 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -150,7 +150,7 @@ func (k Keeper) GetStreamSubaccountUpdate( for i, pp := range subaccount.PerpetualPositions { perpetualPositions[i] = &types.SubaccountPerpetualPosition{ PerpetualId: pp.PerpetualId, - Quantums: pp.Quantums.BigInt().Uint64(), + Quantums: pp.Quantums.BigInt().Int64(), } } @@ -298,7 +298,7 @@ func GenerateStreamSubaccountUpdate( for i, pp := range updatedPerpetualPositions { perpetualPositions[i] = &types.SubaccountPerpetualPosition{ PerpetualId: pp.PerpetualId, - Quantums: pp.Quantums.BigInt().Uint64(), + Quantums: pp.Quantums.BigInt().Int64(), } } diff --git a/protocol/x/subaccounts/types/streaming.pb.go b/protocol/x/subaccounts/types/streaming.pb.go index 2babfbf862..68f50b9668 100644 --- a/protocol/x/subaccounts/types/streaming.pb.go +++ b/protocol/x/subaccounts/types/streaming.pb.go @@ -106,8 +106,8 @@ func (m *StreamSubaccountUpdate) GetSnapshot() bool { type SubaccountPerpetualPosition struct { // The `Id` of the `Perpetual`. PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"` - // The size of the position in base quantums. - Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` + // The size of the position in base quantums. Negative means short. + Quantums int64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` } func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetualPosition{} } @@ -150,7 +150,7 @@ func (m *SubaccountPerpetualPosition) GetPerpetualId() uint32 { return 0 } -func (m *SubaccountPerpetualPosition) GetQuantums() uint64 { +func (m *SubaccountPerpetualPosition) GetQuantums() int64 { if m != nil { return m.Quantums } @@ -224,30 +224,30 @@ func init() { } var fileDescriptor_e6cf3092946c3c13 = []byte{ - // 353 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6a, 0xea, 0x40, - 0x14, 0x86, 0x1d, 0x95, 0x7b, 0x65, 0xd4, 0xcd, 0xc0, 0xbd, 0x46, 0x85, 0x60, 0x5d, 0x94, 0x74, - 0xd1, 0x84, 0xda, 0x76, 0xd9, 0x45, 0xbb, 0x93, 0x6e, 0x24, 0x52, 0x0a, 0xa5, 0x20, 0x63, 0x26, - 0xe8, 0x80, 0x66, 0xa6, 0x9e, 0x99, 0xa2, 0x6f, 0xd1, 0xc7, 0xea, 0xd2, 0x65, 0x97, 0xc5, 0xbc, - 0x48, 0x31, 0xc6, 0x31, 0x52, 0x14, 0x77, 0xf9, 0xcf, 0x7f, 0xce, 0xf7, 0x67, 0x0e, 0x07, 0x3b, - 0x6c, 0xc1, 0xe6, 0x72, 0x26, 0x94, 0x08, 0xc4, 0xc4, 0x03, 0x3d, 0xa4, 0x41, 0x20, 0x74, 0xa4, - 0xc0, 0x03, 0x35, 0x0b, 0xe9, 0x94, 0x47, 0x23, 0x37, 0xb1, 0x89, 0x95, 0xed, 0x74, 0x33, 0x9d, - 0x8d, 0x8b, 0xc3, 0x0c, 0xf3, 0xbd, 0x81, 0xb4, 0xe3, 0x3c, 0xfe, 0xdf, 0x4f, 0xc0, 0x7d, 0x63, - 0x3d, 0x49, 0x46, 0x55, 0x48, 0x1e, 0x71, 0x75, 0xd7, 0x3e, 0xe0, 0xcc, 0x42, 0x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, 0xc6, 0x94, 0x47, 0x9e, 0xa9, 0xcc, 0xf7, 0x2e, 0x4f, 0x2d, 0x64, 0x08, 0xc3, - 0x3f, 0x89, 0x7b, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x34, 0x6c, 0x66, 0xe6, 0x02, 0x00, - 0x00, + // 354 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4e, 0xc2, 0x40, + 0x10, 0x86, 0x29, 0x10, 0x25, 0x0b, 0x5c, 0x36, 0x51, 0x0a, 0x24, 0x0d, 0x72, 0x30, 0xf5, 0x60, + 0x1b, 0x51, 0x8f, 0x1e, 0xf4, 0x46, 0xbc, 0x90, 0x12, 0x63, 0x62, 0x4c, 0xc8, 0xd2, 0x6d, 0x60, + 0x13, 0xe8, 0xae, 0xcc, 0xae, 0x81, 0xb7, 0xf0, 0xb1, 0x3c, 0x72, 0xf4, 0x68, 0xe8, 0x8b, 0x18, + 0x4a, 0xd9, 0x96, 0x28, 0x86, 0x5b, 0xff, 0xf9, 0x67, 0xbe, 0xbf, 0x3b, 0x19, 0x64, 0xd3, 0x05, + 0x9d, 0x8b, 0x19, 0x97, 0xdc, 0xe7, 0x13, 0x17, 0xd4, 0x90, 0xf8, 0x3e, 0x57, 0xa1, 0x04, 0x17, + 0xe4, 0x2c, 0x20, 0x53, 0x16, 0x8e, 0x9c, 0xd8, 0xc6, 0x66, 0xb6, 0xd3, 0xc9, 0x74, 0x36, 0x2e, + 0xf6, 0x33, 0xf4, 0xf7, 0x06, 0xd2, 0x8e, 0xf2, 0xe8, 0xb4, 0x1f, 0x83, 0xfb, 0xda, 0x7a, 0x12, + 0x94, 0xc8, 0x00, 0x3f, 0xa2, 0x6a, 0xda, 0x3e, 0x60, 0xd4, 0x34, 0x5a, 0x86, 0x5d, 0xee, 0x9c, + 0x3b, 0xfb, 0x72, 0x9d, 0x14, 0xd1, 0xa5, 0x5e, 0x05, 0x32, 0x0a, 0x2b, 0xd4, 0x54, 0x31, 0x96, + 0x0e, 0x44, 0x30, 0x13, 0x81, 0x54, 0x64, 0x32, 0x10, 0x1c, 0x98, 0x64, 0x3c, 0x04, 0x33, 0xdf, + 0x2a, 0xd8, 0xe5, 0xce, 0xed, 0x21, 0xe8, 0xde, 0x76, 0xbc, 0x97, 0x4c, 0x7b, 0xf5, 0x84, 0xfc, + 0xcb, 0x01, 0xcc, 0x50, 0x6d, 0x1b, 0x4b, 0x00, 0x02, 0x99, 0x89, 0x2c, 0xc4, 0x91, 0x57, 0x87, + 0x44, 0xde, 0xaf, 0x47, 0x75, 0xdc, 0x49, 0x42, 0xdc, 0xa9, 0x02, 0x6e, 0xa0, 0x12, 0x84, 0x44, + 0xc0, 0x98, 0x4b, 0xb3, 0xd8, 0x32, 0xec, 0x92, 0xa7, 0x75, 0xfb, 0x15, 0x35, 0xff, 0x79, 0x00, + 0x3e, 0x43, 0x95, 0x74, 0x29, 0xc9, 0xa2, 0xab, 0x5e, 0x59, 0xd7, 0xba, 0x74, 0x4d, 0x7f, 0x53, + 0x24, 0x94, 0x6a, 0xba, 0x5e, 0x96, 0x61, 0x17, 0x3c, 0xad, 0xdb, 0x3d, 0x54, 0xdb, 0xf3, 0xaf, + 0xb8, 0x8e, 0x4a, 0x9b, 0x77, 0x6b, 0xea, 0x71, 0xac, 0xff, 0x20, 0x16, 0x53, 0xe2, 0xc3, 0xf3, + 0xe7, 0xca, 0x32, 0x96, 0x2b, 0xcb, 0xf8, 0x5e, 0x59, 0xc6, 0x47, 0x64, 0xe5, 0x96, 0x91, 0x95, + 0xfb, 0x8a, 0xac, 0xdc, 0xcb, 0xdd, 0x88, 0xc9, 0xb1, 0x1a, 0x3a, 0x3e, 0x9f, 0xba, 0x3b, 0x57, + 0xf6, 0x7e, 0x73, 0xe9, 0x8f, 0x09, 0x0b, 0x5d, 0x5d, 0x99, 0xef, 0x5c, 0x9e, 0x5c, 0x88, 0x00, + 0x86, 0x47, 0xb1, 0x7b, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x00, 0x93, 0x3a, 0xe6, 0x02, + 0x00, 0x00, } func (m *StreamSubaccountUpdate) Marshal() (dAtA []byte, err error) { @@ -700,7 +700,7 @@ func (m *SubaccountPerpetualPosition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Quantums |= uint64(b&0x7F) << shift + m.Quantums |= int64(b&0x7F) << shift if b < 0x80 { break }