Refactor x/distribution according to ADR 031 (#7524)

* Refactor x/distribution according to ADR 31

* lint

* removed unused

* Apply suggestions from code review

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
atheeshp 2020-10-15 19:24:16 +05:30 committed by GitHub
parent 1279da53ea
commit bf7165414d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1009 additions and 153 deletions

View File

@ -7,6 +7,25 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/v1beta1/coin.proto";
// Msg defines the distribution Msg service.
service Msg {
// SetWithdrawAddress defines a method to change the withdraw address
// for a delegator (or validator self-delegation).
rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse);
// WithdrawDelegatorReward defines a method to withdraw rewards of delegator
// from a single validator.
rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse);
// WithdrawValidatorCommission defines a method to withdraw the
// full commission to the validator address.
rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse);
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
}
// MsgSetWithdrawAddress sets the withdraw address for // MsgSetWithdrawAddress sets the withdraw address for
// a delegator (or validator self-delegation). // a delegator (or validator self-delegation).
message MsgSetWithdrawAddress { message MsgSetWithdrawAddress {
@ -17,6 +36,9 @@ message MsgSetWithdrawAddress {
string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""]; string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""];
} }
// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.
message MsgSetWithdrawAddressResponse { }
// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator
// from a single validator. // from a single validator.
message MsgWithdrawDelegatorReward { message MsgWithdrawDelegatorReward {
@ -27,6 +49,9 @@ message MsgWithdrawDelegatorReward {
string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""]; string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""];
} }
// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type.
message MsgWithdrawDelegatorRewardResponse { }
// MsgWithdrawValidatorCommission withdraws the full commission to the validator // MsgWithdrawValidatorCommission withdraws the full commission to the validator
// address. // address.
message MsgWithdrawValidatorCommission { message MsgWithdrawValidatorCommission {
@ -36,6 +61,9 @@ message MsgWithdrawValidatorCommission {
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""]; string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
} }
// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
message MsgWithdrawValidatorCommissionResponse { }
// MsgFundCommunityPool allows an account to directly // MsgFundCommunityPool allows an account to directly
// fund the community pool. // fund the community pool.
message MsgFundCommunityPool { message MsgFundCommunityPool {
@ -45,4 +73,7 @@ message MsgFundCommunityPool {
repeated cosmos.base.v1beta1.Coin amount = 1 repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string depositor = 2; string depositor = 2;
} }
// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
message MsgFundCommunityPoolResponse { }

View File

@ -1,9 +1,6 @@
package distribution package distribution
import ( import (
metrics "github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
@ -15,18 +12,24 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
ctx = ctx.WithEventManager(sdk.NewEventManager()) ctx = ctx.WithEventManager(sdk.NewEventManager())
msgServer := keeper.NewMsgServerImpl(k)
switch msg := msg.(type) { switch msg := msg.(type) {
case *types.MsgSetWithdrawAddress: case *types.MsgSetWithdrawAddress:
return handleMsgModifyWithdrawAddress(ctx, msg, k) res, err := msgServer.SetWithdrawAddress(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgWithdrawDelegatorReward: case *types.MsgWithdrawDelegatorReward:
return handleMsgWithdrawDelegatorReward(ctx, msg, k) res, err := msgServer.WithdrawDelegatorReward(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgWithdrawValidatorCommission: case *types.MsgWithdrawValidatorCommission:
return handleMsgWithdrawValidatorCommission(ctx, msg, k) res, err := msgServer.WithdrawValidatorCommission(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgFundCommunityPool: case *types.MsgFundCommunityPool:
return handleMsgFundCommunityPool(ctx, msg, k) res, err := msgServer.FundCommunityPool(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
default: default:
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distribution message type: %T", msg) return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized distribution message type: %T", msg)
@ -34,119 +37,6 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
} }
} }
// These functions assume everything has been authenticated (ValidateBasic passed, and signatures checked)
func handleMsgModifyWithdrawAddress(ctx sdk.Context, msg *types.MsgSetWithdrawAddress, k keeper.Keeper) (*sdk.Result, error) {
delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
withdrawAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
err = k.SetWithdrawAddr(ctx, delegatorAddress, withdrawAddress)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.DelegatorAddress),
),
)
return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil
}
func handleMsgWithdrawDelegatorReward(ctx sdk.Context, msg *types.MsgWithdrawDelegatorReward, k keeper.Keeper) (*sdk.Result, error) {
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return nil, err
}
delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
amount, err := k.WithdrawDelegationRewards(ctx, delegatorAddress, valAddr)
if err != nil {
return nil, err
}
defer func() {
for _, a := range amount {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "withdraw_reward"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}()
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.DelegatorAddress),
),
)
return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil
}
func handleMsgWithdrawValidatorCommission(ctx sdk.Context, msg *types.MsgWithdrawValidatorCommission, k keeper.Keeper) (*sdk.Result, error) {
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return nil, err
}
amount, err := k.WithdrawValidatorCommission(ctx, valAddr)
if err != nil {
return nil, err
}
defer func() {
for _, a := range amount {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "withdraw_commission"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}()
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.ValidatorAddress),
),
)
return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil
}
func handleMsgFundCommunityPool(ctx sdk.Context, msg *types.MsgFundCommunityPool, k keeper.Keeper) (*sdk.Result, error) {
depositer, err := sdk.AccAddressFromBech32(msg.Depositor)
if err != nil {
return nil, err
}
if err := k.FundCommunityPool(ctx, msg.Amount, depositer); err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Depositor),
),
)
return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil
}
func NewCommunityPoolSpendProposalHandler(k keeper.Keeper) govtypes.Handler { func NewCommunityPoolSpendProposalHandler(k keeper.Keeper) govtypes.Handler {
return func(ctx sdk.Context, content govtypes.Content) error { return func(ctx sdk.Context, content govtypes.Content) error {
switch c := content.(type) { switch c := content.(type) {

View File

@ -0,0 +1,140 @@
package keeper
import (
"context"
"github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the bank MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}
var _ types.MsgServer = msgServer{}
func (k msgServer) SetWithdrawAddress(goCtx context.Context, msg *types.MsgSetWithdrawAddress) (*types.MsgSetWithdrawAddressResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
withdrawAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
err = k.SetWithdrawAddr(ctx, delegatorAddress, withdrawAddress)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.DelegatorAddress),
),
)
return &types.MsgSetWithdrawAddressResponse{}, nil
}
func (k msgServer) WithdrawDelegatorReward(goCtx context.Context, msg *types.MsgWithdrawDelegatorReward) (*types.MsgWithdrawDelegatorRewardResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return nil, err
}
delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)
if err != nil {
return nil, err
}
amount, err := k.WithdrawDelegationRewards(ctx, delegatorAddress, valAddr)
if err != nil {
return nil, err
}
defer func() {
for _, a := range amount {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "withdraw_reward"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}()
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.DelegatorAddress),
),
)
return &types.MsgWithdrawDelegatorRewardResponse{}, nil
}
func (k msgServer) WithdrawValidatorCommission(goCtx context.Context, msg *types.MsgWithdrawValidatorCommission) (*types.MsgWithdrawValidatorCommissionResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
if err != nil {
return nil, err
}
amount, err := k.Keeper.WithdrawValidatorCommission(ctx, valAddr)
if err != nil {
return nil, err
}
defer func() {
for _, a := range amount {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "withdraw_commission"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}()
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.ValidatorAddress),
),
)
return &types.MsgWithdrawValidatorCommissionResponse{}, nil
}
func (k msgServer) FundCommunityPool(goCtx context.Context, msg *types.MsgFundCommunityPool) (*types.MsgFundCommunityPoolResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
depositer, err := sdk.AccAddressFromBech32(msg.Depositor)
if err != nil {
return nil, err
}
if err := k.Keeper.FundCommunityPool(ctx, msg.Amount, depositer); err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Depositor),
),
)
return &types.MsgFundCommunityPoolResponse{}, nil
}

