Skip to content

Commit

Permalink
register deprecated MsgSetVaultQuotingParams
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 committed Sep 27, 2024
1 parent 7193a10 commit 49a66f2
Show file tree
Hide file tree
Showing 9 changed files with 771 additions and 360 deletions.
259 changes: 178 additions & 81 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,32 +184,6 @@ export interface MsgUnlockSharesResponseSDKType {
/** The number of shares unlocked. */
unlocked_shares?: NumSharesSDKType;
}
/**
* MsgUpdateParams is the Msg/UpdateParams request type.
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
*/

/** @deprecated */

export interface MsgUpdateParams {
authority: string;
/** The parameters to update. Each field must be set. */

params?: Params;
}
/**
* MsgUpdateParams is the Msg/UpdateParams request type.
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
*/

/** @deprecated */

export interface MsgUpdateParamsSDKType {
authority: string;
/** The parameters to update. Each field must be set. */

params?: ParamsSDKType;
}
/** MsgUpdateOperatorParams is the Msg/UpdateOperatorParams request type. */

export interface MsgUpdateOperatorParams {
Expand Down Expand Up @@ -288,6 +262,64 @@ export interface MsgRetrieveFromVaultResponse {}
/** MsgRetrieveFromVaultResponse is the Msg/RetrieveFromVault response type. */

export interface MsgRetrieveFromVaultResponseSDKType {}
/**
* MsgUpdateParams is the Msg/UpdateParams request type.
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
*/

/** @deprecated */

export interface MsgUpdateParams {
authority: string;
/** The parameters to update. Each field must be set. */

params?: Params;
}
/**
* MsgUpdateParams is the Msg/UpdateParams request type.
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
*/

/** @deprecated */

export interface MsgUpdateParamsSDKType {
authority: string;
/** The parameters to update. Each field must be set. */

params?: ParamsSDKType;
}
/**
* MsgSetVaultQuotingParams is the Msg/SetVaultQuotingParams request type.
* Deprecated since v6.x as is replaced by MsgSetVaultParams.
*/

/** @deprecated */

export interface MsgSetVaultQuotingParams {
authority: string;
/** The vault to set quoting params of. */

vaultId?: VaultId;
/** The quoting parameters to set. Each field must be set. */

quotingParams?: QuotingParams;
}
/**
* MsgSetVaultQuotingParams is the Msg/SetVaultQuotingParams request type.
* Deprecated since v6.x as is replaced by MsgSetVaultParams.
*/

/** @deprecated */

export interface MsgSetVaultQuotingParamsSDKType {
authority: string;
/** The vault to set quoting params of. */

vault_id?: VaultIdSDKType;
/** The quoting parameters to set. Each field must be set. */

quoting_params?: QuotingParamsSDKType;
}

function createBaseMsgDepositToMegavault(): MsgDepositToMegavault {
return {
Expand Down Expand Up @@ -787,61 +819,6 @@ export const MsgUnlockSharesResponse = {

};

function createBaseMsgUpdateParams(): MsgUpdateParams {
return {
authority: "",
params: undefined
};
}

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

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

return writer;
},

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

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

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

case 2:
message.params = Params.decode(reader, reader.uint32());
break;

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

return message;
},

fromPartial(object: DeepPartial<MsgUpdateParams>): MsgUpdateParams {
const message = createBaseMsgUpdateParams();
message.authority = object.authority ?? "";
message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
return message;
}

};

function createBaseMsgUpdateOperatorParams(): MsgUpdateOperatorParams {
return {
authority: "",
Expand Down Expand Up @@ -1127,4 +1104,124 @@ export const MsgRetrieveFromVaultResponse = {
return message;
}

};

function createBaseMsgUpdateParams(): MsgUpdateParams {
return {
authority: "",
params: undefined
};
}

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

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

return writer;
},

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

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

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

case 2:
message.params = Params.decode(reader, reader.uint32());
break;

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

return message;
},

fromPartial(object: DeepPartial<MsgUpdateParams>): MsgUpdateParams {
const message = createBaseMsgUpdateParams();
message.authority = object.authority ?? "";
message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
return message;
}

};

function createBaseMsgSetVaultQuotingParams(): MsgSetVaultQuotingParams {
return {
authority: "",
vaultId: undefined,
quotingParams: undefined
};
}

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

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

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

return writer;
},

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

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

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

case 2:
message.vaultId = VaultId.decode(reader, reader.uint32());
break;

case 3:
message.quotingParams = QuotingParams.decode(reader, reader.uint32());
break;

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

return message;
},

fromPartial(object: DeepPartial<MsgSetVaultQuotingParams>): MsgSetVaultQuotingParams {
const message = createBaseMsgSetVaultQuotingParams();
message.authority = object.authority ?? "";
message.vaultId = object.vaultId !== undefined && object.vaultId !== null ? VaultId.fromPartial(object.vaultId) : undefined;
message.quotingParams = object.quotingParams !== undefined && object.quotingParams !== null ? QuotingParams.fromPartial(object.quotingParams) : undefined;
return message;
}

};
39 changes: 27 additions & 12 deletions proto/dydxprotocol/vault/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,6 @@ message MsgUnlockSharesResponse {
NumShares unlocked_shares = 1 [ (gogoproto.nullable) = false ];
}

// MsgUpdateParams is the Msg/UpdateParams request type.
// Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
message MsgUpdateParams {
option deprecated = true;
// Authority is the address that controls the module.
option (cosmos.msg.v1.signer) = "authority";
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The parameters to update. Each field must be set.
Params params = 2 [ (gogoproto.nullable) = false ];
}

// MsgUpdateOperatorParams is the Msg/UpdateOperatorParams request type.
message MsgUpdateOperatorParams {
// Authority is the address that controls the module.
Expand Down Expand Up @@ -214,3 +202,30 @@ message MsgRetrieveFromVault {

// MsgRetrieveFromVaultResponse is the Msg/RetrieveFromVault response type.
message MsgRetrieveFromVaultResponse {}

// MsgUpdateParams is the Msg/UpdateParams request type.
// Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
message MsgUpdateParams {
option deprecated = true;
// Authority is the address that controls the module.
option (cosmos.msg.v1.signer) = "authority";
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The parameters to update. Each field must be set.
Params params = 2 [ (gogoproto.nullable) = false ];
}

// MsgSetVaultQuotingParams is the Msg/SetVaultQuotingParams request type.
// Deprecated since v6.x as is replaced by MsgSetVaultParams.
message MsgSetVaultQuotingParams {
option deprecated = true;
// Authority is the address that controls the module.
option (cosmos.msg.v1.signer) = "authority";
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The vault to set quoting params of.
VaultId vault_id = 2 [ (gogoproto.nullable) = false ];

// The quoting parameters to set. Each field must be set.
QuotingParams quoting_params = 3 [ (gogoproto.nullable) = false ];
}
3 changes: 2 additions & 1 deletion protocol/app/msgs/all_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,14 @@ var (
"/dydxprotocol.vault.MsgRetrieveFromVaultResponse": {},
"/dydxprotocol.vault.MsgSetVaultParams": {},
"/dydxprotocol.vault.MsgSetVaultParamsResponse": {},
"/dydxprotocol.vault.MsgSetVaultQuotingParams": {}, // deprecated
"/dydxprotocol.vault.MsgUnlockShares": {},
"/dydxprotocol.vault.MsgUnlockSharesResponse": {},
"/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": {},
"/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": {},
"/dydxprotocol.vault.MsgUpdateOperatorParams": {},
"/dydxprotocol.vault.MsgUpdateOperatorParamsResponse": {},
"/dydxprotocol.vault.MsgUpdateParams": {},
"/dydxprotocol.vault.MsgUpdateParams": {}, // deprecated
"/dydxprotocol.vault.MsgWithdrawFromMegavault": {},
"/dydxprotocol.vault.MsgWithdrawFromMegavaultResponse": {},

Expand Down
3 changes: 3 additions & 0 deletions protocol/app/msgs/unsupported_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var (
"/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse": nil,

// vault
// MsgSetVaultQuotingParams is deprecated since v6.x and replaced by MsgSetVaultParams.
// nolint:staticcheck
"/dydxprotocol.vault.MsgSetVaultQuotingParams": &vaulttypes.MsgSetVaultQuotingParams{},
// MsgUpdateParams is deprecated since v6.x and replaced by MsgUpdateDefaultQuotingParams.
// nolint:staticcheck
"/dydxprotocol.vault.MsgUpdateParams": &vaulttypes.MsgUpdateParams{},
Expand Down
1 change: 1 addition & 0 deletions protocol/app/msgs/unsupported_msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestUnsupportedMsgSamples_Key(t *testing.T) {
"/cosmos.gov.v1beta1.MsgSubmitProposal",
"/cosmos.gov.v1beta1.MsgSubmitProposalResponse",

"/dydxprotocol.vault.MsgSetVaultQuotingParams",
"/dydxprotocol.vault.MsgUpdateParams",

// ICA Controller messages
Expand Down
2 changes: 2 additions & 0 deletions protocol/lib/ante/nested_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func TestIsDydxMsg_Invalid(t *testing.T) {
appmsgs.NormalMsgsDydxCustom,
appmsgs.InternalMsgSamplesDydxCustom,
map[string]sdk.Msg{
// nolint:staticcheck
"/dydxprotocol.vault.MsgSetVaultQuotingParams": &vaulttypes.MsgSetVaultQuotingParams{},
// nolint:staticcheck
"/dydxprotocol.vault.MsgUpdateParams": &vaulttypes.MsgUpdateParams{},
},
Expand Down
2 changes: 2 additions & 0 deletions protocol/lib/ante/unsupported_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func IsUnsupportedMsg(msg sdk.Msg) bool {
// ------- dYdX custom modules
// vault
// nolint:staticcheck
*vaulttypes.MsgSetVaultQuotingParams,
// nolint:staticcheck
*vaulttypes.MsgUpdateParams:
return true
}
Expand Down
Loading

0 comments on commit 49a66f2

Please sign in to comment.