Skip to content

Commit

Permalink
add gov msg that sets vault quoting params
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 committed Aug 2, 2024
1 parent b1cb4d0 commit addac5b
Show file tree
Hide file tree
Showing 15 changed files with 1,154 additions and 42 deletions.
128 changes: 128 additions & 0 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/order.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount";
import { PerpetualLiquidationInfo, PerpetualLiquidationInfoSDKType } from "./liquidations";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial, Long } from "../../helpers";
/**
Expand Down Expand Up @@ -700,6 +701,48 @@ export interface TransactionOrderingSDKType {

transaction_index: number;
}
/**
* StreamLiquidationOrder represents an protocol-generated IOC liquidation order.
* Used in full node streaming.
*/

export interface StreamLiquidationOrder {
/** Information about this liquidation order. */
liquidationInfo?: PerpetualLiquidationInfo;
/** CLOB pair ID of the CLOB pair the liquidation order will be matched against. */

clobPairId: number;
/** True if this is a buy order liquidating a short position, false if vice versa. */

isBuy: boolean;
/** The number of base quantums for this liquidation order. */

quantums: Long;
/** The subticks this liquidation order will be submitted at. */

subticks: Long;
}
/**
* StreamLiquidationOrder represents an protocol-generated IOC liquidation order.
* Used in full node streaming.
*/

export interface StreamLiquidationOrderSDKType {
/** Information about this liquidation order. */
liquidation_info?: PerpetualLiquidationInfoSDKType;
/** CLOB pair ID of the CLOB pair the liquidation order will be matched against. */

clob_pair_id: number;
/** True if this is a buy order liquidating a short position, false if vice versa. */

is_buy: boolean;
/** The number of base quantums for this liquidation order. */

quantums: Long;
/** The subticks this liquidation order will be submitted at. */

subticks: Long;
}

