diff --git a/proto/osmosis/validator-preference/v1beta1/query.proto b/proto/osmosis/validator-preference/v1beta1/query.proto new file mode 100644 index 00000000000..146942ccd63 --- /dev/null +++ b/proto/osmosis/validator-preference/v1beta1/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package osmosis.validatorpreference.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "osmosis/validator-preference/v1beta1/state.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/client/queryproto"; +option (gogoproto.goproto_getters_all) = false; + +// Query defines the gRPC querier service. +service Query { + // Returns the list of ValidatorPreferences for the user. + rpc UserValidatorPreferences(QueryUserValidatorPreferences) + returns (QueryUserValidatorPreferenceResponse) { + option (google.api.http).get = + "/osmosis/validator-preference/v1beta1/{user}"; + } +} + +// Request type for UserValidatorPreferences. +message QueryUserValidatorPreferences { + // user account address + string user = 2; +} + +// Response type the QueryUserValidatorPreferences query request +message QueryUserValidatorPreferenceResponse { + repeated ValidatorPreference preferences = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/osmosis/validator-preference/v1beta1/state.proto b/proto/osmosis/validator-preference/v1beta1/state.proto new file mode 100644 index 00000000000..eba231b2de3 --- /dev/null +++ b/proto/osmosis/validator-preference/v1beta1/state.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package osmosis.validatorpreference.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/types"; +option (gogoproto.goproto_getters_all) = false; + +// ValidatorPreference defines the message structure for CreateValidatorSetPreference. +// It allows a user to set {val_addr, weight} in state. +// If a user does not have a validator set preference list set, and has +// staked, make their preference list default to their current staking +// distribution. +message ValidatorPreference { + // val_oper_address holds the validator address the user wants to delegate + // funds to. + string val_oper_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // weight is decimal between 0 and 1, and they all sum to 1. + string weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// ValidatorSetPreferences is a wrapper that holds a list of {valAddr, weights}. +// The weights are arranged in decimal notation from 0 to 1 and must add up to 1. +// A delegator can only have one validator-set and they have the ability to modify +// the weights and the validator. +message ValidatorSetPreferences { + // delegator is the address of the user who created the validator-set. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + + // preference holds {valAddr, weight} for the user who created it. + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/osmosis/validator-preference/v1beta1/tx.proto b/proto/osmosis/validator-preference/v1beta1/tx.proto new file mode 100644 index 00000000000..2e820730a37 --- /dev/null +++ b/proto/osmosis/validator-preference/v1beta1/tx.proto @@ -0,0 +1,100 @@ +syntax = "proto3"; +package osmosis.validatorpreference.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "osmosis/validator-preference/v1beta1/state.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/types"; + +// Msg defines the validator-preference modules's gRPC message service. +service Msg { + // CreateValidatorSetPreference creates a set of validator preference. + rpc CreateValidatorSetPreference(MsgCreateValidatorSetPreference) + returns (MsgCreateValidatorSetPreferenceResponse); + + // UpdateValidatorSetPreference updates an existing set of validator preference. + rpc UpdateValidatorSetPreference(MsgUpdateValidatorSetPreference) + returns (MsgUpdateValidatorSetPreferenceResponse); + + // StakeToValidatorSet gets the owner, coins and stakes to a validator-set. + rpc StakeToValidatorSet(MsgStakeToValidatorSet) + returns (MsgStakeToValidatorSetResponse); + + // UnStakeFromValidatorSet gets the owner and coins and unstakes from + // validator-set. The unbonding logic will follow the `Undelegate` logic from the sdk. + rpc UnStakeFromValidatorSet(MsgUnStakeFromValidatorSet) + returns (MsgUnStakeFromValidatorSetResponse); + + // WithdrawDelegationRewards allows users to claim rewards from the validator-set. + rpc WithdrawDelegationRewards(MsgWithdrawDelegationRewards) + returns (MsgWithdrawDelegationRewardsResponse); +} + +// MsgCreateValidatorSetPreference is a list that holds validator-set. +message MsgCreateValidatorSetPreference { + // delegator is the user who is trying to create a validator-set. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + + // list of {valAddr, weight} to delegate to + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +} + +message MsgCreateValidatorSetPreferenceResponse {} + +// MsgCreateValidatorSetPreference is a set of list that holds validator-preference. +message MsgUpdateValidatorSetPreference { + // delegator is the user who is trying to update a validator-set. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + + // updated list of delegators validator-set {valAddr, weight} + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +} + +message MsgUpdateValidatorSetPreferenceResponse {} + +// MsgStakeToValidatorSet allows users to stake to an existing validator-set +message MsgStakeToValidatorSet { + // delegator is the user who is trying to stake. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + + // the amount of tokens the user is trying to stake. + // For ex: UnStake 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + // our unstake logic would attempt to stake 5osmo to A , 3osmo to B, 2osmo to C. + cosmos.base.v1beta1.Coin coin = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; +} + +message MsgStakeToValidatorSetResponse {} + +message MsgUnStakeFromValidatorSet { + // delegator is the user who is trying to unstake. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + + // the amount the user wants to unstake + // For ex: UnStake 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + // our unstake logic would attempt to unstake 5osmo from A , 3osmo from B, 2osmo from C + cosmos.base.v1beta1.Coin coin = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; +} + +message MsgUnStakeFromValidatorSetResponse {} + +// MsgWithdrawDelegationRewards allows user to claim staking rewards from the validator set. +// This message +message MsgWithdrawDelegationRewards { + // delegator is the user who is trying to claim staking rewards. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; +} + +message MsgWithdrawDelegationRewardsResponse {} diff --git a/x/validator-preference/README.md b/x/validator-preference/README.md new file mode 100644 index 00000000000..2ea73623321 --- /dev/null +++ b/x/validator-preference/README.md @@ -0,0 +1,148 @@ +# Validator Set Preference + +## Abstract + +Validator-Set preference is a new module which gives users and contracts a +better UX for staking to a set of validators. For example: a one click button +that stakes to multiple validators. Then the user can set (or realistically a frontend provides) +a list of recommended defaults (Ex: governoors, wosmongton, chain/stack contributors etc). +Currently this can be done on-chain with frontends, but having a preference list stored locally +eases frontend code burden. + +## Design + +How does this module work? + +- Allow an user to set a list of {val-addr, weight} in state, called their validator-set preference. +- Give users a single message to stake {X} tokens, according to their validator set preference distribution. +- Give users a single message to unstake {X} tokens, according to their validator set preference distribution. +- Give users a single message to claim rewards from everyone on their preference list. +- If a user does not have a validator set preference list set, and has staked do the following; + - Make their preference list default to their current staking distribution. +- If a user has no preference list and no staking, then return error for messages. + +## Calculations + +Staking Calculation + +- The user provides an amount to stake and our `MsgStakeToValidatorSet` divides the amount based on validator weight distribution. + For ex: Stake 100osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + our stake logic will attempt to stake (100 * 0.5) 50osmo for ValA , (100 * 0.3) 30osmo from ValB and (100 * 0.2) 20osmo from ValC. + +UnStaking Calculation + +- The user provides an amount to unstake and our `MsgUnStakeFromValidatorSet` divides the amount based on validator weight distribution. +- Here, the user can either unstake the entire amount or partial amount + - Entire amount unstaking: UnStake 100osmo from validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, + our unstake logic will attempt to unstake 50osmo from ValA , 30osmo from ValB, 20osmo from ValC + - Partial amount unstaking: UnStake 27osmo from validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, + our unstake logic will attempt to unstake (27 * 0.5) 13.5osmos from ValA, (27 * 0.3), 8.1osmo from ValB, + and (50 * 0.2) 5.4smo from ValC where 13.5osmo + 8.1osmo + 5.4osmo = 27osmo + - The user will then have 73osmo remaining with unchanged weights {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, + +## Messages + +### CreateValidatorSetPreference + +Creates a validator-set of `{valAddr, Weight}` given the delegator address +and preferences. The weights are in decimal format from 0 to 1 and must add up to 1. + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +``` + +**State Modifications:** + +- Safety Checks + - check if the user already has a validator-set created. + - check if the validator exist and is valid. + - check if the validator-set add up to 1. +- Add owner address to the `KVStore`, where a state of validator-set is stored + +### UpdateValidatorSetPreference + +Updates a validator-set of `{valAddr, Weight}` given the delegator address +and existing preferences. The weights calculations follow the same rule as `CreateValidatorSetPreference`. + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +``` + +**State Modifications:** + +- Follows the same rule as `CreateValidatorSetPreference` except for the following +- Update the `KVStore` value for the specific owner address key + +### StakeToValidatorSet + +Gets the existing validator-set of the delegator and stakes the given amount. The given amount +will be divided based on the weights distributed to the validators. The weights will be unchanged! + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +``` + +**State Modifications:** + +- Check if the user has a validator-set and if so, get the users validator-set from `KVStore` +- Safety Checks + - check if the user has enough funds to delegate. + - check overflow/underflow since `Delegate` method takes `sdk.Int` as tokenAmount +- use the [Delegate](https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/keeper/delegation.go#L614) method from the cosmos-sdk to handle delegation + +### UnStakeFromValidatorSet + +Gets the existing validator-set of the delegator and unstake the given amount. The amount to unstake will +will be divided based on the weights distributed to the validators. The weights will be unchanged! + +The given amount will be divided based on the weights distributed to the validators. + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +``` + +**State Modifications:** + +- Check if the user has a validator-set and if so, get the users validator-set from `KVStore` +- The unbonding logic will be follow the `UnDelegate` logic from the cosmos-sdk. +- Safety Checks + - check that the amount of funds to undelegate is <= to the funds the user has in the address. + - `UnDelegate` method takes `sdk.Dec` as tokenAmount, so check if overflow/underflow case is relevant +- use the [UnDelegate](https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/keeper/delegation.go#L614) method from the cosmos-sdk to handle delegation + +### WithdrawDelegationRewards + +Allows the user to claim rewards based from the existing validator-set. The user can claim rewards from all the validators at once. + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; +``` + +## Code Layout + +The Code Layout is very similar to TWAP module. + +- client/* - Implementation of GRPC and CLI queries +- types/* - Implement ValidatorSetPreference, GenesisState. Define the interface and setup keys. +- twapmodule/validatorsetpreference.go - SDK AppModule interface implementation. +- api.go - Public API, that other users / modules can/should depend on +- listeners.go - Defines hooks & calls to logic.go, for triggering actions on +- keeper.go - generic SDK boilerplate (defining a wrapper for store keys + params) +- msg_server.go - handle messages request from client and process responses. +- store.go - Managing logic for getting and setting things to underlying stores (KVStore) diff --git a/x/validator-preference/client/queryproto/query.pb.go b/x/validator-preference/client/queryproto/query.pb.go new file mode 100644 index 00000000000..e7277f22e80 --- /dev/null +++ b/x/validator-preference/client/queryproto/query.pb.go @@ -0,0 +1,588 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/validator-preference/v1beta1/query.proto + +package queryproto + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + types "github.com/osmosis-labs/osmosis/v12/x/validator-preference/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Request type for UserValidatorPreferences. +type QueryUserValidatorPreferences struct { + // user account address + User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryUserValidatorPreferences) Reset() { *m = QueryUserValidatorPreferences{} } +func (m *QueryUserValidatorPreferences) String() string { return proto.CompactTextString(m) } +func (*QueryUserValidatorPreferences) ProtoMessage() {} +func (*QueryUserValidatorPreferences) Descriptor() ([]byte, []int) { + return fileDescriptor_888a45acbabdd269, []int{0} +} +func (m *QueryUserValidatorPreferences) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserValidatorPreferences) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserValidatorPreferences.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserValidatorPreferences) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserValidatorPreferences.Merge(m, src) +} +func (m *QueryUserValidatorPreferences) XXX_Size() int { + return m.Size() +} +func (m *QueryUserValidatorPreferences) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserValidatorPreferences.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserValidatorPreferences proto.InternalMessageInfo + +// Response type the QueryUserValidatorPreferences query request +type QueryUserValidatorPreferenceResponse struct { + Preferences []types.ValidatorPreference `protobuf:"bytes,1,rep,name=preferences,proto3" json:"preferences"` +} + +func (m *QueryUserValidatorPreferenceResponse) Reset() { *m = QueryUserValidatorPreferenceResponse{} } +func (m *QueryUserValidatorPreferenceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserValidatorPreferenceResponse) ProtoMessage() {} +func (*QueryUserValidatorPreferenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888a45acbabdd269, []int{1} +} +func (m *QueryUserValidatorPreferenceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserValidatorPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserValidatorPreferenceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserValidatorPreferenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserValidatorPreferenceResponse.Merge(m, src) +} +func (m *QueryUserValidatorPreferenceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUserValidatorPreferenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserValidatorPreferenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserValidatorPreferenceResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryUserValidatorPreferences)(nil), "osmosis.validatorpreference.v1beta1.QueryUserValidatorPreferences") + proto.RegisterType((*QueryUserValidatorPreferenceResponse)(nil), "osmosis.validatorpreference.v1beta1.QueryUserValidatorPreferenceResponse") +} + +func init() { + proto.RegisterFile("osmosis/validator-preference/v1beta1/query.proto", fileDescriptor_888a45acbabdd269) +} + +var fileDescriptor_888a45acbabdd269 = []byte{ + // 338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xc8, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0x4b, 0xcc, 0xc9, 0x4c, 0x49, 0x2c, 0xc9, 0x2f, 0xd2, 0x2d, 0x28, + 0x4a, 0x4d, 0x4b, 0x2d, 0x4a, 0xcd, 0x4b, 0x4e, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x86, 0xea, + 0xd0, 0x83, 0xeb, 0x40, 0x68, 0xd0, 0x83, 0x6a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, + 0xd7, 0x07, 0xb1, 0x20, 0x5a, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, + 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0xa1, 0xb2, 0xc4, + 0x39, 0xa5, 0xb8, 0x24, 0xb1, 0x24, 0x15, 0xa2, 0x43, 0xc9, 0x98, 0x4b, 0x36, 0x10, 0xe4, 0xb2, + 0xd0, 0xe2, 0xd4, 0xa2, 0x30, 0x98, 0xa6, 0x00, 0xb8, 0x9e, 0x62, 0x21, 0x21, 0x2e, 0x96, 0xd2, + 0xe2, 0xd4, 0x22, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0xa9, 0x83, 0x91, 0x4b, + 0x05, 0x9f, 0xae, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa1, 0x04, 0x2e, 0x6e, 0x84, + 0xfd, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x16, 0x7a, 0x44, 0x78, 0x5f, 0x0f, 0x8b, + 0xb1, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x21, 0x1b, 0x69, 0xf4, 0x92, 0x91, 0x8b, 0x15, + 0xec, 0x14, 0xa1, 0xfb, 0x8c, 0x5c, 0x12, 0x38, 0x7d, 0xe1, 0x44, 0x94, 0x9d, 0x78, 0x43, 0x42, + 0xca, 0x93, 0x62, 0x33, 0x60, 0xe1, 0xa2, 0x64, 0xd2, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x3d, 0x21, + 0x1d, 0x7d, 0xa2, 0x22, 0xac, 0x1a, 0x14, 0xea, 0xb5, 0x4e, 0x59, 0x27, 0x1e, 0xca, 0x31, 0x9c, + 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, + 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4f, 0x7a, 0x66, 0x49, 0x46, 0x69, + 0x92, 0x5e, 0x72, 0x7e, 0x2e, 0xcc, 0x54, 0xdd, 0x9c, 0xc4, 0xa4, 0x62, 0x84, 0x15, 0x86, 0x46, + 0xfa, 0x15, 0xd8, 0x2d, 0x4a, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0x81, 0xa4, 0x51, 0x70, 0xba, 0x48, + 0x62, 0x03, 0x53, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x9d, 0xec, 0xef, 0xdd, 0x02, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Returns the list of ValidatorPreferences for the user. + UserValidatorPreferences(ctx context.Context, in *QueryUserValidatorPreferences, opts ...grpc.CallOption) (*QueryUserValidatorPreferenceResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) UserValidatorPreferences(ctx context.Context, in *QueryUserValidatorPreferences, opts ...grpc.CallOption) (*QueryUserValidatorPreferenceResponse, error) { + out := new(QueryUserValidatorPreferenceResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Query/UserValidatorPreferences", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Returns the list of ValidatorPreferences for the user. + UserValidatorPreferences(context.Context, *QueryUserValidatorPreferences) (*QueryUserValidatorPreferenceResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) UserValidatorPreferences(ctx context.Context, req *QueryUserValidatorPreferences) (*QueryUserValidatorPreferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserValidatorPreferences not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_UserValidatorPreferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserValidatorPreferences) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserValidatorPreferences(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Query/UserValidatorPreferences", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserValidatorPreferences(ctx, req.(*QueryUserValidatorPreferences)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.validatorpreference.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UserValidatorPreferences", + Handler: _Query_UserValidatorPreferences_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/validator-preference/v1beta1/query.proto", +} + +func (m *QueryUserValidatorPreferences) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUserValidatorPreferences) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserValidatorPreferences) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *QueryUserValidatorPreferenceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUserValidatorPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserValidatorPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Preferences) > 0 { + for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryUserValidatorPreferences) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserValidatorPreferenceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Preferences) > 0 { + for _, e := range m.Preferences { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryUserValidatorPreferences) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserValidatorPreferences: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserValidatorPreferences: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUserValidatorPreferenceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserValidatorPreferenceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserValidatorPreferenceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Preferences = append(m.Preferences, types.ValidatorPreference{}) + if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/validator-preference/client/queryproto/query.pb.gw.go b/x/validator-preference/client/queryproto/query.pb.gw.go new file mode 100644 index 00000000000..00172683446 --- /dev/null +++ b/x/validator-preference/client/queryproto/query.pb.gw.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: osmosis/validator-preference/v1beta1/query.proto + +/* +Package queryproto is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package queryproto + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_UserValidatorPreferences_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserValidatorPreferences + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := client.UserValidatorPreferences(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UserValidatorPreferences_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserValidatorPreferences + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := server.UserValidatorPreferences(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_UserValidatorPreferences_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UserValidatorPreferences_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserValidatorPreferences_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_UserValidatorPreferences_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UserValidatorPreferences_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserValidatorPreferences_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_UserValidatorPreferences_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"osmosis", "validator-preference", "v1beta1", "user"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_UserValidatorPreferences_0 = runtime.ForwardResponseMessage +) diff --git a/x/validator-preference/types/state.pb.go b/x/validator-preference/types/state.pb.go new file mode 100644 index 00000000000..bb1303bd005 --- /dev/null +++ b/x/validator-preference/types/state.pb.go @@ -0,0 +1,605 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/validator-preference/v1beta1/state.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// ValidatorPreference defines the message structure for CreateValidatorSetPreference. +// It allows a user to set {val_addr, weight} in state. +// If a user does not have a validator set preference list set, and has +// staked, make their preference list default to their current staking +// distribution. +type ValidatorPreference struct { + // val_oper_address holds the validator address the user wants to delegate + // funds to. + ValOperAddress string `protobuf:"bytes,1,opt,name=val_oper_address,json=valOperAddress,proto3" json:"val_oper_address,omitempty" yaml:"address"` + // weight is decimal between 0 and 1, and they all sum to 1. + Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` +} + +func (m *ValidatorPreference) Reset() { *m = ValidatorPreference{} } +func (m *ValidatorPreference) String() string { return proto.CompactTextString(m) } +func (*ValidatorPreference) ProtoMessage() {} +func (*ValidatorPreference) Descriptor() ([]byte, []int) { + return fileDescriptor_2f4199f1be974865, []int{0} +} +func (m *ValidatorPreference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorPreference.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorPreference) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorPreference.Merge(m, src) +} +func (m *ValidatorPreference) XXX_Size() int { + return m.Size() +} +func (m *ValidatorPreference) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorPreference.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorPreference proto.InternalMessageInfo + +// ValidatorSetPreferences is a wrapper that holds a list of {valAddr, weights}. +// The weights are arranged in decimal notation from 0 to 1 and must add up to 1. +// A delegator can only have one validator-set and they have the ability to modify +// the weights and the validator. +type ValidatorSetPreferences struct { + // delegator is the address of the user who created the validator-set. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` + // preference holds {valAddr, weight} for the user who created it. + Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` +} + +func (m *ValidatorSetPreferences) Reset() { *m = ValidatorSetPreferences{} } +func (m *ValidatorSetPreferences) String() string { return proto.CompactTextString(m) } +func (*ValidatorSetPreferences) ProtoMessage() {} +func (*ValidatorSetPreferences) Descriptor() ([]byte, []int) { + return fileDescriptor_2f4199f1be974865, []int{1} +} +func (m *ValidatorSetPreferences) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorSetPreferences) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorSetPreferences.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorSetPreferences) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorSetPreferences.Merge(m, src) +} +func (m *ValidatorSetPreferences) XXX_Size() int { + return m.Size() +} +func (m *ValidatorSetPreferences) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorSetPreferences.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorSetPreferences proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ValidatorPreference)(nil), "osmosis.validatorpreference.v1beta1.ValidatorPreference") + proto.RegisterType((*ValidatorSetPreferences)(nil), "osmosis.validatorpreference.v1beta1.ValidatorSetPreferences") +} + +func init() { + proto.RegisterFile("osmosis/validator-preference/v1beta1/state.proto", fileDescriptor_2f4199f1be974865) +} + +var fileDescriptor_2f4199f1be974865 = []byte{ + // 383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0xeb, 0x40, + 0x10, 0xc7, 0x93, 0x3e, 0x28, 0x34, 0x7d, 0x94, 0x92, 0xf7, 0xe0, 0x95, 0xf2, 0x48, 0x4a, 0x04, + 0xe9, 0xa5, 0xbb, 0xb6, 0x5e, 0x44, 0x3c, 0x68, 0x11, 0xaf, 0x4a, 0x04, 0x0f, 0x1e, 0x2c, 0x9b, + 0x64, 0x4c, 0x83, 0x69, 0x36, 0xec, 0xae, 0xa9, 0xfd, 0x16, 0xde, 0xfd, 0x34, 0xde, 0x7a, 0xec, + 0x51, 0x3c, 0x04, 0x6d, 0xbf, 0x41, 0x3f, 0x81, 0x34, 0x59, 0x93, 0x1e, 0x7a, 0xf0, 0xb4, 0xcb, + 0xce, 0xfc, 0x66, 0xfe, 0xf3, 0xdf, 0xd1, 0x0e, 0x28, 0x9f, 0x50, 0x1e, 0x70, 0x9c, 0x90, 0x30, + 0xf0, 0x88, 0xa0, 0xac, 0x17, 0x33, 0xb8, 0x07, 0x06, 0x91, 0x0b, 0x38, 0xe9, 0x3b, 0x20, 0x48, + 0x1f, 0x73, 0x41, 0x04, 0xa0, 0x98, 0x51, 0x41, 0xf5, 0x3d, 0x49, 0xa0, 0x82, 0x28, 0x01, 0x24, + 0x81, 0xf6, 0x5f, 0x9f, 0xfa, 0x34, 0xcb, 0xc7, 0x9b, 0x5b, 0x8e, 0xb6, 0xff, 0xfb, 0x94, 0xfa, + 0x21, 0x60, 0x12, 0x07, 0x98, 0x44, 0x11, 0x15, 0x44, 0x04, 0x34, 0xe2, 0x79, 0xd4, 0x7a, 0x51, + 0xb5, 0x3f, 0x37, 0xdf, 0x35, 0xaf, 0x8a, 0x9a, 0xfa, 0x89, 0xd6, 0x4c, 0x48, 0x38, 0xa2, 0x31, + 0xb0, 0x11, 0xf1, 0x3c, 0x06, 0x9c, 0xb7, 0xd4, 0x8e, 0xda, 0xad, 0x0d, 0xf5, 0x75, 0x6a, 0x36, + 0x66, 0x64, 0x12, 0x1e, 0x5b, 0x32, 0x60, 0xd9, 0x8d, 0x84, 0x84, 0x97, 0x31, 0xb0, 0xb3, 0xfc, + 0x41, 0xbf, 0xd0, 0xaa, 0x53, 0x08, 0xfc, 0xb1, 0x68, 0x55, 0x32, 0x06, 0xcd, 0x53, 0x53, 0x79, + 0x4f, 0xcd, 0x7d, 0x3f, 0x10, 0xe3, 0x47, 0x07, 0xb9, 0x74, 0x82, 0xdd, 0x6c, 0x24, 0x79, 0xf4, + 0xb8, 0xf7, 0x80, 0xc5, 0x2c, 0x06, 0x8e, 0xce, 0xc1, 0xb5, 0x25, 0x6d, 0xbd, 0xaa, 0xda, 0xbf, + 0x42, 0xdd, 0x35, 0x88, 0x52, 0x20, 0xd7, 0x91, 0x56, 0xf3, 0x20, 0x04, 0x7f, 0x13, 0x92, 0xd2, + 0x9a, 0xeb, 0xd4, 0xfc, 0x9d, 0x4b, 0xa3, 0xd3, 0x08, 0x98, 0x65, 0x97, 0x29, 0x7a, 0xa2, 0xd5, + 0x4b, 0xcf, 0x78, 0xab, 0xd2, 0xf9, 0xd5, 0xad, 0x0f, 0x8e, 0xd0, 0x0f, 0x8c, 0x45, 0x3b, 0x0c, + 0x1a, 0xb6, 0x37, 0x23, 0xad, 0x53, 0x53, 0xcf, 0xfb, 0x6d, 0x95, 0xb6, 0xec, 0xed, 0x46, 0xc3, + 0xbb, 0xf9, 0xa7, 0xa1, 0xcc, 0x97, 0x86, 0xba, 0x58, 0x1a, 0xea, 0xc7, 0xd2, 0x50, 0x9f, 0x57, + 0x86, 0xb2, 0x58, 0x19, 0xca, 0xdb, 0xca, 0x50, 0x6e, 0x4f, 0xb7, 0x1c, 0x91, 0x52, 0x7a, 0x21, + 0x71, 0x38, 0x2e, 0x56, 0xa4, 0x3f, 0xc0, 0x4f, 0xbb, 0x17, 0x25, 0xf3, 0xcb, 0xa9, 0x66, 0x1f, + 0x79, 0xf8, 0x15, 0x00, 0x00, 0xff, 0xff, 0xaa, 0xd0, 0x78, 0xaf, 0x55, 0x02, 0x00, 0x00, +} + +func (m *ValidatorPreference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorPreference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorPreference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Weight.Size() + i -= size + if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.ValOperAddress) > 0 { + i -= len(m.ValOperAddress) + copy(dAtA[i:], m.ValOperAddress) + i = encodeVarintState(dAtA, i, uint64(len(m.ValOperAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorSetPreferences) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorSetPreferences) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorSetPreferences) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Preferences) > 0 { + for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintState(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintState(dAtA []byte, offset int, v uint64) int { + offset -= sovState(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ValidatorPreference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValOperAddress) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + l = m.Weight.Size() + n += 1 + l + sovState(uint64(l)) + return n +} + +func (m *ValidatorSetPreferences) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if len(m.Preferences) > 0 { + for _, e := range m.Preferences { + l = e.Size() + n += 1 + l + sovState(uint64(l)) + } + } + return n +} + +func sovState(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozState(x uint64) (n int) { + return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ValidatorPreference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorPreference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorPreference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValOperAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValOperAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorSetPreferences) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorSetPreferences: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorSetPreferences: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Preferences = append(m.Preferences, ValidatorPreference{}) + if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipState(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthState + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupState + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthState + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowState = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/validator-preference/types/tx.pb.go b/x/validator-preference/types/tx.pb.go new file mode 100644 index 00000000000..dddbcc9c1b3 --- /dev/null +++ b/x/validator-preference/types/tx.pb.go @@ -0,0 +1,2112 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/validator-preference/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateValidatorSetPreference is a list that holds validator-set. +type MsgCreateValidatorSetPreference struct { + // delegator is the user who is trying to create a validator-set. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` + // list of {valAddr, weight} to delegate to + Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` +} + +func (m *MsgCreateValidatorSetPreference) Reset() { *m = MsgCreateValidatorSetPreference{} } +func (m *MsgCreateValidatorSetPreference) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidatorSetPreference) ProtoMessage() {} +func (*MsgCreateValidatorSetPreference) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{0} +} +func (m *MsgCreateValidatorSetPreference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidatorSetPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidatorSetPreference.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateValidatorSetPreference) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidatorSetPreference.Merge(m, src) +} +func (m *MsgCreateValidatorSetPreference) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidatorSetPreference) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidatorSetPreference.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidatorSetPreference proto.InternalMessageInfo + +func (m *MsgCreateValidatorSetPreference) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgCreateValidatorSetPreference) GetPreferences() []ValidatorPreference { + if m != nil { + return m.Preferences + } + return nil +} + +type MsgCreateValidatorSetPreferenceResponse struct { +} + +func (m *MsgCreateValidatorSetPreferenceResponse) Reset() { + *m = MsgCreateValidatorSetPreferenceResponse{} +} +func (m *MsgCreateValidatorSetPreferenceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidatorSetPreferenceResponse) ProtoMessage() {} +func (*MsgCreateValidatorSetPreferenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{1} +} +func (m *MsgCreateValidatorSetPreferenceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidatorSetPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidatorSetPreferenceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateValidatorSetPreferenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidatorSetPreferenceResponse.Merge(m, src) +} +func (m *MsgCreateValidatorSetPreferenceResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidatorSetPreferenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidatorSetPreferenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidatorSetPreferenceResponse proto.InternalMessageInfo + +// MsgCreateValidatorSetPreference is a set of list that holds validator-preference. +type MsgUpdateValidatorSetPreference struct { + // delegator is the user who is trying to update a validator-set. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` + // updated list of delegators validator-set {valAddr, weight} + Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` +} + +func (m *MsgUpdateValidatorSetPreference) Reset() { *m = MsgUpdateValidatorSetPreference{} } +func (m *MsgUpdateValidatorSetPreference) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateValidatorSetPreference) ProtoMessage() {} +func (*MsgUpdateValidatorSetPreference) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{2} +} +func (m *MsgUpdateValidatorSetPreference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateValidatorSetPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateValidatorSetPreference.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateValidatorSetPreference) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateValidatorSetPreference.Merge(m, src) +} +func (m *MsgUpdateValidatorSetPreference) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateValidatorSetPreference) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateValidatorSetPreference.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateValidatorSetPreference proto.InternalMessageInfo + +func (m *MsgUpdateValidatorSetPreference) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgUpdateValidatorSetPreference) GetPreferences() []ValidatorPreference { + if m != nil { + return m.Preferences + } + return nil +} + +type MsgUpdateValidatorSetPreferenceResponse struct { +} + +func (m *MsgUpdateValidatorSetPreferenceResponse) Reset() { + *m = MsgUpdateValidatorSetPreferenceResponse{} +} +func (m *MsgUpdateValidatorSetPreferenceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateValidatorSetPreferenceResponse) ProtoMessage() {} +func (*MsgUpdateValidatorSetPreferenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{3} +} +func (m *MsgUpdateValidatorSetPreferenceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateValidatorSetPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateValidatorSetPreferenceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateValidatorSetPreferenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateValidatorSetPreferenceResponse.Merge(m, src) +} +func (m *MsgUpdateValidatorSetPreferenceResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateValidatorSetPreferenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateValidatorSetPreferenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateValidatorSetPreferenceResponse proto.InternalMessageInfo + +// MsgStakeToValidatorSet allows users to stake to an existing validator-set +type MsgStakeToValidatorSet struct { + // delegator is the user who is trying to stake. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` + // the amount of tokens the user is trying to stake. + // For ex: UnStake 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + // our unstake logic would attempt to stake 5osmo to A , 3osmo to B, 2osmo to C. + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"coin"` +} + +func (m *MsgStakeToValidatorSet) Reset() { *m = MsgStakeToValidatorSet{} } +func (m *MsgStakeToValidatorSet) String() string { return proto.CompactTextString(m) } +func (*MsgStakeToValidatorSet) ProtoMessage() {} +func (*MsgStakeToValidatorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{4} +} +func (m *MsgStakeToValidatorSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStakeToValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStakeToValidatorSet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStakeToValidatorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStakeToValidatorSet.Merge(m, src) +} +func (m *MsgStakeToValidatorSet) XXX_Size() int { + return m.Size() +} +func (m *MsgStakeToValidatorSet) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStakeToValidatorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStakeToValidatorSet proto.InternalMessageInfo + +func (m *MsgStakeToValidatorSet) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgStakeToValidatorSet) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgStakeToValidatorSetResponse struct { +} + +func (m *MsgStakeToValidatorSetResponse) Reset() { *m = MsgStakeToValidatorSetResponse{} } +func (m *MsgStakeToValidatorSetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStakeToValidatorSetResponse) ProtoMessage() {} +func (*MsgStakeToValidatorSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{5} +} +func (m *MsgStakeToValidatorSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStakeToValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStakeToValidatorSetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStakeToValidatorSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStakeToValidatorSetResponse.Merge(m, src) +} +func (m *MsgStakeToValidatorSetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgStakeToValidatorSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStakeToValidatorSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStakeToValidatorSetResponse proto.InternalMessageInfo + +type MsgUnStakeFromValidatorSet struct { + // delegator is the user who is trying to unstake. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` + // the amount the user wants to unstake + // For ex: UnStake 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + // our unstake logic would attempt to unstake 5osmo from A , 3osmo from B, 2osmo from C + Coin types.Coin `protobuf:"bytes,3,opt,name=coin,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"coin"` +} + +func (m *MsgUnStakeFromValidatorSet) Reset() { *m = MsgUnStakeFromValidatorSet{} } +func (m *MsgUnStakeFromValidatorSet) String() string { return proto.CompactTextString(m) } +func (*MsgUnStakeFromValidatorSet) ProtoMessage() {} +func (*MsgUnStakeFromValidatorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{6} +} +func (m *MsgUnStakeFromValidatorSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnStakeFromValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnStakeFromValidatorSet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnStakeFromValidatorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnStakeFromValidatorSet.Merge(m, src) +} +func (m *MsgUnStakeFromValidatorSet) XXX_Size() int { + return m.Size() +} +func (m *MsgUnStakeFromValidatorSet) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnStakeFromValidatorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnStakeFromValidatorSet proto.InternalMessageInfo + +func (m *MsgUnStakeFromValidatorSet) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgUnStakeFromValidatorSet) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgUnStakeFromValidatorSetResponse struct { +} + +func (m *MsgUnStakeFromValidatorSetResponse) Reset() { *m = MsgUnStakeFromValidatorSetResponse{} } +func (m *MsgUnStakeFromValidatorSetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnStakeFromValidatorSetResponse) ProtoMessage() {} +func (*MsgUnStakeFromValidatorSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{7} +} +func (m *MsgUnStakeFromValidatorSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnStakeFromValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnStakeFromValidatorSetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUnStakeFromValidatorSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnStakeFromValidatorSetResponse.Merge(m, src) +} +func (m *MsgUnStakeFromValidatorSetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnStakeFromValidatorSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnStakeFromValidatorSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnStakeFromValidatorSetResponse proto.InternalMessageInfo + +// MsgWithdrawDelegationRewards allows user to claim staking rewards from the validator set. +// This message +type MsgWithdrawDelegationRewards struct { + // delegator is the user who is trying to claim staking rewards. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"owner"` +} + +func (m *MsgWithdrawDelegationRewards) Reset() { *m = MsgWithdrawDelegationRewards{} } +func (m *MsgWithdrawDelegationRewards) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawDelegationRewards) ProtoMessage() {} +func (*MsgWithdrawDelegationRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{8} +} +func (m *MsgWithdrawDelegationRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawDelegationRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawDelegationRewards.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawDelegationRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawDelegationRewards.Merge(m, src) +} +func (m *MsgWithdrawDelegationRewards) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawDelegationRewards) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawDelegationRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawDelegationRewards proto.InternalMessageInfo + +func (m *MsgWithdrawDelegationRewards) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +type MsgWithdrawDelegationRewardsResponse struct { +} + +func (m *MsgWithdrawDelegationRewardsResponse) Reset() { *m = MsgWithdrawDelegationRewardsResponse{} } +func (m *MsgWithdrawDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawDelegationRewardsResponse) ProtoMessage() {} +func (*MsgWithdrawDelegationRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{9} +} +func (m *MsgWithdrawDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawDelegationRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.Merge(m, src) +} +func (m *MsgWithdrawDelegationRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawDelegationRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawDelegationRewardsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateValidatorSetPreference)(nil), "osmosis.validatorpreference.v1beta1.MsgCreateValidatorSetPreference") + proto.RegisterType((*MsgCreateValidatorSetPreferenceResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgCreateValidatorSetPreferenceResponse") + proto.RegisterType((*MsgUpdateValidatorSetPreference)(nil), "osmosis.validatorpreference.v1beta1.MsgUpdateValidatorSetPreference") + proto.RegisterType((*MsgUpdateValidatorSetPreferenceResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgUpdateValidatorSetPreferenceResponse") + proto.RegisterType((*MsgStakeToValidatorSet)(nil), "osmosis.validatorpreference.v1beta1.MsgStakeToValidatorSet") + proto.RegisterType((*MsgStakeToValidatorSetResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgStakeToValidatorSetResponse") + proto.RegisterType((*MsgUnStakeFromValidatorSet)(nil), "osmosis.validatorpreference.v1beta1.MsgUnStakeFromValidatorSet") + proto.RegisterType((*MsgUnStakeFromValidatorSetResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgUnStakeFromValidatorSetResponse") + proto.RegisterType((*MsgWithdrawDelegationRewards)(nil), "osmosis.validatorpreference.v1beta1.MsgWithdrawDelegationRewards") + proto.RegisterType((*MsgWithdrawDelegationRewardsResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgWithdrawDelegationRewardsResponse") +} + +func init() { + proto.RegisterFile("osmosis/validator-preference/v1beta1/tx.proto", fileDescriptor_fa9fa79f914b826d) +} + +var fileDescriptor_fa9fa79f914b826d = []byte{ + // 564 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0xcd, 0x6a, 0x13, 0x41, + 0x1c, 0xcf, 0x34, 0x52, 0xe8, 0xc4, 0x83, 0xac, 0xa2, 0xe9, 0x52, 0x36, 0x61, 0x2d, 0x36, 0x1e, + 0xb2, 0x63, 0xe2, 0x45, 0xf4, 0xa0, 0x26, 0x45, 0x11, 0x8c, 0xc8, 0xd6, 0x0f, 0xe8, 0x41, 0x98, + 0xcd, 0x8e, 0xdb, 0xa5, 0xc9, 0xce, 0xb2, 0x33, 0x26, 0xed, 0x5b, 0x78, 0xf3, 0x01, 0xbc, 0xa8, + 0x78, 0xf2, 0x29, 0xea, 0xad, 0x47, 0x41, 0x88, 0x92, 0xbc, 0x41, 0x9f, 0x40, 0xf6, 0x6b, 0x36, + 0x87, 0xcd, 0x76, 0x4a, 0xea, 0xa5, 0xa7, 0x04, 0xe6, 0xf7, 0xb9, 0xfc, 0xff, 0x33, 0xb0, 0x49, + 0xd9, 0x90, 0x32, 0x97, 0xa1, 0x11, 0x1e, 0xb8, 0x36, 0xe6, 0x34, 0x68, 0xfa, 0x01, 0x79, 0x4f, + 0x02, 0xe2, 0xf5, 0x09, 0x1a, 0xb5, 0x2c, 0xc2, 0x71, 0x0b, 0xf1, 0x03, 0xc3, 0x0f, 0x28, 0xa7, + 0xca, 0xcd, 0x04, 0x6e, 0x08, 0x78, 0x86, 0x36, 0x12, 0xb4, 0x7a, 0xcd, 0xa1, 0x0e, 0x8d, 0xf0, + 0x28, 0xfc, 0x17, 0x53, 0x55, 0xad, 0x1f, 0x71, 0x91, 0x85, 0x59, 0x26, 0xdc, 0xa7, 0xae, 0x97, + 0x9c, 0xdf, 0x91, 0x4a, 0xc2, 0x38, 0xe6, 0x24, 0x66, 0xe8, 0x3f, 0x01, 0xac, 0xf5, 0x98, 0xd3, + 0x0d, 0x08, 0xe6, 0xe4, 0x4d, 0xca, 0xda, 0x21, 0xfc, 0xa5, 0xe0, 0x29, 0x06, 0x5c, 0xb3, 0xc9, + 0x80, 0x38, 0xe1, 0x49, 0x15, 0xd4, 0x41, 0x63, 0xad, 0x73, 0xe5, 0x64, 0x52, 0xbb, 0x7c, 0x88, + 0x87, 0x83, 0xfb, 0x3a, 0x1d, 0x7b, 0x24, 0xd0, 0xcd, 0x0c, 0xa2, 0x8c, 0x60, 0x25, 0x73, 0x65, + 0xd5, 0x95, 0x7a, 0xb9, 0x51, 0x69, 0xdf, 0x33, 0x24, 0x6a, 0x1b, 0x22, 0x41, 0x66, 0xdf, 0x51, + 0x8f, 0x26, 0xb5, 0xd2, 0xc9, 0xa4, 0xa6, 0xc4, 0x7e, 0x73, 0xd2, 0xba, 0x39, 0x6f, 0xa4, 0xdf, + 0x86, 0x5b, 0xa7, 0x54, 0x31, 0x09, 0xf3, 0xa9, 0xc7, 0x48, 0x5a, 0xfb, 0xb5, 0x6f, 0x5f, 0x94, + 0xda, 0x45, 0x55, 0x44, 0xed, 0x2f, 0x00, 0x5e, 0xef, 0x31, 0x67, 0x87, 0xe3, 0x7d, 0xf2, 0x8a, + 0xce, 0x83, 0xcf, 0xdc, 0xf6, 0x1d, 0xbc, 0x14, 0x0e, 0x5e, 0x75, 0xa5, 0x0e, 0x1a, 0x95, 0xf6, + 0xba, 0x11, 0x4f, 0xa6, 0x11, 0x4e, 0xa6, 0xa8, 0xd5, 0xa5, 0xae, 0xd7, 0x41, 0x61, 0x8f, 0x6f, + 0x7f, 0x6a, 0x5b, 0x8e, 0xcb, 0xf7, 0x3e, 0x58, 0x46, 0x9f, 0x0e, 0x51, 0x32, 0xc6, 0xf1, 0x4f, + 0x93, 0xd9, 0xfb, 0x88, 0x1f, 0xfa, 0x84, 0x45, 0x04, 0x33, 0xd2, 0xd5, 0xeb, 0x50, 0xcb, 0x4f, + 0x2a, 0xca, 0x7c, 0x07, 0x50, 0x0d, 0x8b, 0x7b, 0x11, 0xe8, 0x49, 0x40, 0x87, 0xe7, 0x52, 0xa8, + 0xfc, 0x9f, 0x0a, 0x6d, 0x42, 0x7d, 0x71, 0x5a, 0x51, 0xea, 0x05, 0xdc, 0xe8, 0x31, 0xe7, 0xad, + 0xcb, 0xf7, 0xec, 0x00, 0x8f, 0xb7, 0xe3, 0x74, 0x2e, 0xf5, 0x4c, 0x32, 0xc6, 0x81, 0xcd, 0xce, + 0xda, 0x4a, 0xbf, 0x05, 0x37, 0x8b, 0xf4, 0x52, 0xdf, 0xf6, 0xef, 0x55, 0x58, 0xee, 0x31, 0x47, + 0xf9, 0x01, 0xe0, 0x46, 0xe1, 0x65, 0xb0, 0x2d, 0x35, 0xd0, 0xa7, 0xec, 0xa1, 0xfa, 0xfc, 0x3c, + 0x54, 0xd2, 0xf0, 0x51, 0xe8, 0xc2, 0x55, 0x96, 0x0e, 0x5d, 0xa4, 0x22, 0x1f, 0x5a, 0x66, 0x17, + 0x95, 0x4f, 0x00, 0x5e, 0xcd, 0x5b, 0xc4, 0x07, 0xb2, 0x2e, 0x39, 0x64, 0xb5, 0xbb, 0x04, 0x59, + 0x24, 0xfb, 0x0c, 0xe0, 0x8d, 0x45, 0x5b, 0xf5, 0x50, 0xfa, 0x1b, 0xe4, 0x0b, 0xa8, 0x4f, 0x97, + 0x14, 0x10, 0x29, 0xbf, 0x02, 0xb8, 0xbe, 0x78, 0x4f, 0x1e, 0xcb, 0xda, 0x2c, 0x94, 0x50, 0x9f, + 0x2d, 0x2d, 0x91, 0x66, 0xed, 0xec, 0x1e, 0x4d, 0x35, 0x70, 0x3c, 0xd5, 0xc0, 0xdf, 0xa9, 0x06, + 0x3e, 0xce, 0xb4, 0xd2, 0xf1, 0x4c, 0x2b, 0xfd, 0x9a, 0x69, 0xa5, 0xdd, 0x47, 0x73, 0x97, 0x48, + 0x62, 0xd7, 0x1c, 0x60, 0x8b, 0x21, 0xf1, 0x92, 0xb7, 0xda, 0xe8, 0x20, 0xff, 0x3d, 0x8f, 0xae, + 0x18, 0x6b, 0x35, 0x7a, 0xc8, 0xef, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xee, 0xae, 0xc0, 0x9a, + 0x86, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateValidatorSetPreference creates a set of validator preference. + CreateValidatorSetPreference(ctx context.Context, in *MsgCreateValidatorSetPreference, opts ...grpc.CallOption) (*MsgCreateValidatorSetPreferenceResponse, error) + // UpdateValidatorSetPreference updates an existing set of validator preference. + UpdateValidatorSetPreference(ctx context.Context, in *MsgUpdateValidatorSetPreference, opts ...grpc.CallOption) (*MsgUpdateValidatorSetPreferenceResponse, error) + // StakeToValidatorSet gets the owner, coins and stakes to a validator-set. + StakeToValidatorSet(ctx context.Context, in *MsgStakeToValidatorSet, opts ...grpc.CallOption) (*MsgStakeToValidatorSetResponse, error) + // UnStakeFromValidatorSet gets the owner and coins and unstakes from + // validator-set. The unbonding logic will follow the `Undelegate` logic from the sdk. + UnStakeFromValidatorSet(ctx context.Context, in *MsgUnStakeFromValidatorSet, opts ...grpc.CallOption) (*MsgUnStakeFromValidatorSetResponse, error) + // WithdrawDelegationRewards allows users to claim rewards from the validator-set. + WithdrawDelegationRewards(ctx context.Context, in *MsgWithdrawDelegationRewards, opts ...grpc.CallOption) (*MsgWithdrawDelegationRewardsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateValidatorSetPreference(ctx context.Context, in *MsgCreateValidatorSetPreference, opts ...grpc.CallOption) (*MsgCreateValidatorSetPreferenceResponse, error) { + out := new(MsgCreateValidatorSetPreferenceResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/CreateValidatorSetPreference", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateValidatorSetPreference(ctx context.Context, in *MsgUpdateValidatorSetPreference, opts ...grpc.CallOption) (*MsgUpdateValidatorSetPreferenceResponse, error) { + out := new(MsgUpdateValidatorSetPreferenceResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/UpdateValidatorSetPreference", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) StakeToValidatorSet(ctx context.Context, in *MsgStakeToValidatorSet, opts ...grpc.CallOption) (*MsgStakeToValidatorSetResponse, error) { + out := new(MsgStakeToValidatorSetResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/StakeToValidatorSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UnStakeFromValidatorSet(ctx context.Context, in *MsgUnStakeFromValidatorSet, opts ...grpc.CallOption) (*MsgUnStakeFromValidatorSetResponse, error) { + out := new(MsgUnStakeFromValidatorSetResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/UnStakeFromValidatorSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawDelegationRewards(ctx context.Context, in *MsgWithdrawDelegationRewards, opts ...grpc.CallOption) (*MsgWithdrawDelegationRewardsResponse, error) { + out := new(MsgWithdrawDelegationRewardsResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/WithdrawDelegationRewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateValidatorSetPreference creates a set of validator preference. + CreateValidatorSetPreference(context.Context, *MsgCreateValidatorSetPreference) (*MsgCreateValidatorSetPreferenceResponse, error) + // UpdateValidatorSetPreference updates an existing set of validator preference. + UpdateValidatorSetPreference(context.Context, *MsgUpdateValidatorSetPreference) (*MsgUpdateValidatorSetPreferenceResponse, error) + // StakeToValidatorSet gets the owner, coins and stakes to a validator-set. + StakeToValidatorSet(context.Context, *MsgStakeToValidatorSet) (*MsgStakeToValidatorSetResponse, error) + // UnStakeFromValidatorSet gets the owner and coins and unstakes from + // validator-set. The unbonding logic will follow the `Undelegate` logic from the sdk. + UnStakeFromValidatorSet(context.Context, *MsgUnStakeFromValidatorSet) (*MsgUnStakeFromValidatorSetResponse, error) + // WithdrawDelegationRewards allows users to claim rewards from the validator-set. + WithdrawDelegationRewards(context.Context, *MsgWithdrawDelegationRewards) (*MsgWithdrawDelegationRewardsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateValidatorSetPreference(ctx context.Context, req *MsgCreateValidatorSetPreference) (*MsgCreateValidatorSetPreferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateValidatorSetPreference not implemented") +} +func (*UnimplementedMsgServer) UpdateValidatorSetPreference(ctx context.Context, req *MsgUpdateValidatorSetPreference) (*MsgUpdateValidatorSetPreferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateValidatorSetPreference not implemented") +} +func (*UnimplementedMsgServer) StakeToValidatorSet(ctx context.Context, req *MsgStakeToValidatorSet) (*MsgStakeToValidatorSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StakeToValidatorSet not implemented") +} +func (*UnimplementedMsgServer) UnStakeFromValidatorSet(ctx context.Context, req *MsgUnStakeFromValidatorSet) (*MsgUnStakeFromValidatorSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnStakeFromValidatorSet not implemented") +} +func (*UnimplementedMsgServer) WithdrawDelegationRewards(ctx context.Context, req *MsgWithdrawDelegationRewards) (*MsgWithdrawDelegationRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawDelegationRewards not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateValidatorSetPreference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateValidatorSetPreference) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateValidatorSetPreference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/CreateValidatorSetPreference", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateValidatorSetPreference(ctx, req.(*MsgCreateValidatorSetPreference)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateValidatorSetPreference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateValidatorSetPreference) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateValidatorSetPreference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/UpdateValidatorSetPreference", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateValidatorSetPreference(ctx, req.(*MsgUpdateValidatorSetPreference)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_StakeToValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStakeToValidatorSet) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StakeToValidatorSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/StakeToValidatorSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StakeToValidatorSet(ctx, req.(*MsgStakeToValidatorSet)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UnStakeFromValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnStakeFromValidatorSet) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnStakeFromValidatorSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/UnStakeFromValidatorSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnStakeFromValidatorSet(ctx, req.(*MsgUnStakeFromValidatorSet)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawDelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawDelegationRewards) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawDelegationRewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/WithdrawDelegationRewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawDelegationRewards(ctx, req.(*MsgWithdrawDelegationRewards)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.validatorpreference.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateValidatorSetPreference", + Handler: _Msg_CreateValidatorSetPreference_Handler, + }, + { + MethodName: "UpdateValidatorSetPreference", + Handler: _Msg_UpdateValidatorSetPreference_Handler, + }, + { + MethodName: "StakeToValidatorSet", + Handler: _Msg_StakeToValidatorSet_Handler, + }, + { + MethodName: "UnStakeFromValidatorSet", + Handler: _Msg_UnStakeFromValidatorSet_Handler, + }, + { + MethodName: "WithdrawDelegationRewards", + Handler: _Msg_WithdrawDelegationRewards_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/validator-preference/v1beta1/tx.proto", +} + +func (m *MsgCreateValidatorSetPreference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateValidatorSetPreference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidatorSetPreference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Preferences) > 0 { + for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateValidatorSetPreferenceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateValidatorSetPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidatorSetPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateValidatorSetPreference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateValidatorSetPreference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateValidatorSetPreference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Preferences) > 0 { + for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateValidatorSetPreferenceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateValidatorSetPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateValidatorSetPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgStakeToValidatorSet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStakeToValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStakeToValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStakeToValidatorSetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStakeToValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStakeToValidatorSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUnStakeFromValidatorSet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnStakeFromValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnStakeFromValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUnStakeFromValidatorSetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUnStakeFromValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnStakeFromValidatorSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawDelegationRewards) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawDelegationRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawDelegationRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawDelegationRewardsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateValidatorSetPreference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Preferences) > 0 { + for _, e := range m.Preferences { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateValidatorSetPreferenceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateValidatorSetPreference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Preferences) > 0 { + for _, e := range m.Preferences { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgUpdateValidatorSetPreferenceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgStakeToValidatorSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgStakeToValidatorSetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUnStakeFromValidatorSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUnStakeFromValidatorSetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawDelegationRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgWithdrawDelegationRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateValidatorSetPreference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateValidatorSetPreference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidatorSetPreference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Preferences = append(m.Preferences, ValidatorPreference{}) + if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateValidatorSetPreferenceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateValidatorSetPreferenceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidatorSetPreferenceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateValidatorSetPreference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateValidatorSetPreference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateValidatorSetPreference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Preferences = append(m.Preferences, ValidatorPreference{}) + if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateValidatorSetPreferenceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateValidatorSetPreferenceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateValidatorSetPreferenceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStakeToValidatorSet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgStakeToValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStakeToValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStakeToValidatorSetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgStakeToValidatorSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStakeToValidatorSetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnStakeFromValidatorSet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnStakeFromValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnStakeFromValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnStakeFromValidatorSetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUnStakeFromValidatorSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnStakeFromValidatorSetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawDelegationRewards) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawDelegationRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawDelegationRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawDelegationRewardsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawDelegationRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)