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

include operator params in vault params query #2281

Merged
merged 2 commits into from
Sep 17, 2024
Merged
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
@@ -1,6 +1,6 @@
import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType } from "./vault";
import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination";
import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType, VaultParams, VaultParamsSDKType } from "./params";
import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType, OperatorParams, OperatorParamsSDKType, VaultParams, VaultParamsSDKType } from "./params";
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount";
import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share";
import * as _m0 from "protobufjs/minimal";
Expand All @@ -19,6 +19,7 @@ export interface QueryParamsResponse {
/** @deprecated */
params?: Params;
defaultQuotingParams?: QuotingParams;
operatorParams?: OperatorParams;
}
/** QueryParamsResponse is a response type for the Params RPC method. */

Expand All @@ -28,6 +29,7 @@ export interface QueryParamsResponseSDKType {
/** @deprecated */
params?: ParamsSDKType;
default_quoting_params?: QuotingParamsSDKType;
operator_params?: OperatorParamsSDKType;
}
/** QueryVaultRequest is a request type for the Vault RPC method. */

Expand Down Expand Up @@ -189,7 +191,8 @@ export const QueryParamsRequest = {
function createBaseQueryParamsResponse(): QueryParamsResponse {
return {
params: undefined,
defaultQuotingParams: undefined
defaultQuotingParams: undefined,
operatorParams: undefined
};
}

Expand All @@ -203,6 +206,10 @@ export const QueryParamsResponse = {
QuotingParams.encode(message.defaultQuotingParams, writer.uint32(18).fork()).ldelim();
}

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

return writer;
},

Expand All @@ -223,6 +230,10 @@ export const QueryParamsResponse = {
message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32());
break;

case 3:
message.operatorParams = OperatorParams.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -236,6 +247,7 @@ export const QueryParamsResponse = {
const message = createBaseQueryParamsResponse();
message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined;
message.operatorParams = object.operatorParams !== undefined && object.operatorParams !== null ? OperatorParams.fromPartial(object.operatorParams) : undefined;
return message;
}

Expand Down
1 change: 1 addition & 0 deletions proto/dydxprotocol/vault/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ message QueryParamsResponse {
// Deprecated since v6.x in favor of default_quoting_params.
Params params = 1 [ (gogoproto.nullable) = false, deprecated = true ];
QuotingParams default_quoting_params = 2 [ (gogoproto.nullable) = false ];
OperatorParams operator_params = 3 [ (gogoproto.nullable) = false ];
}

// QueryVaultRequest is a request type for the Vault RPC method.
Expand Down
1 change: 1 addition & 0 deletions protocol/x/vault/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*t

return &types.QueryParamsResponse{
DefaultQuotingParams: k.GetDefaultQuotingParams(ctx),
OperatorParams: k.GetOperatorParams(ctx),
}, nil
}
4 changes: 4 additions & 0 deletions protocol/x/vault/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app"
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants"
"github.com/dydxprotocol/v4-chain/protocol/x/vault/types"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
Expand All @@ -24,6 +25,9 @@ func TestQueryParams(t *testing.T) {
req: &types.QueryParamsRequest{},
res: &types.QueryParamsResponse{
DefaultQuotingParams: types.DefaultQuotingParams(),
OperatorParams: types.OperatorParams{
Operator: constants.GovAuthority,
},
},
err: nil,
},
Expand Down
170 changes: 112 additions & 58 deletions protocol/x/vault/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading