Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream' into eric/protocol-feature-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Warehime committed Mar 20, 2024
2 parents 11f78d6 + 9888453 commit cd44954
Show file tree
Hide file tree
Showing 95 changed files with 1,785 additions and 904 deletions.
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
Expand Up @@ -10,7 +10,11 @@ export interface BlockRateLimitConfiguration {
* configurations.
*
* Specifying 0 values disables this rate limit.
* Deprecated in favor of `max_short_term_orders_and_cancels_per_n_blocks`
* for v5.x onwards.
*/

/** @deprecated */
maxShortTermOrdersPerNBlocks: MaxPerNBlocksRateLimit[];
/**
* How many stateful order attempts (successful and failed) are allowed for
Expand All @@ -22,7 +26,10 @@ export interface BlockRateLimitConfiguration {
*/

maxStatefulOrdersPerNBlocks: MaxPerNBlocksRateLimit[];
/** @deprecated */

maxShortTermOrderCancellationsPerNBlocks: MaxPerNBlocksRateLimit[];
maxShortTermOrdersAndCancelsPerNBlocks: MaxPerNBlocksRateLimit[];
}
/** Defines the block rate limits for CLOB specific operations. */

Expand All @@ -34,7 +41,11 @@ export interface BlockRateLimitConfigurationSDKType {
* configurations.
*
* Specifying 0 values disables this rate limit.
* Deprecated in favor of `max_short_term_orders_and_cancels_per_n_blocks`
* for v5.x onwards.
*/

/** @deprecated */
max_short_term_orders_per_n_blocks: MaxPerNBlocksRateLimitSDKType[];
/**
* How many stateful order attempts (successful and failed) are allowed for
Expand All @@ -46,7 +57,10 @@ export interface BlockRateLimitConfigurationSDKType {
*/

max_stateful_orders_per_n_blocks: MaxPerNBlocksRateLimitSDKType[];
/** @deprecated */

max_short_term_order_cancellations_per_n_blocks: MaxPerNBlocksRateLimitSDKType[];
max_short_term_orders_and_cancels_per_n_blocks: MaxPerNBlocksRateLimitSDKType[];
}
/** Defines a rate limit over a specific number of blocks. */

Expand Down Expand Up @@ -83,7 +97,8 @@ function createBaseBlockRateLimitConfiguration(): BlockRateLimitConfiguration {
return {
maxShortTermOrdersPerNBlocks: [],
maxStatefulOrdersPerNBlocks: [],
maxShortTermOrderCancellationsPerNBlocks: []
maxShortTermOrderCancellationsPerNBlocks: [],
maxShortTermOrdersAndCancelsPerNBlocks: []
};
}

Expand All @@ -101,6 +116,10 @@ export const BlockRateLimitConfiguration = {
MaxPerNBlocksRateLimit.encode(v!, writer.uint32(26).fork()).ldelim();
}

for (const v of message.maxShortTermOrdersAndCancelsPerNBlocks) {
MaxPerNBlocksRateLimit.encode(v!, writer.uint32(34).fork()).ldelim();
}

return writer;
},

Expand All @@ -125,6 +144,10 @@ export const BlockRateLimitConfiguration = {
message.maxShortTermOrderCancellationsPerNBlocks.push(MaxPerNBlocksRateLimit.decode(reader, reader.uint32()));
break;

case 4:
message.maxShortTermOrdersAndCancelsPerNBlocks.push(MaxPerNBlocksRateLimit.decode(reader, reader.uint32()));
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -139,6 +162,7 @@ export const BlockRateLimitConfiguration = {
message.maxShortTermOrdersPerNBlocks = object.maxShortTermOrdersPerNBlocks?.map(e => MaxPerNBlocksRateLimit.fromPartial(e)) || [];
message.maxStatefulOrdersPerNBlocks = object.maxStatefulOrdersPerNBlocks?.map(e => MaxPerNBlocksRateLimit.fromPartial(e)) || [];
message.maxShortTermOrderCancellationsPerNBlocks = object.maxShortTermOrderCancellationsPerNBlocks?.map(e => MaxPerNBlocksRateLimit.fromPartial(e)) || [];
message.maxShortTermOrdersAndCancelsPerNBlocks = object.maxShortTermOrdersAndCancelsPerNBlocks?.map(e => MaxPerNBlocksRateLimit.fromPartial(e)) || [];
return message;
}

Expand Down
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. */

market_type: 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
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ describe('addresses-controller#V4', () => {
size: '9500',
side: PositionSide.LONG,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
},
[testConstants.defaultAsset2.symbol]: {
symbol: testConstants.defaultAsset2.symbol,
size: testConstants.defaultAssetPosition2.size,
side: PositionSide.SHORT,
assetId: testConstants.defaultAssetPosition2.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
},
},
},
Expand Down Expand Up @@ -162,6 +164,7 @@ describe('addresses-controller#V4', () => {
size: testConstants.defaultAssetPosition.size,
side: PositionSide.LONG,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
},
},
},
Expand Down Expand Up @@ -270,12 +273,14 @@ describe('addresses-controller#V4', () => {
size: '9500',
side: PositionSide.LONG,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
},
[testConstants.defaultAsset2.symbol]: {
symbol: testConstants.defaultAsset2.symbol,
size: testConstants.defaultAssetPosition2.size,
side: PositionSide.SHORT,
assetId: testConstants.defaultAssetPosition2.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('asset-positions-controller#V4', () => {
side: PositionSide.LONG,
size,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
};

expect(response.body.positions).toEqual(
Expand Down Expand Up @@ -75,6 +76,7 @@ describe('asset-positions-controller#V4', () => {
side: PositionSide.SHORT,
size: testConstants.defaultAssetPosition.size,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
};

expect(response.body.positions).toEqual(
Expand Down Expand Up @@ -110,6 +112,7 @@ describe('asset-positions-controller#V4', () => {
size: testConstants.defaultAssetPosition.size,
side: PositionSide.LONG,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
}],
);
});
Expand Down Expand Up @@ -154,6 +157,7 @@ describe('asset-positions-controller#V4', () => {
size: '9500',
side: PositionSide.LONG,
assetId: testConstants.defaultAssetPosition.assetId,
subaccountNumber: testConstants.defaultSubaccount.subaccountNumber,
}],
);
});
Expand Down
Loading

0 comments on commit cd44954

Please sign in to comment.