View File

@ -4,11 +4,16 @@
package types package types
import ( import (
context "context"
fmt "fmt" fmt "fmt"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
grpc1 "github.com/gogo/protobuf/grpc"
types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto" 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" io "io"
math "math" math "math"
math_bits "math/bits" math_bits "math/bits"
@ -65,6 +70,43 @@ func (m *MsgSetWithdrawAddress) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo
// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.
type MsgSetWithdrawAddressResponse struct {
}
func (m *MsgSetWithdrawAddressResponse) Reset() { *m = MsgSetWithdrawAddressResponse{} }
func (m *MsgSetWithdrawAddressResponse) String() string { return proto.CompactTextString(m) }
func (*MsgSetWithdrawAddressResponse) ProtoMessage() {}
func (*MsgSetWithdrawAddressResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{1}
}
func (m *MsgSetWithdrawAddressResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgSetWithdrawAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgSetWithdrawAddressResponse.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 *MsgSetWithdrawAddressResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgSetWithdrawAddressResponse.Merge(m, src)
}
func (m *MsgSetWithdrawAddressResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgSetWithdrawAddressResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgSetWithdrawAddressResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgSetWithdrawAddressResponse proto.InternalMessageInfo
// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator
// from a single validator. // from a single validator.
type MsgWithdrawDelegatorReward struct { type MsgWithdrawDelegatorReward struct {
@ -76,7 +118,7 @@ func (m *MsgWithdrawDelegatorReward) Reset() { *m = MsgWithdrawDelegator
func (m *MsgWithdrawDelegatorReward) String() string { return proto.CompactTextString(m) } func (m *MsgWithdrawDelegatorReward) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawDelegatorReward) ProtoMessage() {} func (*MsgWithdrawDelegatorReward) ProtoMessage() {}
func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) { func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{1} return fileDescriptor_ed4f433d965e58ca, []int{2}
} }
func (m *MsgWithdrawDelegatorReward) XXX_Unmarshal(b []byte) error { func (m *MsgWithdrawDelegatorReward) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -105,6 +147,43 @@ func (m *MsgWithdrawDelegatorReward) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgWithdrawDelegatorReward proto.InternalMessageInfo var xxx_messageInfo_MsgWithdrawDelegatorReward proto.InternalMessageInfo
// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type.
type MsgWithdrawDelegatorRewardResponse struct {
}
func (m *MsgWithdrawDelegatorRewardResponse) Reset() { *m = MsgWithdrawDelegatorRewardResponse{} }
func (m *MsgWithdrawDelegatorRewardResponse) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawDelegatorRewardResponse) ProtoMessage() {}
func (*MsgWithdrawDelegatorRewardResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{3}
}
func (m *MsgWithdrawDelegatorRewardResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgWithdrawDelegatorRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.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 *MsgWithdrawDelegatorRewardResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.Merge(m, src)
}
func (m *MsgWithdrawDelegatorRewardResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgWithdrawDelegatorRewardResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgWithdrawDelegatorRewardResponse proto.InternalMessageInfo
// MsgWithdrawValidatorCommission withdraws the full commission to the validator // MsgWithdrawValidatorCommission withdraws the full commission to the validator
// address. // address.
type MsgWithdrawValidatorCommission struct { type MsgWithdrawValidatorCommission struct {
@ -115,7 +194,7 @@ func (m *MsgWithdrawValidatorCommission) Reset() { *m = MsgWithdrawValid
func (m *MsgWithdrawValidatorCommission) String() string { return proto.CompactTextString(m) } func (m *MsgWithdrawValidatorCommission) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawValidatorCommission) ProtoMessage() {} func (*MsgWithdrawValidatorCommission) ProtoMessage() {}
func (*MsgWithdrawValidatorCommission) Descriptor() ([]byte, []int) { func (*MsgWithdrawValidatorCommission) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{2} return fileDescriptor_ed4f433d965e58ca, []int{4}
} }
func (m *MsgWithdrawValidatorCommission) XXX_Unmarshal(b []byte) error { func (m *MsgWithdrawValidatorCommission) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -144,6 +223,45 @@ func (m *MsgWithdrawValidatorCommission) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgWithdrawValidatorCommission proto.InternalMessageInfo var xxx_messageInfo_MsgWithdrawValidatorCommission proto.InternalMessageInfo
// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
type MsgWithdrawValidatorCommissionResponse struct {
}
func (m *MsgWithdrawValidatorCommissionResponse) Reset() {
*m = MsgWithdrawValidatorCommissionResponse{}
}
func (m *MsgWithdrawValidatorCommissionResponse) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawValidatorCommissionResponse) ProtoMessage() {}
func (*MsgWithdrawValidatorCommissionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{5}
}
func (m *MsgWithdrawValidatorCommissionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgWithdrawValidatorCommissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgWithdrawValidatorCommissionResponse.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 *MsgWithdrawValidatorCommissionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgWithdrawValidatorCommissionResponse.Merge(m, src)
}
func (m *MsgWithdrawValidatorCommissionResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgWithdrawValidatorCommissionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgWithdrawValidatorCommissionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgWithdrawValidatorCommissionResponse proto.InternalMessageInfo
// MsgFundCommunityPool allows an account to directly // MsgFundCommunityPool allows an account to directly
// fund the community pool. // fund the community pool.
type MsgFundCommunityPool struct { type MsgFundCommunityPool struct {
@ -155,7 +273,7 @@ func (m *MsgFundCommunityPool) Reset() { *m = MsgFundCommunityPool{} }
func (m *MsgFundCommunityPool) String() string { return proto.CompactTextString(m) } func (m *MsgFundCommunityPool) String() string { return proto.CompactTextString(m) }
func (*MsgFundCommunityPool) ProtoMessage() {} func (*MsgFundCommunityPool) ProtoMessage() {}
func (*MsgFundCommunityPool) Descriptor() ([]byte, []int) { func (*MsgFundCommunityPool) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{3} return fileDescriptor_ed4f433d965e58ca, []int{6}
} }
func (m *MsgFundCommunityPool) XXX_Unmarshal(b []byte) error { func (m *MsgFundCommunityPool) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -184,11 +302,52 @@ func (m *MsgFundCommunityPool) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgFundCommunityPool proto.InternalMessageInfo var xxx_messageInfo_MsgFundCommunityPool proto.InternalMessageInfo
// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
type MsgFundCommunityPoolResponse struct {
}
func (m *MsgFundCommunityPoolResponse) Reset() { *m = MsgFundCommunityPoolResponse{} }
func (m *MsgFundCommunityPoolResponse) String() string { return proto.CompactTextString(m) }
func (*MsgFundCommunityPoolResponse) ProtoMessage() {}
func (*MsgFundCommunityPoolResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ed4f433d965e58ca, []int{7}
}
func (m *MsgFundCommunityPoolResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgFundCommunityPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgFundCommunityPoolResponse.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 *MsgFundCommunityPoolResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgFundCommunityPoolResponse.Merge(m, src)
}
func (m *MsgFundCommunityPoolResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgFundCommunityPoolResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgFundCommunityPoolResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgFundCommunityPoolResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*MsgSetWithdrawAddress)(nil), "cosmos.distribution.v1beta1.MsgSetWithdrawAddress") proto.RegisterType((*MsgSetWithdrawAddress)(nil), "cosmos.distribution.v1beta1.MsgSetWithdrawAddress")
proto.RegisterType((*MsgSetWithdrawAddressResponse)(nil), "cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse")
proto.RegisterType((*MsgWithdrawDelegatorReward)(nil), "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward") proto.RegisterType((*MsgWithdrawDelegatorReward)(nil), "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward")
proto.RegisterType((*MsgWithdrawDelegatorRewardResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse")
proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission") proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission")
proto.RegisterType((*MsgWithdrawValidatorCommissionResponse)(nil), "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse")
proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPool") proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPool")
proto.RegisterType((*MsgFundCommunityPoolResponse)(nil), "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse")
} }
func init() { func init() {
@ -196,35 +355,331 @@ func init() {
} }
var fileDescriptor_ed4f433d965e58ca = []byte{ var fileDescriptor_ed4f433d965e58ca = []byte{
// 436 bytes of a gzipped FileDescriptorProto // 558 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xbd, 0x8e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x3f, 0x6f, 0xd3, 0x40,
0x1c, 0xc4, 0xbd, 0x87, 0x74, 0xe2, 0x96, 0x82, 0x9c, 0x75, 0x88, 0x90, 0x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x2b, 0x7e, 0x34, 0xff, 0x76, 0x08, 0x1b, 0x6f, 0x6f, 0x84, 0x7f, 0xe3, 0xf7,
0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x18, 0x71, 0xb0, 0x41, 0x06, 0x00, 0x00,
}
func (this *MsgSetWithdrawAddressResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgSetWithdrawAddressResponse)
if !ok {
that2, ok := that.(MsgSetWithdrawAddressResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
return true
}
func (this *MsgWithdrawDelegatorRewardResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgWithdrawDelegatorRewardResponse)
if !ok {
that2, ok := that.(MsgWithdrawDelegatorRewardResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
return true
}
func (this *MsgWithdrawValidatorCommissionResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgWithdrawValidatorCommissionResponse)
if !ok {
that2, ok := that.(MsgWithdrawValidatorCommissionResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
return true
}
func (this *MsgFundCommunityPoolResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgFundCommunityPoolResponse)
if !ok {
that2, ok := that.(MsgFundCommunityPoolResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
return true
}
// 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 {
// ModifyWithdrawAddress defines a method to change the withdraw address
// for a delegator (or validator self-delegation).
SetWithdrawAddress(ctx context.Context, in *MsgSetWithdrawAddress, opts ...grpc.CallOption) (*MsgSetWithdrawAddressResponse, error)
// WithdrawDelegatorReward defines a method to withdraw rewards of delegator
// from a single validator.
WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error)
// WithdrawValidatorCommission defines a method to withdraw the
// full commission to the validator address
WithdrawValidatorCommission(ctx context.Context, in *MsgWithdrawValidatorCommission, opts ...grpc.CallOption) (*MsgWithdrawValidatorCommissionResponse, error)
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) SetWithdrawAddress(ctx context.Context, in *MsgSetWithdrawAddress, opts ...grpc.CallOption) (*MsgSetWithdrawAddressResponse, error) {
out := new(MsgSetWithdrawAddressResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/SetWithdrawAddress", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) {
out := new(MsgWithdrawDelegatorRewardResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) WithdrawValidatorCommission(ctx context.Context, in *MsgWithdrawValidatorCommission, opts ...grpc.CallOption) (*MsgWithdrawValidatorCommissionResponse, error) {
out := new(MsgWithdrawValidatorCommissionResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) FundCommunityPool(ctx context.Context, in *MsgFundCommunityPool, opts ...grpc.CallOption) (*MsgFundCommunityPoolResponse, error) {
out := new(MsgFundCommunityPoolResponse)
err := c.cc.Invoke(ctx, "/cosmos.distribution.v1beta1.Msg/FundCommunityPool", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// ModifyWithdrawAddress defines a method to change the withdraw address
// for a delegator (or validator self-delegation).
SetWithdrawAddress(context.Context, *MsgSetWithdrawAddress) (*MsgSetWithdrawAddressResponse, error)
// WithdrawDelegatorReward defines a method to withdraw rewards of delegator
// from a single validator.
WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error)
// WithdrawValidatorCommission defines a method to withdraw the
// full commission to the validator address
WithdrawValidatorCommission(context.Context, *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error)
// FundCommunityPool defines a method to allow an account to directly
// fund the community pool.
FundCommunityPool(context.Context, *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) SetWithdrawAddress(ctx context.Context, req *MsgSetWithdrawAddress) (*MsgSetWithdrawAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetWithdrawAddress not implemented")
}
func (*UnimplementedMsgServer) WithdrawDelegatorReward(ctx context.Context, req *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method WithdrawDelegatorReward not implemented")
}
func (*UnimplementedMsgServer) WithdrawValidatorCommission(ctx context.Context, req *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method WithdrawValidatorCommission not implemented")
}
func (*UnimplementedMsgServer) FundCommunityPool(ctx context.Context, req *MsgFundCommunityPool) (*MsgFundCommunityPoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FundCommunityPool not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_SetWithdrawAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgSetWithdrawAddress)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).SetWithdrawAddress(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.v1beta1.Msg/SetWithdrawAddress",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).SetWithdrawAddress(ctx, req.(*MsgSetWithdrawAddress))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_WithdrawDelegatorReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgWithdrawDelegatorReward)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).WithdrawDelegatorReward(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).WithdrawDelegatorReward(ctx, req.(*MsgWithdrawDelegatorReward))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_WithdrawValidatorCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgWithdrawValidatorCommission)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).WithdrawValidatorCommission(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).WithdrawValidatorCommission(ctx, req.(*MsgWithdrawValidatorCommission))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_FundCommunityPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgFundCommunityPool)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).FundCommunityPool(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.distribution.v1beta1.Msg/FundCommunityPool",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).FundCommunityPool(ctx, req.(*MsgFundCommunityPool))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.distribution.v1beta1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SetWithdrawAddress",
Handler: _Msg_SetWithdrawAddress_Handler,
},
{
MethodName: "WithdrawDelegatorReward",
Handler: _Msg_WithdrawDelegatorReward_Handler,
},
{
MethodName: "WithdrawValidatorCommission",
Handler: _Msg_WithdrawValidatorCommission_Handler,
},
{
MethodName: "FundCommunityPool",
Handler: _Msg_FundCommunityPool_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/distribution/v1beta1/tx.proto",
} }
func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) {
@ -264,6 +719,29 @@ func (m *MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgSetWithdrawAddressResponse) 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 *MsgSetWithdrawAddressResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgSetWithdrawAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgWithdrawDelegatorReward) Marshal() (dAtA []byte, err error) { func (m *MsgWithdrawDelegatorReward) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -301,6 +779,29 @@ func (m *MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, err
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgWithdrawDelegatorRewardResponse) 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 *MsgWithdrawDelegatorRewardResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgWithdrawDelegatorRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgWithdrawValidatorCommission) Marshal() (dAtA []byte, err error) { func (m *MsgWithdrawValidatorCommission) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -331,6 +832,29 @@ func (m *MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgWithdrawValidatorCommissionResponse) 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 *MsgWithdrawValidatorCommissionResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgWithdrawValidatorCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *MsgFundCommunityPool) Marshal() (dAtA []byte, err error) { func (m *MsgFundCommunityPool) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -375,6 +899,29 @@ func (m *MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgFundCommunityPoolResponse) 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 *MsgFundCommunityPoolResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgFundCommunityPoolResponse) 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 { func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v) offset -= sovTx(v)
base := offset base := offset
@ -403,6 +950,15 @@ func (m *MsgSetWithdrawAddress) Size() (n int) {
return n return n
} }
func (m *MsgSetWithdrawAddressResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgWithdrawDelegatorReward) Size() (n int) { func (m *MsgWithdrawDelegatorReward) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -420,6 +976,15 @@ func (m *MsgWithdrawDelegatorReward) Size() (n int) {
return n return n
} }
func (m *MsgWithdrawDelegatorRewardResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgWithdrawValidatorCommission) Size() (n int) { func (m *MsgWithdrawValidatorCommission) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -433,6 +998,15 @@ func (m *MsgWithdrawValidatorCommission) Size() (n int) {
return n return n
} }
func (m *MsgWithdrawValidatorCommissionResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *MsgFundCommunityPool) Size() (n int) { func (m *MsgFundCommunityPool) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -452,6 +1026,15 @@ func (m *MsgFundCommunityPool) Size() (n int) {
return n return n
} }
func (m *MsgFundCommunityPoolResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) { func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -575,6 +1158,59 @@ func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgSetWithdrawAddressResponse) 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: MsgSetWithdrawAddressResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgSetWithdrawAddressResponse: 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 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -692,6 +1328,59 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgWithdrawDelegatorRewardResponse) 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: MsgWithdrawDelegatorRewardResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: 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 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -777,6 +1466,59 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgWithdrawValidatorCommissionResponse) 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: MsgWithdrawValidatorCommissionResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgWithdrawValidatorCommissionResponse: 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 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -896,6 +1638,59 @@ func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgFundCommunityPoolResponse) 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: MsgFundCommunityPoolResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgFundCommunityPoolResponse: 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 {
return ErrInvalidLengthTx
}
if (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) { func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0