Skip to content

Commit

Permalink
Merge branch 'main' into jakob-dydx/final-settlement-endblocker
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-dydx committed Dec 20, 2023
2 parents 3071850 + ece92b4 commit c70b5e9
Show file tree
Hide file tree
Showing 37 changed files with 1,667 additions and 1,665 deletions.
8 changes: 6 additions & 2 deletions indexer/packages/compliance/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export const INDEXER_GEOBLOCKED_PAYLOAD = 'Because you appear to be a resident of, or trading from, a jurisdiction that violates our terms of use, or have engaged in activity that violates our terms of use, you have been blocked. You may withdraw your funds from the protocol at any time.';
export const INDEXER_COMPLIANCE_BLOCKED_PAYLOAD = 'Because this address appears to be a resident of, or trading from, a jurisdiction that violates our terms of use, or has engaged in activity that violates our terms of use, this address has been blocked.';
export const INDEXER_GEOBLOCKED_PAYLOAD: string = 'Because you appear to be a resident of, or trading from, a jurisdiction that violates our terms of use, or have engaged in activity that violates our terms of use, you have been blocked. You may withdraw your funds from the protocol at any time.';
export const INDEXER_COMPLIANCE_BLOCKED_PAYLOAD: string = 'Because this address appears to be a resident of, or trading from, a jurisdiction that violates our terms of use, or has engaged in activity that violates our terms of use, this address has been blocked.';

// For use by other services packages, can't be used to index on the actual requests
// object as that needs to be a string literal.
export const COUNTRY_HEADER_KEY: string = 'cf-ipcountry';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, AreSubaccountsLiquidatableRequest, AreSubaccountsLiquidatableResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse } from "./query";
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse } from "./query";
/** Query defines the gRPC querier service. */

