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

Harry/upgrade isolated to cross indexer #2596

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -1249,8 +1249,12 @@ export interface UpdateClobPairEventV1SDKType {
/**
* UpdatePerpetualEventV1 message contains all the information about an update
* to a perpetual on the dYdX chain.
* Deprecated. See UpdatePerpetualEventV2 for the most up to date message
* for the event to update a perpetual.
*/

/** @deprecated */

export interface UpdatePerpetualEventV1 {
/**
* Unique Perpetual id.
Expand Down Expand Up @@ -1288,8 +1292,12 @@ export interface UpdatePerpetualEventV1 {
/**
* UpdatePerpetualEventV1 message contains all the information about an update
* to a perpetual on the dYdX chain.
* Deprecated. See UpdatePerpetualEventV2 for the most up to date message
* for the event to update a perpetual.
*/

/** @deprecated */

export interface UpdatePerpetualEventV1SDKType {
/**
* Unique Perpetual id.
Expand Down Expand Up @@ -1324,6 +1332,90 @@ export interface UpdatePerpetualEventV1SDKType {

liquidity_tier: number;
}
/**
* UpdatePerpetualEventV2 message contains all the information about an update
* to a perpetual on the dYdX chain.
*/

export interface UpdatePerpetualEventV2 {
/**
* Unique Perpetual id.
* Defined in perpetuals.perpetual
*/
id: number;
/**
* The name of the `Perpetual` (e.g. `BTC-USD`).
* Defined in perpetuals.perpetual
*/

ticker: string;
/**
* Unique id of market param associated with this perpetual market.
* Defined in perpetuals.perpetual
*/

marketId: number;
/**
* The exponent for converting an atomic amount (`size = 1`)
* to a full coin. For example, if `AtomicResolution = -8`
* then a `PerpetualPosition` with `size = 1e8` is equivalent to
* a position size of one full coin.
* Defined in perpetuals.perpetual
*/

atomicResolution: number;
/**
* The liquidity_tier that this perpetual is associated with.
* Defined in perpetuals.perpetual
*/

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

marketType: PerpetualMarketType;
}
/**
* UpdatePerpetualEventV2 message contains all the information about an update
* to a perpetual on the dYdX chain.
*/

export interface UpdatePerpetualEventV2SDKType {
/**
* Unique Perpetual id.
* Defined in perpetuals.perpetual
*/
id: number;
/**
* The name of the `Perpetual` (e.g. `BTC-USD`).
* Defined in perpetuals.perpetual
*/

ticker: string;
/**
* Unique id of market param associated with this perpetual market.
* Defined in perpetuals.perpetual
*/

market_id: number;
/**
* The exponent for converting an atomic amount (`size = 1`)
* to a full coin. For example, if `AtomicResolution = -8`
* then a `PerpetualPosition` with `size = 1e8` is equivalent to
* a position size of one full coin.
* Defined in perpetuals.perpetual
*/

atomic_resolution: number;
/**
* The liquidity_tier that this perpetual is associated with.
* Defined in perpetuals.perpetual
*/

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

market_type: PerpetualMarketTypeSDKType;
}
/**
* TradingRewardsEventV1 is communicates all trading rewards for all accounts
* that receive trade rewards in the block.
Expand Down Expand Up @@ -3485,6 +3577,101 @@ export const UpdatePerpetualEventV1 = {

};

function createBaseUpdatePerpetualEventV2(): UpdatePerpetualEventV2 {
return {
id: 0,
ticker: "",
marketId: 0,
atomicResolution: 0,
liquidityTier: 0,
marketType: 0
};
}

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

if (message.ticker !== "") {
writer.uint32(18).string(message.ticker);
}

if (message.marketId !== 0) {
writer.uint32(24).uint32(message.marketId);
}

if (message.atomicResolution !== 0) {
writer.uint32(32).sint32(message.atomicResolution);
}

if (message.liquidityTier !== 0) {
writer.uint32(40).uint32(message.liquidityTier);
}

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

return writer;
},

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

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

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

case 2:
message.ticker = reader.string();
break;

case 3:
message.marketId = reader.uint32();
break;

case 4:
message.atomicResolution = reader.sint32();
break;

case 5:
message.liquidityTier = reader.uint32();
break;

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

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

return message;
},

fromPartial(object: DeepPartial<UpdatePerpetualEventV2>): UpdatePerpetualEventV2 {
const message = createBaseUpdatePerpetualEventV2();
message.id = object.id ?? 0;
message.ticker = object.ticker ?? "";
message.marketId = object.marketId ?? 0;
message.atomicResolution = object.atomicResolution ?? 0;
message.liquidityTier = object.liquidityTier ?? 0;
message.marketType = object.marketType ?? 0;
return message;
}

};

function createBaseTradingRewardsEventV1(): TradingRewardsEventV1 {
return {
tradingRewards: []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { MsgSetMarketsHardCap, MsgSetMarketsHardCapResponse, MsgCreateMarketPermissionless, MsgCreateMarketPermissionlessResponse, MsgSetListingVaultDepositParams, MsgSetListingVaultDepositParamsResponse } from "./tx";
import { MsgSetMarketsHardCap, MsgSetMarketsHardCapResponse, MsgCreateMarketPermissionless, MsgCreateMarketPermissionlessResponse, MsgSetListingVaultDepositParams, MsgSetListingVaultDepositParamsResponse, MsgUpgradeIsolatedPerpetualToCross, MsgUpgradeIsolatedPerpetualToCrossResponse } from "./tx";
/** Msg defines the Msg service. */

export interface Msg {
Expand All @@ -12,6 +12,12 @@ export interface Msg {
/** SetListingVaultDepositParams sets PML megavault deposit params */

setListingVaultDepositParams(request: MsgSetListingVaultDepositParams): Promise<MsgSetListingVaultDepositParamsResponse>;
/**
* UpgradeIsolatedPerpetualToCross upgrades a perpetual from isolated to cross
* margin
*/

upgradeIsolatedPerpetualToCross(request: MsgUpgradeIsolatedPerpetualToCross): Promise<MsgUpgradeIsolatedPerpetualToCrossResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
Expand All @@ -21,6 +27,7 @@ export class MsgClientImpl implements Msg {
this.setMarketsHardCap = this.setMarketsHardCap.bind(this);
this.createMarketPermissionless = this.createMarketPermissionless.bind(this);
this.setListingVaultDepositParams = this.setListingVaultDepositParams.bind(this);
this.upgradeIsolatedPerpetualToCross = this.upgradeIsolatedPerpetualToCross.bind(this);
}

setMarketsHardCap(request: MsgSetMarketsHardCap): Promise<MsgSetMarketsHardCapResponse> {
Expand All @@ -41,4 +48,10 @@ export class MsgClientImpl implements Msg {
return promise.then(data => MsgSetListingVaultDepositParamsResponse.decode(new _m0.Reader(data)));
}

upgradeIsolatedPerpetualToCross(request: MsgUpgradeIsolatedPerpetualToCross): Promise<MsgUpgradeIsolatedPerpetualToCrossResponse> {
const data = MsgUpgradeIsolatedPerpetualToCross.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.listing.Msg", "UpgradeIsolatedPerpetualToCross", data);
return promise.then(data => MsgUpgradeIsolatedPerpetualToCrossResponse.decode(new _m0.Reader(data)));
}

}
123 changes: 123 additions & 0 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,40 @@ export interface MsgSetListingVaultDepositParamsResponse {}
*/

export interface MsgSetListingVaultDepositParamsResponseSDKType {}
/**
* MsgUpgradeIsolatedPerpetualToCross is used to upgrade a market from
* isolated margin to cross margin.
*/

export interface MsgUpgradeIsolatedPerpetualToCross {
authority: string;
/** ID of the perpetual to be upgraded to CROSS */

perpetualId: number;
}
/**
* MsgUpgradeIsolatedPerpetualToCross is used to upgrade a market from
* isolated margin to cross margin.
*/

export interface MsgUpgradeIsolatedPerpetualToCrossSDKType {
authority: string;
/** ID of the perpetual to be upgraded to CROSS */

perpetual_id: number;
}
/**
* MsgUpgradeIsolatedPerpetualToCrossResponse defines the
* UpgradeIsolatedPerpetualToCross response type.
*/

export interface MsgUpgradeIsolatedPerpetualToCrossResponse {}
/**
* MsgUpgradeIsolatedPerpetualToCrossResponse defines the
* UpgradeIsolatedPerpetualToCross response type.
*/

export interface MsgUpgradeIsolatedPerpetualToCrossResponseSDKType {}

function createBaseMsgSetMarketsHardCap(): MsgSetMarketsHardCap {
return {
Expand Down Expand Up @@ -366,4 +400,93 @@ export const MsgSetListingVaultDepositParamsResponse = {
return message;
}

};

function createBaseMsgUpgradeIsolatedPerpetualToCross(): MsgUpgradeIsolatedPerpetualToCross {
return {
authority: "",
perpetualId: 0
};
}

export const MsgUpgradeIsolatedPerpetualToCross = {
encode(message: MsgUpgradeIsolatedPerpetualToCross, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.authority !== "") {
writer.uint32(10).string(message.authority);
}

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

return writer;
},

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

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

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

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

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

return message;
},

fromPartial(object: DeepPartial<MsgUpgradeIsolatedPerpetualToCross>): MsgUpgradeIsolatedPerpetualToCross {
const message = createBaseMsgUpgradeIsolatedPerpetualToCross();
message.authority = object.authority ?? "";
message.perpetualId = object.perpetualId ?? 0;
return message;
}

};

function createBaseMsgUpgradeIsolatedPerpetualToCrossResponse(): MsgUpgradeIsolatedPerpetualToCrossResponse {
return {};
}

export const MsgUpgradeIsolatedPerpetualToCrossResponse = {
encode(_: MsgUpgradeIsolatedPerpetualToCrossResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},

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

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

switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(_: DeepPartial<MsgUpgradeIsolatedPerpetualToCrossResponse>): MsgUpgradeIsolatedPerpetualToCrossResponse {
const message = createBaseMsgUpgradeIsolatedPerpetualToCrossResponse();
return message;
}

};
Loading
Loading