function createBaseOrderId(): OrderId {
return {
Expand Down Expand Up @@ -1284,4 +1327,89 @@ export const TransactionOrdering = {
return message;
}

};

function createBaseStreamLiquidationOrder(): StreamLiquidationOrder {
return {
liquidationInfo: undefined,
clobPairId: 0,
isBuy: false,
quantums: Long.UZERO,
subticks: Long.UZERO
};
}

export const StreamLiquidationOrder = {
encode(message: StreamLiquidationOrder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.liquidationInfo !== undefined) {
PerpetualLiquidationInfo.encode(message.liquidationInfo, writer.uint32(10).fork()).ldelim();
}

if (message.clobPairId !== 0) {
writer.uint32(16).uint32(message.clobPairId);
}

if (message.isBuy === true) {
writer.uint32(24).bool(message.isBuy);
}

if (!message.quantums.isZero()) {
writer.uint32(32).uint64(message.quantums);
}

if (!message.subticks.isZero()) {
writer.uint32(40).uint64(message.subticks);
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): StreamLiquidationOrder {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseStreamLiquidationOrder();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.liquidationInfo = PerpetualLiquidationInfo.decode(reader, reader.uint32());
break;

case 2:
message.clobPairId = reader.uint32();
break;

case 3:
message.isBuy = reader.bool();
break;

case 4:
message.quantums = (reader.uint64() as Long);
break;

case 5:
message.subticks = (reader.uint64() as Long);
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<StreamLiquidationOrder>): StreamLiquidationOrder {
const message = createBaseStreamLiquidationOrder();
message.liquidationInfo = object.liquidationInfo !== undefined && object.liquidationInfo !== null ? PerpetualLiquidationInfo.fromPartial(object.liquidationInfo) : undefined;
message.clobPairId = object.clobPairId ?? 0;
message.isBuy = object.isBuy ?? false;
message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO;
message.subticks = object.subticks !== undefined && object.subticks !== null ? Long.fromValue(object.subticks) : Long.UZERO;
return message;
}

};
214 changes: 213 additions & 1 deletion indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination";
import { ValidatorMevMatches, ValidatorMevMatchesSDKType, MevNodeToNodeMetrics, MevNodeToNodeMetricsSDKType } from "./mev";
import { OrderId, OrderIdSDKType, LongTermOrderPlacement, LongTermOrderPlacementSDKType, Order, OrderSDKType } from "./order";
import { OrderId, OrderIdSDKType, LongTermOrderPlacement, LongTermOrderPlacementSDKType, Order, OrderSDKType, StreamLiquidationOrder, StreamLiquidationOrderSDKType } from "./order";
import { ClobPair, ClobPairSDKType } from "./clob_pair";
import { EquityTierLimitConfiguration, EquityTierLimitConfigurationSDKType } from "./equity_tier_limit_config";
import { BlockRateLimitConfiguration, BlockRateLimitConfigurationSDKType } from "./block_rate_limit_config";
Expand Down Expand Up @@ -391,6 +391,88 @@ export interface StreamOrderbookFillSDKType {

fill_amounts: Long[];
}
/**
* StreamTakerOrder provides information on a taker order that was attempted
* to be matched on the orderbook.
* It is intended to be used only in full node streaming.
*/

export interface StreamTakerOrder {
order?: Order;
liquidationOrder?: StreamLiquidationOrder;
/**
* Information on the taker order after it is matched on the book,
* either successfully or unsuccessfully.
*/

takerOrderStatus?: StreamTakerOrderStatus;
}
/**
* StreamTakerOrder provides information on a taker order that was attempted
* to be matched on the orderbook.
* It is intended to be used only in full node streaming.
*/

export interface StreamTakerOrderSDKType {
order?: OrderSDKType;
liquidation_order?: StreamLiquidationOrderSDKType;
/**
* Information on the taker order after it is matched on the book,
* either successfully or unsuccessfully.
*/

taker_order_status?: StreamTakerOrderStatusSDKType;
}
/**
* StreamTakerOrderStatus is a representation of a taker order
* after it is attempted to be matched on the orderbook.
* It is intended to be used only in full node streaming.
*/

export interface StreamTakerOrderStatus {
/**
* The state of the taker order after attempting to match it against the orderbook.
* Possible enum values can be found here:
* https://github.com/dydxprotocol/v4-chain/blob/main/protocol/x/clob/types/orderbook.go#L105
*/
orderStatus: number;
/** The amount of remaining (non-matched) base quantums of this taker order. */

remainingQuantums: Long;
/**
* The amount of base quantums that were *optimistically* filled for this taker order
* when the order is matched against the orderbook. Note that if any quantums of this order
* were optimistically filled or filled in state before this invocation of the matching loop,
* this value will not include them.
*/

optimisticallyFilledQuantums: Long;
}
/**
* StreamTakerOrderStatus is a representation of a taker order
* after it is attempted to be matched on the orderbook.
* It is intended to be used only in full node streaming.
*/

export interface StreamTakerOrderStatusSDKType {
/**
* The state of the taker order after attempting to match it against the orderbook.
* Possible enum values can be found here:
* https://github.com/dydxprotocol/v4-chain/blob/main/protocol/x/clob/types/orderbook.go#L105
*/
order_status: number;
/** The amount of remaining (non-matched) base quantums of this taker order. */

remaining_quantums: Long;
/**
* The amount of base quantums that were *optimistically* filled for this taker order
* when the order is matched against the orderbook. Note that if any quantums of this order
* were optimistically filled or filled in state before this invocation of the matching loop,
* this value will not include them.
*/

optimistically_filled_quantums: Long;
}

function createBaseQueryGetClobPairRequest(): QueryGetClobPairRequest {
return {
Expand Down Expand Up @@ -1401,4 +1483,134 @@ export const StreamOrderbookFill = {
return message;
}

};

function createBaseStreamTakerOrder(): StreamTakerOrder {
return {
order: undefined,
liquidationOrder: undefined,
takerOrderStatus: undefined
};
}

export const StreamTakerOrder = {
encode(message: StreamTakerOrder, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.order !== undefined) {
Order.encode(message.order, writer.uint32(10).fork()).ldelim();
}

if (message.liquidationOrder !== undefined) {
StreamLiquidationOrder.encode(message.liquidationOrder, writer.uint32(18).fork()).ldelim();
}

if (message.takerOrderStatus !== undefined) {
StreamTakerOrderStatus.encode(message.takerOrderStatus, writer.uint32(26).fork()).ldelim();
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): StreamTakerOrder {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseStreamTakerOrder();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.order = Order.decode(reader, reader.uint32());
break;

case 2:
message.liquidationOrder = StreamLiquidationOrder.decode(reader, reader.uint32());
break;

case 3:
message.takerOrderStatus = StreamTakerOrderStatus.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<StreamTakerOrder>): StreamTakerOrder {
const message = createBaseStreamTakerOrder();
message.order = object.order !== undefined && object.order !== null ? Order.fromPartial(object.order) : undefined;
message.liquidationOrder = object.liquidationOrder !== undefined && object.liquidationOrder !== null ? StreamLiquidationOrder.fromPartial(object.liquidationOrder) : undefined;
message.takerOrderStatus = object.takerOrderStatus !== undefined && object.takerOrderStatus !== null ? StreamTakerOrderStatus.fromPartial(object.takerOrderStatus) : undefined;
return message;
}

};

function createBaseStreamTakerOrderStatus(): StreamTakerOrderStatus {
return {
orderStatus: 0,
remainingQuantums: Long.UZERO,
optimisticallyFilledQuantums: Long.UZERO
};
}

export const StreamTakerOrderStatus = {
encode(message: StreamTakerOrderStatus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.orderStatus !== 0) {
writer.uint32(8).uint32(message.orderStatus);
}

if (!message.remainingQuantums.isZero()) {
writer.uint32(16).uint64(message.remainingQuantums);
}

if (!message.optimisticallyFilledQuantums.isZero()) {
writer.uint32(24).uint64(message.optimisticallyFilledQuantums);
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): StreamTakerOrderStatus {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseStreamTakerOrderStatus();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.orderStatus = reader.uint32();
break;

case 2:
message.remainingQuantums = (reader.uint64() as Long);
break;

case 3:
message.optimisticallyFilledQuantums = (reader.uint64() as Long);
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<StreamTakerOrderStatus>): StreamTakerOrderStatus {
const message = createBaseStreamTakerOrderStatus();
message.orderStatus = object.orderStatus ?? 0;
message.remainingQuantums = object.remainingQuantums !== undefined && object.remainingQuantums !== null ? Long.fromValue(object.remainingQuantums) : Long.UZERO;
message.optimisticallyFilledQuantums = object.optimisticallyFilledQuantums !== undefined && object.optimisticallyFilledQuantums !== null ? Long.fromValue(object.optimisticallyFilledQuantums) : Long.UZERO;
return message;
}

};
Loading

0 comments on commit addac5b

Please sign in to comment.