diff --git a/proto/osmosis/validator-preference/v1beta1/query.proto b/proto/osmosis/validator-preference/v1beta1/query.proto new file mode 100644 index 00000000000..9a6d666c8e4 --- /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 = 1; +} + +// 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..cbfcf56a34d --- /dev/null +++ b/proto/osmosis/validator-preference/v1beta1/state.proto @@ -0,0 +1,37 @@ +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:\"val_oper_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 defines a delegator's validator set preference. +// It contains a list of (validator, percent_allocation) pairs. +// The percent allocation are arranged in decimal notation from 0 to 1 and must +// add up to 1. +message ValidatorSetPreferences { + // 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..00967e38c9a --- /dev/null +++ b/proto/osmosis/validator-preference/v1beta1/tx.proto @@ -0,0 +1,90 @@ +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 { + // SetValidatorSetPreference creates a set of validator preference. + // This message will process both create + update request. + rpc SetValidatorSetPreference(MsgSetValidatorSetPreference) + returns (MsgSetValidatorSetPreferenceResponse); + + // DelegateToValidatorSet gets the owner, coins and delegates to a + // validator-set. + rpc DelegateToValidatorSet(MsgDelegateToValidatorSet) + returns (MsgDelegateToValidatorSetResponse); + + // UndelegateFromValidatorSet gets the owner and coins and undelegates from + // validator-set. The unbonding logic will follow the `Undelegate` logic from + // the sdk. + rpc UndelegateFromValidatorSet(MsgUndelegateFromValidatorSet) + returns (MsgUndelegateFromValidatorSetResponse); + + // WithdrawDelegationRewards allows users to claim rewards from the + // validator-set. + rpc WithdrawDelegationRewards(MsgWithdrawDelegationRewards) + returns (MsgWithdrawDelegationRewardsResponse); +} + +// MsgCreateValidatorSetPreference is a list that holds validator-set. +message MsgSetValidatorSetPreference { + // delegator is the user who is trying to create a validator-set. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; + + // list of {valAddr, weight} to delegate to + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSetValidatorSetPreferenceResponse {} + +// MsgDelegateToValidatorSet allows users to delegate to an existing +// validator-set +message MsgDelegateToValidatorSet { + // delegator is the user who is trying to delegate. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; + + // the amount of tokens the user is trying to delegate. + // For ex: delegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC + // -> 0.2} our staking logic would attempt to delegate 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 MsgDelegateToValidatorSetResponse {} + +message MsgUndelegateFromValidatorSet { + // delegator is the user who is trying to undelegate. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; + + // the amount the user wants to undelegate + // For ex: Undelegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, + // ValC + // -> 0.2} our undelegate logic would attempt to undelegate 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 MsgUndelegateFromValidatorSetResponse {} + +// MsgWithdrawDelegationRewards allows user to claim staking rewards from the +// validator set. +message MsgWithdrawDelegationRewards { + // delegator is the user who is trying to claim staking rewards. + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; +} + +message MsgWithdrawDelegationRewardsResponse {} diff --git a/tests/localosmosis/README.md b/tests/localosmosis/README.md index da20e1987b4..1499b743eab 100644 --- a/tests/localosmosis/README.md +++ b/tests/localosmosis/README.md @@ -122,7 +122,19 @@ After a while (~15 minutes), this will create a file called `state_export.json` cp $HOME/state_export.json $HOME/osmosis/tests/LocalOsmosis/state_export/ ``` -2. Initialize LocalOsmosis: +6. Ensure you have docker and docker-compose installed: + +```sh +# Docker +sudo apt-get remove docker docker-engine docker.io +sudo apt-get update +sudo apt install docker.io -y + +# Docker compose +sudo apt install docker-compose -y +``` + +7. Build the `local:osmosis` docker image: ```bash make localnet-state-export-init diff --git a/x/validator-preference/README.md b/x/validator-preference/README.md new file mode 100644 index 00000000000..6239c5b9b0d --- /dev/null +++ b/x/validator-preference/README.md @@ -0,0 +1,155 @@ +# 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 delegates to multiple validators. Then the user can set (or realistically a frontend provides) +a list of recommended defaults (Ex: active governors, relayers, core 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 a user to set a list of {val-addr, weight} in the state, called their validator-set preference. +- Allow a user to update a list of {val-addr, weight} in the state, then do the following; + - Unstake the existing tokens (run the same unbond logic as cosmos-sdk staking). + - Update the validator distribution weights. + - Stake the tokens based on the new weights. + - Redelegate their current delegation to the currently configured set. +- Give users a single message to delegate {X} tokens, according to their validator-set preference distribution. +- Give users a single message to undelegate {X} tokens, according to their validator-set preference distribution. +- Give users a single message to claim rewards from everyone on their preference list. +- If the delegator has not set a validator-set preference list then the validator set, then it defaults to their current validator set. +- If a user has no preference list and has not staked, then these messages / queries return errors. + +## Calculations + +Staking Calculation + +- The user provides an amount to delegate and our `MsgStakeToValidatorSet` divides the amount based on validator weight distribution. + For example: Stake 100osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} + our delegate logic will attempt to delegate (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 undelegate and our `MsgUnStakeFromValidatorSet` divides the amount based on validator weight distribution. +- Here, the user can either undelegate the entire amount or partial amount + - Entire amount unstaking: UnStake 100osmo from validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, + our undelegate logic will attempt to undelegate 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 undelegate logic will attempt to undelegate (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:\"delegator\"" ]; + 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`. +If a user changes their preferences list, the unstaking logic will run from the old set and +restaking to a new set is going to happen behind the scenes. + +```go + string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; + repeated ValidatorPreference preferences = 2 [ + (gogoproto.moretags) = "yaml:\"preferences\"", + (gogoproto.nullable) = false + ]; +``` + +**State Modifications:** + +- Follows the same rule as `CreateValidatorSetPreference` for weights checks. +- Update the `KVStore` value for the specific owner address key. +- Run the undelegate logic and restake the tokens with updated weights. + +### StakeToValidatorSet + +Gets the existing validator-set of the delegator and delegates 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:\"delegator\"" ]; + 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 undelegate the given amount. The amount to undelegate 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:\"delegator\"" ]; + 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:\"delegator\"" ]; +``` + +## 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..3af9d73e681 --- /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,1,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, 0x46, 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, 0x44, 0xbd, 0xf5, 0xa9, 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] = 0xa + } + 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 1: + 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..467994f7447 --- /dev/null +++ b/x/validator-preference/types/state.pb.go @@ -0,0 +1,559 @@ +// 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:"val_oper_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 defines a delegator's validator set preference. +// It contains a list of (validator, percent_allocation) pairs. +// The percent allocation are arranged in decimal notation from 0 to 1 and must +// add up to 1. +type ValidatorSetPreferences struct { + // 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{ + // 358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0xfb, 0x30, + 0x18, 0xc6, 0x9b, 0xfd, 0x61, 0xf0, 0xef, 0x40, 0xa4, 0x0a, 0x1b, 0x53, 0xd2, 0x51, 0x41, 0x76, + 0x59, 0xe2, 0xe6, 0x45, 0x3c, 0xe9, 0x50, 0xaf, 0xca, 0x04, 0x0f, 0x1e, 0x1c, 0x69, 0xfb, 0xda, + 0x15, 0xbb, 0xa6, 0x24, 0xb1, 0xba, 0x6f, 0xa1, 0xdf, 0xc1, 0x0f, 0xb3, 0xe3, 0x8e, 0xe2, 0xa1, + 0xe8, 0xf6, 0x0d, 0xf6, 0x09, 0x64, 0x6d, 0xed, 0x86, 0xec, 0xe0, 0x29, 0x21, 0x79, 0x7f, 0x4f, + 0x9e, 0xe7, 0x7d, 0xa3, 0x1f, 0x70, 0x39, 0xe4, 0xd2, 0x97, 0x34, 0x66, 0x81, 0xef, 0x32, 0xc5, + 0x45, 0x2b, 0x12, 0x70, 0x0f, 0x02, 0x42, 0x07, 0x68, 0xdc, 0xb6, 0x41, 0xb1, 0x36, 0x95, 0x8a, + 0x29, 0x20, 0x91, 0xe0, 0x8a, 0x1b, 0x7b, 0x39, 0x41, 0x0a, 0x62, 0x09, 0x90, 0x1c, 0xa8, 0x6f, + 0x7b, 0xdc, 0xe3, 0x69, 0x3d, 0x5d, 0xec, 0x32, 0xb4, 0xbe, 0xeb, 0x71, 0xee, 0x05, 0x40, 0x59, + 0xe4, 0x53, 0x16, 0x86, 0x5c, 0x31, 0xe5, 0xf3, 0x50, 0x66, 0xb7, 0xd6, 0x1b, 0xd2, 0xb7, 0x6e, + 0x7e, 0x34, 0xaf, 0x0a, 0x4d, 0xe3, 0x5c, 0xdf, 0x8c, 0x59, 0xd0, 0xe7, 0x11, 0x88, 0x3e, 0x73, + 0x5d, 0x01, 0x52, 0xd6, 0x50, 0x03, 0x35, 0xff, 0x77, 0x77, 0xe6, 0x89, 0x59, 0x1d, 0xb1, 0x61, + 0x70, 0x6c, 0xfd, 0xae, 0xb0, 0x7a, 0x1b, 0x31, 0x0b, 0x2e, 0x23, 0x10, 0xa7, 0xd9, 0x81, 0x71, + 0xa1, 0x97, 0x9f, 0xc0, 0xf7, 0x06, 0xaa, 0x56, 0x4a, 0x61, 0x32, 0x4e, 0x4c, 0xed, 0x23, 0x31, + 0xf7, 0x3d, 0x5f, 0x0d, 0x1e, 0x6d, 0xe2, 0xf0, 0x21, 0x75, 0xd2, 0x6c, 0xf9, 0xd2, 0x92, 0xee, + 0x03, 0x55, 0xa3, 0x08, 0x24, 0x39, 0x03, 0xa7, 0x97, 0xd3, 0xd6, 0x2b, 0xd2, 0xab, 0x85, 0xcd, + 0x6b, 0x50, 0x4b, 0xa7, 0xd2, 0x88, 0xf5, 0xca, 0xb2, 0x19, 0xb2, 0x56, 0x6a, 0xfc, 0x6b, 0x56, + 0x3a, 0x47, 0xe4, 0x0f, 0x1d, 0x23, 0x6b, 0x92, 0x77, 0xeb, 0x0b, 0x8b, 0xf3, 0xc4, 0x34, 0xb2, + 0x8c, 0x2b, 0xd2, 0x56, 0x6f, 0xf5, 0xa1, 0xee, 0xdd, 0xf8, 0x0b, 0x6b, 0xe3, 0x29, 0x46, 0x93, + 0x29, 0x46, 0x9f, 0x53, 0x8c, 0x5e, 0x66, 0x58, 0x9b, 0xcc, 0xb0, 0xf6, 0x3e, 0xc3, 0xda, 0xed, + 0xc9, 0x4a, 0xc2, 0xdc, 0x4a, 0x2b, 0x60, 0xb6, 0xa4, 0xc5, 0xec, 0xdb, 0x1d, 0xfa, 0xbc, 0xfe, + 0x07, 0xa4, 0xf9, 0xed, 0x72, 0x3a, 0xa1, 0xc3, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0xdc, + 0x3d, 0x1c, 0x2e, 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 + } + } + 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 + 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 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..f1450087091 --- /dev/null +++ b/x/validator-preference/types/tx.pb.go @@ -0,0 +1,1726 @@ +// 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 MsgSetValidatorSetPreference 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:"delegator"` + // list of {valAddr, weight} to delegate to + Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` +} + +func (m *MsgSetValidatorSetPreference) Reset() { *m = MsgSetValidatorSetPreference{} } +func (m *MsgSetValidatorSetPreference) String() string { return proto.CompactTextString(m) } +func (*MsgSetValidatorSetPreference) ProtoMessage() {} +func (*MsgSetValidatorSetPreference) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{0} +} +func (m *MsgSetValidatorSetPreference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetValidatorSetPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetValidatorSetPreference.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 *MsgSetValidatorSetPreference) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetValidatorSetPreference.Merge(m, src) +} +func (m *MsgSetValidatorSetPreference) XXX_Size() int { + return m.Size() +} +func (m *MsgSetValidatorSetPreference) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetValidatorSetPreference.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetValidatorSetPreference proto.InternalMessageInfo + +func (m *MsgSetValidatorSetPreference) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgSetValidatorSetPreference) GetPreferences() []ValidatorPreference { + if m != nil { + return m.Preferences + } + return nil +} + +type MsgSetValidatorSetPreferenceResponse struct { +} + +func (m *MsgSetValidatorSetPreferenceResponse) Reset() { *m = MsgSetValidatorSetPreferenceResponse{} } +func (m *MsgSetValidatorSetPreferenceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetValidatorSetPreferenceResponse) ProtoMessage() {} +func (*MsgSetValidatorSetPreferenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{1} +} +func (m *MsgSetValidatorSetPreferenceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetValidatorSetPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.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 *MsgSetValidatorSetPreferenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.Merge(m, src) +} +func (m *MsgSetValidatorSetPreferenceResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetValidatorSetPreferenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetValidatorSetPreferenceResponse proto.InternalMessageInfo + +// MsgDelegateToValidatorSet allows users to delegate to an existing +// validator-set +type MsgDelegateToValidatorSet struct { + // delegator is the user who is trying to delegate. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` + // the amount of tokens the user is trying to delegate. + // For ex: delegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC + // -> 0.2} our staking logic would attempt to delegate 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 *MsgDelegateToValidatorSet) Reset() { *m = MsgDelegateToValidatorSet{} } +func (m *MsgDelegateToValidatorSet) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateToValidatorSet) ProtoMessage() {} +func (*MsgDelegateToValidatorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{2} +} +func (m *MsgDelegateToValidatorSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateToValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateToValidatorSet.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 *MsgDelegateToValidatorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateToValidatorSet.Merge(m, src) +} +func (m *MsgDelegateToValidatorSet) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateToValidatorSet) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateToValidatorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateToValidatorSet proto.InternalMessageInfo + +func (m *MsgDelegateToValidatorSet) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgDelegateToValidatorSet) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgDelegateToValidatorSetResponse struct { +} + +func (m *MsgDelegateToValidatorSetResponse) Reset() { *m = MsgDelegateToValidatorSetResponse{} } +func (m *MsgDelegateToValidatorSetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateToValidatorSetResponse) ProtoMessage() {} +func (*MsgDelegateToValidatorSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{3} +} +func (m *MsgDelegateToValidatorSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateToValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateToValidatorSetResponse.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 *MsgDelegateToValidatorSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateToValidatorSetResponse.Merge(m, src) +} +func (m *MsgDelegateToValidatorSetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateToValidatorSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateToValidatorSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateToValidatorSetResponse proto.InternalMessageInfo + +type MsgUndelegateFromValidatorSet struct { + // delegator is the user who is trying to undelegate. + Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` + // the amount the user wants to undelegate + // For ex: Undelegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, + // ValC + // -> 0.2} our undelegate logic would attempt to undelegate 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 *MsgUndelegateFromValidatorSet) Reset() { *m = MsgUndelegateFromValidatorSet{} } +func (m *MsgUndelegateFromValidatorSet) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateFromValidatorSet) ProtoMessage() {} +func (*MsgUndelegateFromValidatorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{4} +} +func (m *MsgUndelegateFromValidatorSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateFromValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateFromValidatorSet.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 *MsgUndelegateFromValidatorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateFromValidatorSet.Merge(m, src) +} +func (m *MsgUndelegateFromValidatorSet) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateFromValidatorSet) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateFromValidatorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateFromValidatorSet proto.InternalMessageInfo + +func (m *MsgUndelegateFromValidatorSet) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *MsgUndelegateFromValidatorSet) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +type MsgUndelegateFromValidatorSetResponse struct { +} + +func (m *MsgUndelegateFromValidatorSetResponse) Reset() { *m = MsgUndelegateFromValidatorSetResponse{} } +func (m *MsgUndelegateFromValidatorSetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateFromValidatorSetResponse) ProtoMessage() {} +func (*MsgUndelegateFromValidatorSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa9fa79f914b826d, []int{5} +} +func (m *MsgUndelegateFromValidatorSetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateFromValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.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 *MsgUndelegateFromValidatorSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.Merge(m, src) +} +func (m *MsgUndelegateFromValidatorSetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateFromValidatorSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateFromValidatorSetResponse proto.InternalMessageInfo + +// MsgWithdrawDelegationRewards allows user to claim staking rewards from the +// validator set. +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:"delegator"` +} + +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{6} +} +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{7} +} +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((*MsgSetValidatorSetPreference)(nil), "osmosis.validatorpreference.v1beta1.MsgSetValidatorSetPreference") + proto.RegisterType((*MsgSetValidatorSetPreferenceResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgSetValidatorSetPreferenceResponse") + proto.RegisterType((*MsgDelegateToValidatorSet)(nil), "osmosis.validatorpreference.v1beta1.MsgDelegateToValidatorSet") + proto.RegisterType((*MsgDelegateToValidatorSetResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgDelegateToValidatorSetResponse") + proto.RegisterType((*MsgUndelegateFromValidatorSet)(nil), "osmosis.validatorpreference.v1beta1.MsgUndelegateFromValidatorSet") + proto.RegisterType((*MsgUndelegateFromValidatorSetResponse)(nil), "osmosis.validatorpreference.v1beta1.MsgUndelegateFromValidatorSetResponse") + 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{ + // 530 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x8b, 0xd3, 0x40, + 0x1c, 0xed, 0x6c, 0x55, 0xd8, 0xe9, 0x45, 0xc2, 0x22, 0x6d, 0xd0, 0xb4, 0x66, 0xd5, 0xed, 0xa5, + 0x19, 0x1b, 0x2f, 0xe2, 0x41, 0x34, 0xca, 0x82, 0x42, 0x41, 0xb2, 0xfe, 0x81, 0x3d, 0x08, 0x93, + 0x66, 0xcc, 0x06, 0xdb, 0x4c, 0xc9, 0x6f, 0xec, 0xee, 0x7e, 0x0b, 0x3f, 0x82, 0x57, 0x45, 0xd8, + 0x83, 0x5f, 0x62, 0xf1, 0xb4, 0x47, 0x4f, 0x55, 0xda, 0x6f, 0xb0, 0x9f, 0x40, 0x92, 0x4c, 0x27, + 0x3d, 0x6c, 0x6a, 0x68, 0xdd, 0x53, 0x0b, 0xf3, 0x7b, 0xef, 0xf7, 0x5e, 0xde, 0x1b, 0x06, 0x77, + 0x38, 0x0c, 0x39, 0x84, 0x40, 0xc6, 0x74, 0x10, 0xfa, 0x54, 0xf0, 0xb8, 0x33, 0x8a, 0xd9, 0x07, + 0x16, 0xb3, 0xa8, 0xcf, 0xc8, 0xb8, 0xeb, 0x31, 0x41, 0xbb, 0x44, 0x1c, 0x59, 0xa3, 0x98, 0x0b, + 0xae, 0x6d, 0xcb, 0x71, 0x4b, 0x8d, 0xe7, 0xd3, 0x96, 0x9c, 0xd6, 0xb7, 0x02, 0x1e, 0xf0, 0x74, + 0x9e, 0x24, 0xff, 0x32, 0xa8, 0x6e, 0xf4, 0x53, 0x2c, 0xf1, 0x28, 0xe4, 0xc4, 0x7d, 0x1e, 0x46, + 0xf2, 0xfc, 0x7e, 0x29, 0x25, 0x20, 0xa8, 0x60, 0x19, 0xc2, 0xfc, 0x89, 0xf0, 0xcd, 0x1e, 0x04, + 0x7b, 0x4c, 0xbc, 0x9d, 0x43, 0xf6, 0x98, 0x78, 0xa5, 0x40, 0x9a, 0x8d, 0x37, 0x7d, 0x36, 0x60, + 0x41, 0x72, 0x52, 0x47, 0x2d, 0xd4, 0xde, 0x74, 0xb6, 0xce, 0x27, 0xcd, 0xeb, 0xc7, 0x74, 0x38, + 0x78, 0x64, 0xaa, 0x23, 0xd3, 0xcd, 0xc7, 0xb4, 0x31, 0xae, 0xe5, 0x6b, 0xa1, 0xbe, 0xd1, 0xaa, + 0xb6, 0x6b, 0xf6, 0x43, 0xab, 0x84, 0x6f, 0x4b, 0xa9, 0xc8, 0x25, 0x38, 0xfa, 0xe9, 0xa4, 0x59, + 0x39, 0x9f, 0x34, 0xb5, 0x6c, 0xe7, 0x02, 0xb5, 0xe9, 0x2e, 0x2e, 0x32, 0xef, 0xe1, 0x3b, 0xcb, + 0xbc, 0xb8, 0x0c, 0x46, 0x3c, 0x02, 0x66, 0x9e, 0x20, 0xdc, 0xe8, 0x41, 0xf0, 0x3c, 0x13, 0xcc, + 0x5e, 0xf3, 0xc5, 0xf9, 0x95, 0x1c, 0xbf, 0xc7, 0x57, 0x92, 0x18, 0xea, 0x1b, 0x2d, 0xd4, 0xae, + 0xd9, 0x0d, 0x2b, 0xcb, 0xc9, 0x4a, 0x72, 0x52, 0xd6, 0x9e, 0xf1, 0x30, 0x72, 0x48, 0xe2, 0xe5, + 0xdb, 0xef, 0xe6, 0x4e, 0x10, 0x8a, 0x83, 0x4f, 0x9e, 0xd5, 0xe7, 0x43, 0x22, 0x43, 0xcd, 0x7e, + 0x3a, 0xe0, 0x7f, 0x24, 0xe2, 0x78, 0xc4, 0x20, 0x05, 0xb8, 0x29, 0xaf, 0xb9, 0x8d, 0x6f, 0x17, + 0x0a, 0x56, 0xb6, 0x7e, 0x20, 0x7c, 0xab, 0x07, 0xc1, 0x9b, 0x48, 0xea, 0x62, 0xbb, 0x31, 0x1f, + 0xfe, 0x37, 0x6b, 0xd5, 0x4b, 0xb2, 0xb6, 0x83, 0xef, 0x2e, 0x15, 0xad, 0xec, 0xb9, 0x69, 0x53, + 0xdf, 0x85, 0xe2, 0xc0, 0x8f, 0xe9, 0xa1, 0xfc, 0x16, 0x21, 0x8f, 0x5c, 0x76, 0x48, 0x63, 0x1f, + 0x56, 0x31, 0x27, 0x1b, 0x53, 0xc8, 0x39, 0xdf, 0x6d, 0x9f, 0x5c, 0xc5, 0xd5, 0x1e, 0x04, 0xda, + 0x57, 0x84, 0x1b, 0xc5, 0x77, 0xe5, 0x69, 0xa9, 0x8a, 0x2f, 0xab, 0xa8, 0xfe, 0x62, 0x6d, 0x8a, + 0xb9, 0x66, 0xed, 0x0b, 0xc2, 0x37, 0x0a, 0x2a, 0xfe, 0xb8, 0xec, 0x96, 0x8b, 0xf1, 0xfa, 0xee, + 0x7a, 0x78, 0x25, 0xf1, 0x3b, 0xc2, 0xfa, 0x92, 0xba, 0x3a, 0x65, 0xd7, 0x14, 0x73, 0xe8, 0x2f, + 0xd7, 0xe7, 0x50, 0x72, 0x93, 0xf4, 0x8b, 0xfb, 0x57, 0x3a, 0xfd, 0x42, 0x8a, 0xf2, 0xe9, 0xff, + 0xb3, 0xb1, 0xce, 0xfe, 0xe9, 0xd4, 0x40, 0x67, 0x53, 0x03, 0xfd, 0x99, 0x1a, 0xe8, 0xf3, 0xcc, + 0xa8, 0x9c, 0xcd, 0x8c, 0xca, 0xaf, 0x99, 0x51, 0xd9, 0x7f, 0xb2, 0x70, 0x3f, 0xe5, 0xba, 0xce, + 0x80, 0x7a, 0x40, 0xd4, 0xe3, 0xd1, 0xb5, 0xc9, 0xd1, 0xc5, 0x4f, 0x48, 0x7a, 0x7b, 0xbd, 0x6b, + 0xe9, 0xdb, 0xf1, 0xe0, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x83, 0x26, 0x47, 0xf9, 0x06, + 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 { + // SetValidatorSetPreference creates a set of validator preference. + // This message will process both create + update request. + SetValidatorSetPreference(ctx context.Context, in *MsgSetValidatorSetPreference, opts ...grpc.CallOption) (*MsgSetValidatorSetPreferenceResponse, error) + // DelegateToValidatorSet gets the owner, coins and delegates to a + // validator-set. + DelegateToValidatorSet(ctx context.Context, in *MsgDelegateToValidatorSet, opts ...grpc.CallOption) (*MsgDelegateToValidatorSetResponse, error) + // UndelegateFromValidatorSet gets the owner and coins and undelegates from + // validator-set. The unbonding logic will follow the `Undelegate` logic from + // the sdk. + UndelegateFromValidatorSet(ctx context.Context, in *MsgUndelegateFromValidatorSet, opts ...grpc.CallOption) (*MsgUndelegateFromValidatorSetResponse, 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) SetValidatorSetPreference(ctx context.Context, in *MsgSetValidatorSetPreference, opts ...grpc.CallOption) (*MsgSetValidatorSetPreferenceResponse, error) { + out := new(MsgSetValidatorSetPreferenceResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/SetValidatorSetPreference", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DelegateToValidatorSet(ctx context.Context, in *MsgDelegateToValidatorSet, opts ...grpc.CallOption) (*MsgDelegateToValidatorSetResponse, error) { + out := new(MsgDelegateToValidatorSetResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/DelegateToValidatorSet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UndelegateFromValidatorSet(ctx context.Context, in *MsgUndelegateFromValidatorSet, opts ...grpc.CallOption) (*MsgUndelegateFromValidatorSetResponse, error) { + out := new(MsgUndelegateFromValidatorSetResponse) + err := c.cc.Invoke(ctx, "/osmosis.validatorpreference.v1beta1.Msg/UndelegateFromValidatorSet", 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 { + // SetValidatorSetPreference creates a set of validator preference. + // This message will process both create + update request. + SetValidatorSetPreference(context.Context, *MsgSetValidatorSetPreference) (*MsgSetValidatorSetPreferenceResponse, error) + // DelegateToValidatorSet gets the owner, coins and delegates to a + // validator-set. + DelegateToValidatorSet(context.Context, *MsgDelegateToValidatorSet) (*MsgDelegateToValidatorSetResponse, error) + // UndelegateFromValidatorSet gets the owner and coins and undelegates from + // validator-set. The unbonding logic will follow the `Undelegate` logic from + // the sdk. + UndelegateFromValidatorSet(context.Context, *MsgUndelegateFromValidatorSet) (*MsgUndelegateFromValidatorSetResponse, 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) SetValidatorSetPreference(ctx context.Context, req *MsgSetValidatorSetPreference) (*MsgSetValidatorSetPreferenceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetValidatorSetPreference not implemented") +} +func (*UnimplementedMsgServer) DelegateToValidatorSet(ctx context.Context, req *MsgDelegateToValidatorSet) (*MsgDelegateToValidatorSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegateToValidatorSet not implemented") +} +func (*UnimplementedMsgServer) UndelegateFromValidatorSet(ctx context.Context, req *MsgUndelegateFromValidatorSet) (*MsgUndelegateFromValidatorSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndelegateFromValidatorSet 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_SetValidatorSetPreference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetValidatorSetPreference) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetValidatorSetPreference(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/SetValidatorSetPreference", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetValidatorSetPreference(ctx, req.(*MsgSetValidatorSetPreference)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DelegateToValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegateToValidatorSet) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DelegateToValidatorSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/DelegateToValidatorSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DelegateToValidatorSet(ctx, req.(*MsgDelegateToValidatorSet)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UndelegateFromValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegateFromValidatorSet) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UndelegateFromValidatorSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.validatorpreference.v1beta1.Msg/UndelegateFromValidatorSet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UndelegateFromValidatorSet(ctx, req.(*MsgUndelegateFromValidatorSet)) + } + 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: "SetValidatorSetPreference", + Handler: _Msg_SetValidatorSetPreference_Handler, + }, + { + MethodName: "DelegateToValidatorSet", + Handler: _Msg_DelegateToValidatorSet_Handler, + }, + { + MethodName: "UndelegateFromValidatorSet", + Handler: _Msg_UndelegateFromValidatorSet_Handler, + }, + { + MethodName: "WithdrawDelegationRewards", + Handler: _Msg_WithdrawDelegationRewards_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/validator-preference/v1beta1/tx.proto", +} + +func (m *MsgSetValidatorSetPreference) 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 *MsgSetValidatorSetPreference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetValidatorSetPreference) 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 *MsgSetValidatorSetPreferenceResponse) 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 *MsgSetValidatorSetPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetValidatorSetPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegateToValidatorSet) 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 *MsgDelegateToValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateToValidatorSet) 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 *MsgDelegateToValidatorSetResponse) 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 *MsgDelegateToValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateToValidatorSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateFromValidatorSet) 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 *MsgUndelegateFromValidatorSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateFromValidatorSet) 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 *MsgUndelegateFromValidatorSetResponse) 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 *MsgUndelegateFromValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateFromValidatorSetResponse) 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 *MsgSetValidatorSetPreference) 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 *MsgSetValidatorSetPreferenceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegateToValidatorSet) 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 *MsgDelegateToValidatorSetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUndelegateFromValidatorSet) 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 *MsgUndelegateFromValidatorSetResponse) 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 *MsgSetValidatorSetPreference) 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: MsgSetValidatorSetPreference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetValidatorSetPreference: 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 *MsgSetValidatorSetPreferenceResponse) 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: MsgSetValidatorSetPreferenceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetValidatorSetPreferenceResponse: 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 *MsgDelegateToValidatorSet) 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: MsgDelegateToValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateToValidatorSet: 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 *MsgDelegateToValidatorSetResponse) 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: MsgDelegateToValidatorSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateToValidatorSetResponse: 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 *MsgUndelegateFromValidatorSet) 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: MsgUndelegateFromValidatorSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegateFromValidatorSet: 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 *MsgUndelegateFromValidatorSetResponse) 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: MsgUndelegateFromValidatorSetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegateFromValidatorSetResponse: 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") +)