export interface Query {
Expand All @@ -10,9 +10,6 @@ export interface Query {
/** Queries a list of ClobPair items. */

clobPairAll(request?: QueryAllClobPairRequest): Promise<QueryClobPairAllResponse>;
/** Returns whether a subaccount is liquidatable. */

areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse>;
/** Runs the MEV node <> node calculation with the provided parameters. */

mevNodeToNodeCalculation(request: MevNodeToNodeCalculationRequest): Promise<MevNodeToNodeCalculationResponse>;
Expand All @@ -33,7 +30,6 @@ export class QueryClientImpl implements Query {
this.rpc = rpc;
this.clobPair = this.clobPair.bind(this);
this.clobPairAll = this.clobPairAll.bind(this);
this.areSubaccountsLiquidatable = this.areSubaccountsLiquidatable.bind(this);
this.mevNodeToNodeCalculation = this.mevNodeToNodeCalculation.bind(this);
this.equityTierLimitConfiguration = this.equityTierLimitConfiguration.bind(this);
this.blockRateLimitConfiguration = this.blockRateLimitConfiguration.bind(this);
Expand All @@ -54,12 +50,6 @@ export class QueryClientImpl implements Query {
return promise.then(data => QueryClobPairAllResponse.decode(new _m0.Reader(data)));
}

areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse> {
const data = AreSubaccountsLiquidatableRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.clob.Query", "AreSubaccountsLiquidatable", data);
return promise.then(data => AreSubaccountsLiquidatableResponse.decode(new _m0.Reader(data)));
}

mevNodeToNodeCalculation(request: MevNodeToNodeCalculationRequest): Promise<MevNodeToNodeCalculationResponse> {
const data = MevNodeToNodeCalculationRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.clob.Query", "MevNodeToNodeCalculation", data);
Expand Down Expand Up @@ -97,10 +87,6 @@ export const createRpcQueryExtension = (base: QueryClient) => {
return queryService.clobPairAll(request);
},

areSubaccountsLiquidatable(request: AreSubaccountsLiquidatableRequest): Promise<AreSubaccountsLiquidatableResponse> {
return queryService.areSubaccountsLiquidatable(request);
},

mevNodeToNodeCalculation(request: MevNodeToNodeCalculationRequest): Promise<MevNodeToNodeCalculationResponse> {
return queryService.mevNodeToNodeCalculation(request);
},
Expand Down
192 changes: 0 additions & 192 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination";
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount";
import { ValidatorMevMatches, ValidatorMevMatchesSDKType, MevNodeToNodeMetrics, MevNodeToNodeMetricsSDKType } from "./mev";
import { ClobPair, ClobPairSDKType } from "./clob_pair";
import { EquityTierLimitConfiguration, EquityTierLimitConfigurationSDKType } from "./equity_tier_limit_config";
Expand Down Expand Up @@ -51,52 +50,6 @@ export interface QueryClobPairAllResponseSDKType {
clob_pair: ClobPairSDKType[];
pagination?: PageResponseSDKType;
}
/**
* AreSubaccountsLiquidatableRequest is a request message used to check whether
* the given subaccounts are liquidatable.
* The subaccount ids should not contain duplicates.
*/

export interface AreSubaccountsLiquidatableRequest {
subaccountIds: SubaccountId[];
}
/**
* AreSubaccountsLiquidatableRequest is a request message used to check whether
* the given subaccounts are liquidatable.
* The subaccount ids should not contain duplicates.
*/

export interface AreSubaccountsLiquidatableRequestSDKType {
subaccount_ids: SubaccountIdSDKType[];
}
/**
* AreSubaccountsLiquidatableResponse is a response message that contains the
* liquidation status for each subaccount.
*/

export interface AreSubaccountsLiquidatableResponse {
results: AreSubaccountsLiquidatableResponse_Result[];
}
/**
* AreSubaccountsLiquidatableResponse is a response message that contains the
* liquidation status for each subaccount.
*/

export interface AreSubaccountsLiquidatableResponseSDKType {
results: AreSubaccountsLiquidatableResponse_ResultSDKType[];
}
/** Result returns whether a subaccount should be liquidated. */

export interface AreSubaccountsLiquidatableResponse_Result {
subaccountId?: SubaccountId;
isLiquidatable: boolean;
}
/** Result returns whether a subaccount should be liquidated. */

export interface AreSubaccountsLiquidatableResponse_ResultSDKType {
subaccount_id?: SubaccountIdSDKType;
is_liquidatable: boolean;
}
/**
* MevNodeToNodeCalculationRequest is a request message used to run the
* MEV node <> node calculation.
Expand Down Expand Up @@ -436,151 +389,6 @@ export const QueryClobPairAllResponse = {

};

function createBaseAreSubaccountsLiquidatableRequest(): AreSubaccountsLiquidatableRequest {
return {
subaccountIds: []
};
}

export const AreSubaccountsLiquidatableRequest = {
encode(message: AreSubaccountsLiquidatableRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.subaccountIds) {
SubaccountId.encode(v!, writer.uint32(10).fork()).ldelim();
}

return writer;
},

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

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

switch (tag >>> 3) {
case 1:
message.subaccountIds.push(SubaccountId.decode(reader, reader.uint32()));
break;

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

return message;
},

fromPartial(object: DeepPartial<AreSubaccountsLiquidatableRequest>): AreSubaccountsLiquidatableRequest {
const message = createBaseAreSubaccountsLiquidatableRequest();
message.subaccountIds = object.subaccountIds?.map(e => SubaccountId.fromPartial(e)) || [];
return message;
}

};

function createBaseAreSubaccountsLiquidatableResponse(): AreSubaccountsLiquidatableResponse {
return {
results: []
};
}

export const AreSubaccountsLiquidatableResponse = {
encode(message: AreSubaccountsLiquidatableResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.results) {
AreSubaccountsLiquidatableResponse_Result.encode(v!, writer.uint32(10).fork()).ldelim();
}

return writer;
},

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

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

switch (tag >>> 3) {
case 1:
message.results.push(AreSubaccountsLiquidatableResponse_Result.decode(reader, reader.uint32()));
break;

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

return message;
},

fromPartial(object: DeepPartial<AreSubaccountsLiquidatableResponse>): AreSubaccountsLiquidatableResponse {
const message = createBaseAreSubaccountsLiquidatableResponse();
message.results = object.results?.map(e => AreSubaccountsLiquidatableResponse_Result.fromPartial(e)) || [];
return message;
}

};

function createBaseAreSubaccountsLiquidatableResponse_Result(): AreSubaccountsLiquidatableResponse_Result {
return {
subaccountId: undefined,
isLiquidatable: false
};
}

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

if (message.isLiquidatable === true) {
writer.uint32(16).bool(message.isLiquidatable);
}

return writer;
},

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

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

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

case 2:
message.isLiquidatable = reader.bool();
break;

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

return message;
},

fromPartial(object: DeepPartial<AreSubaccountsLiquidatableResponse_Result>): AreSubaccountsLiquidatableResponse_Result {
const message = createBaseAreSubaccountsLiquidatableResponse_Result();
message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined;
message.isLiquidatable = object.isLiquidatable ?? false;
return message;
}

};

function createBaseMevNodeToNodeCalculationRequest(): MevNodeToNodeCalculationRequest {
return {
blockProposerMatches: undefined,
Expand Down
Loading

0 comments on commit c70b5e9

Please sign in to comment.