Skip to content
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

[TRA-108] Add market type to indexer events. #1201

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
330 changes: 166 additions & 164 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IndexerSubaccountId, IndexerSubaccountIdSDKType, IndexerPerpetualPosition, IndexerPerpetualPositionSDKType, IndexerAssetPosition, IndexerAssetPositionSDKType } from "../protocol/v1/subaccount";
import { IndexerOrder, IndexerOrderSDKType, IndexerOrderId, IndexerOrderIdSDKType, ClobPairStatus, ClobPairStatusSDKType } from "../protocol/v1/clob";
import { OrderRemovalReason, OrderRemovalReasonSDKType } from "../shared/removal_reason";
import { PerpetualMarketType, PerpetualMarketTypeSDKType } from "../protocol/v1/perpetual";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial, Long } from "../../../helpers";
/** Type is the type for funding values. */
Expand Down Expand Up @@ -845,6 +846,9 @@ export interface PerpetualMarketCreateEventV1 {
*/

liquidityTier: number;
/** Market type of the perpetual. */

marketType: PerpetualMarketType;
}
/**
* PerpetualMarketCreateEventV1 message contains all the information about a
Expand Down Expand Up @@ -915,6 +919,9 @@ export interface PerpetualMarketCreateEventV1SDKType {
*/

liquidity_tier: number;
/** Market type of the perpetual. */

marketType: PerpetualMarketTypeSDKType;
}
/**
* LiquidityTierUpsertEventV1 message contains all the information to
Expand Down Expand Up @@ -2528,7 +2535,8 @@ function createBasePerpetualMarketCreateEventV1(): PerpetualMarketCreateEventV1
atomicResolution: 0,
subticksPerTick: 0,
stepBaseQuantums: Long.UZERO,
liquidityTier: 0
liquidityTier: 0,
marketType: 0
};
}

Expand Down Expand Up @@ -2574,6 +2582,10 @@ export const PerpetualMarketCreateEventV1 = {
writer.uint32(80).uint32(message.liquidityTier);
}

if (message.marketType !== 0) {
writer.uint32(88).int32(message.marketType);
}

return writer;
},

Expand Down Expand Up @@ -2626,6 +2638,10 @@ export const PerpetualMarketCreateEventV1 = {
message.liquidityTier = reader.uint32();
break;

case 11:
message.marketType = (reader.int32() as any);
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -2647,6 +2663,7 @@ export const PerpetualMarketCreateEventV1 = {
message.subticksPerTick = object.subticksPerTick ?? 0;
message.stepBaseQuantums = object.stepBaseQuantums !== undefined && object.stepBaseQuantums !== null ? Long.fromValue(object.stepBaseQuantums) : Long.UZERO;
message.liquidityTier = object.liquidityTier ?? 0;
message.marketType = object.marketType ?? 0;
return message;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Market type of perpetual.
* Defined in perpetual.
*/
export enum PerpetualMarketType {
/** PERPETUAL_MARKET_TYPE_UNSPECIFIED - Unspecified market type. */
PERPETUAL_MARKET_TYPE_UNSPECIFIED = 0,

/** PERPETUAL_MARKET_TYPE_CROSS - Market type for cross margin perpetual markets. */
PERPETUAL_MARKET_TYPE_CROSS = 1,

/** PERPETUAL_MARKET_TYPE_ISOLATED - Market type for isolated margin perpetual markets. */
PERPETUAL_MARKET_TYPE_ISOLATED = 2,
UNRECOGNIZED = -1,
}
/**
* Market type of perpetual.
* Defined in perpetual.
*/

export enum PerpetualMarketTypeSDKType {
/** PERPETUAL_MARKET_TYPE_UNSPECIFIED - Unspecified market type. */
PERPETUAL_MARKET_TYPE_UNSPECIFIED = 0,

/** PERPETUAL_MARKET_TYPE_CROSS - Market type for cross margin perpetual markets. */
PERPETUAL_MARKET_TYPE_CROSS = 1,

/** PERPETUAL_MARKET_TYPE_ISOLATED - Market type for isolated margin perpetual markets. */
PERPETUAL_MARKET_TYPE_ISOLATED = 2,
UNRECOGNIZED = -1,
}
export function perpetualMarketTypeFromJSON(object: any): PerpetualMarketType {
switch (object) {
case 0:
case "PERPETUAL_MARKET_TYPE_UNSPECIFIED":
return PerpetualMarketType.PERPETUAL_MARKET_TYPE_UNSPECIFIED;

case 1:
case "PERPETUAL_MARKET_TYPE_CROSS":
return PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS;

case 2:
case "PERPETUAL_MARKET_TYPE_ISOLATED":
return PerpetualMarketType.PERPETUAL_MARKET_TYPE_ISOLATED;

case -1:
case "UNRECOGNIZED":
default:
return PerpetualMarketType.UNRECOGNIZED;
}
}
export function perpetualMarketTypeToJSON(object: PerpetualMarketType): string {
switch (object) {
case PerpetualMarketType.PERPETUAL_MARKET_TYPE_UNSPECIFIED:
return "PERPETUAL_MARKET_TYPE_UNSPECIFIED";

case PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS:
return "PERPETUAL_MARKET_TYPE_CROSS";

case PerpetualMarketType.PERPETUAL_MARKET_TYPE_ISOLATED:
return "PERPETUAL_MARKET_TYPE_ISOLATED";

case PerpetualMarketType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
4 changes: 2 additions & 2 deletions indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as _102 from "./gogo";
export const gogoproto = { ..._102
import * as _103 from "./gogo";
export const gogoproto = { ..._103
};
22 changes: 11 additions & 11 deletions indexer/packages/v4-protos/src/codegen/google/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as _103 from "./api/annotations";
import * as _104 from "./api/http";
import * as _105 from "./protobuf/descriptor";
import * as _106 from "./protobuf/duration";
import * as _107 from "./protobuf/timestamp";
import * as _108 from "./protobuf/any";
import * as _104 from "./api/annotations";
import * as _105 from "./api/http";
import * as _106 from "./protobuf/descriptor";
import * as _107 from "./protobuf/duration";
import * as _108 from "./protobuf/timestamp";
import * as _109 from "./protobuf/any";
export namespace google {
export const api = { ..._103,
..._104
export const api = { ..._104,
..._105
};
export const protobuf = { ..._105,
..._106,
export const protobuf = { ..._106,
..._107,
..._108
..._108,
..._109
};
}
2 changes: 2 additions & 0 deletions indexer/services/ender/__tests__/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
OrderFillEventV1,
OrderRemovalReason,
PerpetualMarketCreateEventV1,
PerpetualMarketType,
StatefulOrderEventV1,
SubaccountMessage,
SubaccountUpdateEventV1,
Expand Down Expand Up @@ -138,6 +139,7 @@ export const defaultPerpetualMarketCreateEvent: PerpetualMarketCreateEventV1 = {
subticksPerTick: 100,
stepBaseQuantums: Long.fromValue(10, true),
liquidityTier: 0,
marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS,
};

export const defaultLiquidityTierUpsertEvent: LiquidityTierUpsertEventV1 = {
Expand Down
4 changes: 4 additions & 0 deletions proto/dydxprotocol/indexer/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "dydxprotocol/indexer/shared/removal_reason.proto";
import "dydxprotocol/indexer/protocol/v1/clob.proto";
import "dydxprotocol/indexer/protocol/v1/perpetual.proto";
import "dydxprotocol/indexer/protocol/v1/subaccount.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/indexer/events";
Expand Down Expand Up @@ -352,6 +353,9 @@ message PerpetualMarketCreateEventV1 {
// The liquidity_tier that this perpetual is associated with.
// Defined in perpetuals.perpetual
uint32 liquidity_tier = 10;

// Market type of the perpetual.
dydxprotocol.indexer.protocol.v1.PerpetualMarketType market_type = 11;
}

// LiquidityTierUpsertEventV1 message contains all the information to
Expand Down
17 changes: 17 additions & 0 deletions proto/dydxprotocol/indexer/protocol/v1/perpetual.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package dydxprotocol.indexer.protocol.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types";

// Market type of perpetual.
// Defined in perpetual.
enum PerpetualMarketType {
// Unspecified market type.
PERPETUAL_MARKET_TYPE_UNSPECIFIED = 0;
// Market type for cross margin perpetual markets.
PERPETUAL_MARKET_TYPE_CROSS = 1;
// Market type for isolated margin perpetual markets.
PERPETUAL_MARKET_TYPE_ISOLATED = 2;
}
Loading
Loading