diff --git a/CHANGELOG.md b/CHANGELOG.md index 02764ce54..61407f95d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Improvements +- [#309](https://github.com/babylonlabs-io/babylon/pull/309) feat(adr-036): custom withdrawal address - [#305](https://github.com/babylonlabs-io/babylon/pull/305) chore: add more error logs to `VerifyInclusionProofAndGetHeight` - [#304](https://github.com/babylonlabs-io/babylon/pull/304) Add highest voted height to finality provider diff --git a/proto/babylon/incentive/query.proto b/proto/babylon/incentive/query.proto index 30601ae7e..f5e3ab3aa 100644 --- a/proto/babylon/incentive/query.proto +++ b/proto/babylon/incentive/query.proto @@ -6,6 +6,7 @@ import "google/api/annotations.proto"; import "babylon/incentive/params.proto"; import "babylon/incentive/incentive.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/babylonlabs-io/babylon/x/incentive/types"; @@ -23,6 +24,11 @@ service Query { rpc BTCStakingGauge(QueryBTCStakingGaugeRequest) returns (QueryBTCStakingGaugeResponse) { option (google.api.http).get = "/babylon/incentive/btc_staking_gauge/{height}"; } + + // DelegatorWithdrawAddress queries withdraw address of a delegator. + rpc DelegatorWithdrawAddress(QueryDelegatorWithdrawAddressRequest) returns (QueryDelegatorWithdrawAddressResponse) { + option (google.api.http).get = "/babylon/incentive/delegators/{delegator_address}/withdraw_address"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -84,3 +90,23 @@ message QueryBTCStakingGaugeResponse { // gauge is the BTC staking gauge at the queried height BTCStakingGaugeResponse gauge = 1; } + +// QueryDelegatorWithdrawAddressRequest is the request type for the +// Query/DelegatorWithdrawAddress RPC method. +message QueryDelegatorWithdrawAddressRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // delegator_address defines the delegator address to query for. + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryDelegatorWithdrawAddressResponse is the response type for the +// Query/DelegatorWithdrawAddress RPC method. +message QueryDelegatorWithdrawAddressResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // withdraw_address defines the delegator address to query for. + string withdraw_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} \ No newline at end of file diff --git a/proto/babylon/incentive/tx.proto b/proto/babylon/incentive/tx.proto index 321996e71..47a7c657d 100644 --- a/proto/babylon/incentive/tx.proto +++ b/proto/babylon/incentive/tx.proto @@ -17,6 +17,8 @@ service Msg { rpc WithdrawReward(MsgWithdrawReward) returns (MsgWithdrawRewardResponse); // UpdateParams updates the incentive module parameters. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // SetWithdrawAddress defines a method to change the withdraw address of a stakeholder + rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); } @@ -56,3 +58,14 @@ message MsgUpdateParams { } // MsgUpdateParamsResponse is the response to the MsgUpdateParams message. message MsgUpdateParamsResponse {} + +// MsgSetWithdrawAddress sets the withdraw address +message MsgSetWithdrawAddress { + option (cosmos.msg.v1.signer) = "delegator_address"; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} +// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response +// type. +message MsgSetWithdrawAddressResponse {} \ No newline at end of file diff --git a/x/incentive/client/cli/tx.go b/x/incentive/client/cli/tx.go index 83c56bf95..4a227a018 100644 --- a/x/incentive/client/cli/tx.go +++ b/x/incentive/client/cli/tx.go @@ -2,7 +2,7 @@ package cli import ( "fmt" - + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/babylonlabs-io/babylon/x/incentive/types" @@ -23,6 +23,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( NewWithdrawRewardCmd(), + NewSetWithdrawAddressCmd(), ) return cmd @@ -52,3 +53,34 @@ func NewWithdrawRewardCmd() *cobra.Command { return cmd } + +func NewSetWithdrawAddressCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-withdraw-addr [withdraw-addr]", + Short: "change the default withdraw address for rewards", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + delAddr := clientCtx.GetFromAddress() + withdrawAddr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + msg := &types.MsgSetWithdrawAddress{ + DelegatorAddress: delAddr.String(), + WithdrawAddress: withdrawAddr.String(), + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/incentive/keeper/msg_server.go b/x/incentive/keeper/msg_server.go index 5dfe5833e..150e580c7 100644 --- a/x/incentive/keeper/msg_server.go +++ b/x/incentive/keeper/msg_server.go @@ -2,7 +2,6 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" "github.com/babylonlabs-io/babylon/x/incentive/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -65,3 +64,22 @@ func (ms msgServer) WithdrawReward(goCtx context.Context, req *types.MsgWithdraw Coins: withdrawnCoins, }, nil } + +func (ms msgServer) SetWithdrawAddress(ctx context.Context, msg *types.MsgSetWithdrawAddress) (*types.MsgSetWithdrawAddressResponse, error) { + delegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + withdrawAddress, err := sdk.AccAddressFromBech32(msg.WithdrawAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + err = ms.SetWithdrawAddr(ctx, delegatorAddress, withdrawAddress) + if err != nil { + return nil, err + } + + return &types.MsgSetWithdrawAddressResponse{}, nil +} diff --git a/x/incentive/keeper/msg_server_test.go b/x/incentive/keeper/msg_server_test.go index 78a0783a9..d969e5473 100644 --- a/x/incentive/keeper/msg_server_test.go +++ b/x/incentive/keeper/msg_server_test.go @@ -63,3 +63,55 @@ func FuzzWithdrawReward(f *testing.F) { require.True(t, newRg.IsFullyWithdrawn()) }) } + +func FuzzSetWithdrawAddr(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + // mock bank keeper + bk := types.NewMockBankKeeper(ctrl) + + ik, ctx := testkeeper.IncentiveKeeper(t, bk, nil, nil) + ms := keeper.NewMsgServerImpl(*ik) + + // generate and set a random reward gauge with a random set of withdrawable coins + rg := datagen.GenRandomRewardGauge(r) + rg.WithdrawnCoins = datagen.GenRandomWithdrawnCoins(r, rg.Coins) + sType := datagen.GenRandomStakeholderType(r) + sAddr := datagen.GenRandomAccount().GetAddress() + withdrawalAddr := datagen.GenRandomAccount().GetAddress() + + ik.SetRewardGauge(ctx, sType, sAddr, rg) + + // mock transfer of withdrawable coins + withdrawableCoins := rg.GetWithdrawableCoins() + bk.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Eq(types.ModuleName), gomock.Eq(withdrawalAddr), gomock.Eq(withdrawableCoins)).Times(1) + + _, err := ms.SetWithdrawAddress(ctx, &types.MsgSetWithdrawAddress{ + DelegatorAddress: sAddr.String(), + WithdrawAddress: withdrawalAddr.String(), + }) + require.NoError(t, err) + + rgauge := ik.GetRewardGauge(ctx, sType, sAddr) + require.NotNil(t, rgauge) + require.False(t, rgauge.IsFullyWithdrawn()) + + // invoke withdraw and assert consistency + resp, err := ms.WithdrawReward(ctx, &types.MsgWithdrawReward{ + Type: sType.String(), + Address: sAddr.String(), + }) + require.NoError(t, err) + require.Equal(t, withdrawableCoins, resp.Coins) + + // ensure reward gauge is now empty + newRg := ik.GetRewardGauge(ctx, sType, sAddr) + require.NotNil(t, newRg) + require.True(t, newRg.IsFullyWithdrawn()) + }) +} diff --git a/x/incentive/keeper/query_delegator.go b/x/incentive/keeper/query_delegator.go new file mode 100644 index 000000000..5c51af80c --- /dev/null +++ b/x/incentive/keeper/query_delegator.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + "github.com/babylonlabs-io/babylon/x/incentive/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) DelegatorWithdrawAddress(goCtx context.Context, req *types.QueryDelegatorWithdrawAddressRequest) (*types.QueryDelegatorWithdrawAddressResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + delegatorAddress, err := sdk.AccAddressFromBech32(req.DelegatorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + withdrawAddr, err := k.GetWithdrawAddr(ctx, delegatorAddress) + if err != nil { + return nil, err + } + + return &types.QueryDelegatorWithdrawAddressResponse{WithdrawAddress: withdrawAddr.String()}, nil +} diff --git a/x/incentive/keeper/query_delegator_test.go b/x/incentive/keeper/query_delegator_test.go new file mode 100644 index 000000000..c65d2e5a6 --- /dev/null +++ b/x/incentive/keeper/query_delegator_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "github.com/babylonlabs-io/babylon/testutil/datagen" + testkeeper "github.com/babylonlabs-io/babylon/testutil/keeper" + "github.com/babylonlabs-io/babylon/x/incentive/types" + "github.com/stretchr/testify/require" + "testing" +) + +func TestDelegatorAddressQuery(t *testing.T) { + keeper, ctx := testkeeper.IncentiveKeeper(t, nil, nil, nil) + withdrawalAddr := datagen.GenRandomAccount().GetAddress() + delegatorAddr := datagen.GenRandomAccount().GetAddress() + err := keeper.SetWithdrawAddr(ctx, delegatorAddr, withdrawalAddr) + require.NoError(t, err) + + response, err := keeper.DelegatorWithdrawAddress(ctx, &types.QueryDelegatorWithdrawAddressRequest{DelegatorAddress: delegatorAddr.String()}) + require.NoError(t, err) + require.Equal(t, &types.QueryDelegatorWithdrawAddressResponse{WithdrawAddress: withdrawalAddr.String()}, response) +} diff --git a/x/incentive/keeper/reward_gauge.go b/x/incentive/keeper/reward_gauge.go index 0da3f94cb..d05a66e0b 100644 --- a/x/incentive/keeper/reward_gauge.go +++ b/x/incentive/keeper/reward_gauge.go @@ -20,8 +20,19 @@ func (k Keeper) withdrawReward(ctx context.Context, sType types.StakeholderType, if !withdrawableCoins.IsAllPositive() { return nil, types.ErrNoWithdrawableCoins } + + withdrawAddr, err := k.GetWithdrawAddr(ctx, addr) + if err != nil { + return nil, err + } + + // Fallback to the stakeholder's address if no specific withdrawal address is set + if withdrawAddr == nil { + withdrawAddr = addr + } + // transfer withdrawable coins from incentive module account to the stakeholder's address - if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, withdrawableCoins); err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, withdrawAddr, withdrawableCoins); err != nil { return nil, err } // empty reward gauge diff --git a/x/incentive/keeper/store.go b/x/incentive/keeper/store.go new file mode 100644 index 000000000..e93b1573a --- /dev/null +++ b/x/incentive/keeper/store.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + "github.com/babylonlabs-io/babylon/x/incentive/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) GetWithdrawAddr(ctx context.Context, addr sdk.AccAddress) (sdk.AccAddress, error) { + store := k.storeService.OpenKVStore(ctx) + b, err := store.Get(types.GetWithdrawAddrKey(addr)) + if b == nil { + return addr, err + } + + return b, nil +} + +func (k Keeper) SetWithdrawAddr(ctx context.Context, addr, withdrawAddr sdk.AccAddress) error { + store := k.storeService.OpenKVStore(ctx) + + return store.Set(types.GetWithdrawAddrKey(addr), withdrawAddr.Bytes()) +} diff --git a/x/incentive/types/keys.go b/x/incentive/types/keys.go index a7aeced74..75331f5a7 100644 --- a/x/incentive/types/keys.go +++ b/x/incentive/types/keys.go @@ -1,6 +1,10 @@ package types -import "cosmossdk.io/collections" +import ( + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" +) const ( // ModuleName defines the module name @@ -17,9 +21,14 @@ const ( ) var ( - ParamsKey = []byte{0x01} // key prefix for the parameters - BTCStakingGaugeKey = []byte{0x02} // key prefix for BTC staking gauge at each height - ReservedKey = []byte{0x03} // reserved //nolint:unused - RewardGaugeKey = []byte{0x04} // key prefix for reward gauge for a given stakeholder in a given type - RefundableMsgKeySetPrefix = collections.NewPrefix(5) // key prefix for refundable msg key set + ParamsKey = []byte{0x01} // key prefix for the parameters + BTCStakingGaugeKey = []byte{0x02} // key prefix for BTC staking gauge at each height + DelegatorWithdrawAddrPrefix = []byte{0x03} // key for delegator withdraw address + RewardGaugeKey = []byte{0x04} // key prefix for reward gauge for a given stakeholder in a given type + RefundableMsgKeySetPrefix = collections.NewPrefix(5) // key prefix for refundable msg key set ) + +// GetWithdrawAddrKey creates the key for a delegator's withdraw addr. +func GetWithdrawAddrKey(delAddr sdk.AccAddress) []byte { + return append(DelegatorWithdrawAddrPrefix, address.MustLengthPrefix(delAddr.Bytes())...) +} diff --git a/x/incentive/types/query.pb.go b/x/incentive/types/query.pb.go index baab5bc94..5feac9fe5 100644 --- a/x/incentive/types/query.pb.go +++ b/x/incentive/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -402,6 +403,86 @@ func (m *QueryBTCStakingGaugeResponse) GetGauge() *BTCStakingGaugeResponse { return nil } +// QueryDelegatorWithdrawAddressRequest is the request type for the +// Query/DelegatorWithdrawAddress RPC method. +type QueryDelegatorWithdrawAddressRequest struct { + // delegator_address defines the delegator address to query for. + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *QueryDelegatorWithdrawAddressRequest) Reset() { *m = QueryDelegatorWithdrawAddressRequest{} } +func (m *QueryDelegatorWithdrawAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorWithdrawAddressRequest) ProtoMessage() {} +func (*QueryDelegatorWithdrawAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e1a59cc0c7c44135, []int{8} +} +func (m *QueryDelegatorWithdrawAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorWithdrawAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.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 *QueryDelegatorWithdrawAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.Merge(m, src) +} +func (m *QueryDelegatorWithdrawAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorWithdrawAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorWithdrawAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorWithdrawAddressRequest proto.InternalMessageInfo + +// QueryDelegatorWithdrawAddressResponse is the response type for the +// Query/DelegatorWithdrawAddress RPC method. +type QueryDelegatorWithdrawAddressResponse struct { + // withdraw_address defines the delegator address to query for. + WithdrawAddress string `protobuf:"bytes,1,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` +} + +func (m *QueryDelegatorWithdrawAddressResponse) Reset() { *m = QueryDelegatorWithdrawAddressResponse{} } +func (m *QueryDelegatorWithdrawAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorWithdrawAddressResponse) ProtoMessage() {} +func (*QueryDelegatorWithdrawAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e1a59cc0c7c44135, []int{9} +} +func (m *QueryDelegatorWithdrawAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorWithdrawAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.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 *QueryDelegatorWithdrawAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.Merge(m, src) +} +func (m *QueryDelegatorWithdrawAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorWithdrawAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorWithdrawAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorWithdrawAddressResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "babylon.incentive.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "babylon.incentive.QueryParamsResponse") @@ -412,53 +493,63 @@ func init() { proto.RegisterType((*QueryBTCStakingGaugeRequest)(nil), "babylon.incentive.QueryBTCStakingGaugeRequest") proto.RegisterType((*BTCStakingGaugeResponse)(nil), "babylon.incentive.BTCStakingGaugeResponse") proto.RegisterType((*QueryBTCStakingGaugeResponse)(nil), "babylon.incentive.QueryBTCStakingGaugeResponse") + proto.RegisterType((*QueryDelegatorWithdrawAddressRequest)(nil), "babylon.incentive.QueryDelegatorWithdrawAddressRequest") + proto.RegisterType((*QueryDelegatorWithdrawAddressResponse)(nil), "babylon.incentive.QueryDelegatorWithdrawAddressResponse") } func init() { proto.RegisterFile("babylon/incentive/query.proto", fileDescriptor_e1a59cc0c7c44135) } var fileDescriptor_e1a59cc0c7c44135 = []byte{ - // 644 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x6f, 0xd3, 0x30, - 0x14, 0x6f, 0xba, 0xb5, 0x08, 0x33, 0x18, 0x33, 0x13, 0xb4, 0xdd, 0xc8, 0x58, 0x24, 0x60, 0x02, - 0x1a, 0xd3, 0x95, 0x89, 0x3f, 0x12, 0x08, 0x75, 0x42, 0x9c, 0x40, 0x10, 0x38, 0x71, 0x29, 0x4e, - 0x6a, 0xa5, 0x51, 0x5b, 0xbb, 0x8b, 0xdd, 0x96, 0x32, 0x76, 0xe1, 0x13, 0x20, 0xf1, 0x15, 0xb8, - 0xc0, 0x27, 0xd9, 0x71, 0x12, 0x12, 0xe2, 0x04, 0xa8, 0xe5, 0xc4, 0x85, 0xaf, 0x80, 0x62, 0xbb, - 0x55, 0x4a, 0x53, 0x31, 0x24, 0xc4, 0x29, 0x8e, 0xdf, 0xfb, 0xbd, 0xdf, 0xef, 0xf9, 0xfd, 0x6c, - 0x70, 0xd6, 0xc5, 0x6e, 0xbf, 0xc9, 0x28, 0x0a, 0xa8, 0x47, 0xa8, 0x08, 0xba, 0x04, 0xed, 0x74, - 0x48, 0xd8, 0xb7, 0xdb, 0x21, 0x13, 0x0c, 0x2e, 0xe9, 0xb0, 0x3d, 0x0e, 0x17, 0x96, 0x7d, 0xe6, - 0x33, 0x19, 0x45, 0xd1, 0x4a, 0x25, 0x16, 0x56, 0x7d, 0xc6, 0xfc, 0x26, 0x41, 0xb8, 0x1d, 0x20, - 0x4c, 0x29, 0x13, 0x58, 0x04, 0x8c, 0x72, 0x1d, 0x35, 0xa7, 0x59, 0xda, 0x38, 0xc4, 0xad, 0x51, - 0x7c, 0x7d, 0x3a, 0x3e, 0x5e, 0x8d, 0x4a, 0x78, 0x8c, 0xb7, 0x18, 0x47, 0x2e, 0xe6, 0x04, 0x75, - 0x4b, 0x2e, 0x11, 0x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5, 0xaf, 0x00, 0x7c, 0x6f, 0x80, 0xc5, 0xdf, 0xce, 0x13, 0xda, 0xb3, 0xc8, 0x93, 0x8d, - 0x56, 0x40, 0x87, 0xce, 0xd7, 0x7a, 0xb7, 0xa4, 0x5e, 0x04, 0x8b, 0x09, 0x7a, 0x5d, 0xe1, 0x55, - 0xb9, 0x02, 0x29, 0x89, 0x68, 0x57, 0xf9, 0x76, 0xaf, 0xf2, 0x60, 0x7f, 0x60, 0x1a, 0x07, 0x03, - 0xd3, 0xf8, 0x36, 0x30, 0x8d, 0x37, 0x43, 0x33, 0x75, 0x30, 0x34, 0x53, 0x9f, 0x87, 0x66, 0xea, - 0x59, 0x39, 0xe6, 0x42, 0x5d, 0xb2, 0x89, 0x5d, 0x5e, 0x0c, 0xd8, 0x98, 0xe1, 0x45, 0x8c, 0x43, - 0xda, 0xd2, 0xcd, 0xca, 0x07, 0xbc, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xe8, 0x0e, 0x15, - 0x8b, 0x06, 0x00, 0x00, + // 775 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0xee, 0x16, 0x5a, 0x75, 0x44, 0x81, 0xb1, 0xd1, 0xb6, 0x60, 0x2b, 0x1b, 0x51, 0xa2, 0x76, + 0x47, 0x40, 0x02, 0x92, 0x68, 0xb4, 0x40, 0x4c, 0x4c, 0x34, 0xba, 0x98, 0x98, 0x78, 0xa9, 0xb3, + 0xed, 0x64, 0xbb, 0xa1, 0xec, 0x94, 0x9d, 0x69, 0x6b, 0x45, 0x2e, 0x9e, 0x3c, 0x9a, 0xf8, 0x07, + 0x38, 0x78, 0xd1, 0xa3, 0xf1, 0x47, 0x70, 0x24, 0x7a, 0xd1, 0x8b, 0x1a, 0xf0, 0x60, 0xbc, 0xf8, + 0x17, 0x4c, 0x67, 0x66, 0x9b, 0x96, 0xee, 0x06, 0x48, 0x8c, 0xa7, 0xce, 0xcc, 0x7b, 0xdf, 0x7c, + 0xdf, 0x37, 0xfb, 0xde, 0x2b, 0x38, 0x6b, 0x61, 0xab, 0x59, 0xa1, 0x2e, 0x72, 0xdc, 0x22, 0x71, + 0xb9, 0x53, 0x27, 0x68, 0xad, 0x46, 0xbc, 0xa6, 0x51, 0xf5, 0x28, 0xa7, 0x70, 0x58, 0x85, 0x8d, + 0x76, 0x38, 0x9d, 0xb0, 0xa9, 0x4d, 0x45, 0x14, 0xb5, 0x56, 0x32, 0x31, 0x3d, 0x6a, 0x53, 0x6a, + 0x57, 0x08, 0xc2, 0x55, 0x07, 0x61, 0xd7, 0xa5, 0x1c, 0x73, 0x87, 0xba, 0x4c, 0x45, 0x33, 0xbd, + 0x2c, 0x55, 0xec, 0xe1, 0x55, 0x3f, 0x3e, 0xd6, 0x1b, 0x6f, 0xaf, 0xfc, 0x2b, 0x8a, 0x94, 0xad, + 0x52, 0x86, 0x2c, 0xcc, 0x08, 0xaa, 0x4f, 0x5a, 0x84, 0xe3, 0x49, 0x54, 0xa4, 0x8e, 0xab, 0xe2, + 0x29, 0x19, 0x2f, 0x48, 0x65, 0x72, 0x23, 0x43, 0x7a, 0x02, 0xc0, 0x87, 0x2d, 0x4f, 0x0f, 0x04, + 0xa5, 0x49, 0xd6, 0x6a, 0x84, 0x71, 0xfd, 0x3e, 0x38, 0xd5, 0x75, 0xca, 0xaa, 0xd4, 0x65, 0x04, + 0xce, 0x82, 0xb8, 0x94, 0x96, 0xd4, 0xce, 0x69, 0x13, 0xc7, 0xa7, 0x52, 0x46, 0xcf, 0x13, 0x18, + 0x12, 0x92, 0xef, 0xdf, 0xfa, 0x96, 0x8d, 0x98, 0x2a, 0x5d, 0xbf, 0x06, 0x92, 0xe2, 0x3e, 0x93, + 0x34, 0xb0, 0x57, 0xba, 0x83, 0x6b, 0x36, 0xf1, 0xb9, 0x60, 0x12, 0x1c, 0x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16, 0x1b, 0xa8, 0xb3, 0xe7, 0xe1, 0x3b, + 0x0d, 0x0c, 0xee, 0x29, 0x20, 0x68, 0x84, 0x91, 0x07, 0x77, 0x56, 0x1a, 0x1d, 0x38, 0x5f, 0xe9, + 0x9d, 0x11, 0x7a, 0x11, 0xcc, 0x05, 0xe8, 0xb5, 0x78, 0xb1, 0xc0, 0x24, 0x48, 0x4a, 0x44, 0xeb, + 0xb2, 0x51, 0x37, 0xe0, 0x57, 0x0d, 0x24, 0xc3, 0x8a, 0x09, 0xce, 0x86, 0x89, 0xd8, 0xa7, 0xee, + 0xd3, 0x73, 0x87, 0x07, 0x2a, 0x1b, 0x77, 0x85, 0x8d, 0x45, 0x98, 0x0f, 0xb0, 0xd1, 0xee, 0x0b, + 0x86, 0xd6, 0x7b, 0xda, 0x6a, 0x03, 0xed, 0xad, 0xf7, 0xfc, 0xbd, 0xad, 0x9d, 0x8c, 0xb6, 0xbd, + 0x93, 0xd1, 0x7e, 0xec, 0x64, 0xb4, 0xd7, 0xbb, 0x99, 0xc8, 0xf6, 0x6e, 0x26, 0xf2, 0x65, 0x37, + 0x13, 0x79, 0x32, 0xdd, 0x31, 0x52, 0x14, 0x4f, 0x05, 0x5b, 0x2c, 0xe7, 0xd0, 0x36, 0xed, 0xb3, + 0x0e, 0x62, 0x31, 0x63, 0xac, 0xb8, 0xf8, 0x37, 0x9e, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x3d, + 0xa7, 0x53, 0xdf, 0x73, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -479,6 +570,8 @@ type QueryClient interface { RewardGauges(ctx context.Context, in *QueryRewardGaugesRequest, opts ...grpc.CallOption) (*QueryRewardGaugesResponse, error) // BTCStakingGauge queries the BTC staking gauge of a given height BTCStakingGauge(ctx context.Context, in *QueryBTCStakingGaugeRequest, opts ...grpc.CallOption) (*QueryBTCStakingGaugeResponse, error) + // DelegatorWithdrawAddress queries withdraw address of a delegator. + DelegatorWithdrawAddress(ctx context.Context, in *QueryDelegatorWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryDelegatorWithdrawAddressResponse, error) } type queryClient struct { @@ -516,6 +609,15 @@ func (c *queryClient) BTCStakingGauge(ctx context.Context, in *QueryBTCStakingGa return out, nil } +func (c *queryClient) DelegatorWithdrawAddress(ctx context.Context, in *QueryDelegatorWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryDelegatorWithdrawAddressResponse, error) { + out := new(QueryDelegatorWithdrawAddressResponse) + err := c.cc.Invoke(ctx, "/babylon.incentive.Query/DelegatorWithdrawAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -524,6 +626,8 @@ type QueryServer interface { RewardGauges(context.Context, *QueryRewardGaugesRequest) (*QueryRewardGaugesResponse, error) // BTCStakingGauge queries the BTC staking gauge of a given height BTCStakingGauge(context.Context, *QueryBTCStakingGaugeRequest) (*QueryBTCStakingGaugeResponse, error) + // DelegatorWithdrawAddress queries withdraw address of a delegator. + DelegatorWithdrawAddress(context.Context, *QueryDelegatorWithdrawAddressRequest) (*QueryDelegatorWithdrawAddressResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -539,6 +643,9 @@ func (*UnimplementedQueryServer) RewardGauges(ctx context.Context, req *QueryRew func (*UnimplementedQueryServer) BTCStakingGauge(ctx context.Context, req *QueryBTCStakingGaugeRequest) (*QueryBTCStakingGaugeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BTCStakingGauge not implemented") } +func (*UnimplementedQueryServer) DelegatorWithdrawAddress(ctx context.Context, req *QueryDelegatorWithdrawAddressRequest) (*QueryDelegatorWithdrawAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorWithdrawAddress not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -598,6 +705,24 @@ func _Query_BTCStakingGauge_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_DelegatorWithdrawAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorWithdrawAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorWithdrawAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.incentive.Query/DelegatorWithdrawAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorWithdrawAddress(ctx, req.(*QueryDelegatorWithdrawAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.incentive.Query", HandlerType: (*QueryServer)(nil), @@ -614,6 +739,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "BTCStakingGauge", Handler: _Query_BTCStakingGauge_Handler, }, + { + MethodName: "DelegatorWithdrawAddress", + Handler: _Query_DelegatorWithdrawAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "babylon/incentive/query.proto", @@ -905,6 +1034,66 @@ func (m *QueryBTCStakingGaugeResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *QueryDelegatorWithdrawAddressRequest) 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 *QueryDelegatorWithdrawAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorWithdrawAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorWithdrawAddressResponse) 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 *QueryDelegatorWithdrawAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorWithdrawAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1032,6 +1221,32 @@ func (m *QueryBTCStakingGaugeResponse) Size() (n int) { return n } +func (m *QueryDelegatorWithdrawAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorWithdrawAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1789,6 +2004,170 @@ func (m *QueryBTCStakingGaugeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryDelegatorWithdrawAddressRequest) 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: QueryDelegatorWithdrawAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = 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 *QueryDelegatorWithdrawAddressResponse) 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: QueryDelegatorWithdrawAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = 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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentive/types/query.pb.gw.go b/x/incentive/types/query.pb.gw.go index 27215ac49..61e86024c 100644 --- a/x/incentive/types/query.pb.gw.go +++ b/x/incentive/types/query.pb.gw.go @@ -159,6 +159,60 @@ func local_request_Query_BTCStakingGauge_0(ctx context.Context, marshaler runtim } +func request_Query_DelegatorWithdrawAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorWithdrawAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.DelegatorWithdrawAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorWithdrawAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorWithdrawAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.DelegatorWithdrawAddress(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. @@ -234,6 +288,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_DelegatorWithdrawAddress_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_DelegatorWithdrawAddress_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_DelegatorWithdrawAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -335,6 +412,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_DelegatorWithdrawAddress_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_DelegatorWithdrawAddress_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_DelegatorWithdrawAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -344,6 +441,8 @@ var ( pattern_Query_RewardGauges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"babylon", "incentive", "address", "reward_gauge"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_BTCStakingGauge_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"babylon", "incentive", "btc_staking_gauge", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorWithdrawAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"babylon", "incentive", "delegators", "delegator_address", "withdraw_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -352,4 +451,6 @@ var ( forward_Query_RewardGauges_0 = runtime.ForwardResponseMessage forward_Query_BTCStakingGauge_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorWithdrawAddress_0 = runtime.ForwardResponseMessage ) diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 93306f8d7..9cc44c4e3 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -231,47 +231,145 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgSetWithdrawAddress sets the withdraw address +type MsgSetWithdrawAddress struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` +} + +func (m *MsgSetWithdrawAddress) Reset() { *m = MsgSetWithdrawAddress{} } +func (m *MsgSetWithdrawAddress) String() string { return proto.CompactTextString(m) } +func (*MsgSetWithdrawAddress) ProtoMessage() {} +func (*MsgSetWithdrawAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_b4de6776d39a3a22, []int{4} +} +func (m *MsgSetWithdrawAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetWithdrawAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetWithdrawAddress.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 *MsgSetWithdrawAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetWithdrawAddress.Merge(m, src) +} +func (m *MsgSetWithdrawAddress) XXX_Size() int { + return m.Size() +} +func (m *MsgSetWithdrawAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetWithdrawAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo + +func (m *MsgSetWithdrawAddress) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *MsgSetWithdrawAddress) GetWithdrawAddress() string { + if m != nil { + return m.WithdrawAddress + } + return "" +} + +// 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_b4de6776d39a3a22, []int{5} +} +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 + func init() { proto.RegisterType((*MsgWithdrawReward)(nil), "babylon.incentive.MsgWithdrawReward") proto.RegisterType((*MsgWithdrawRewardResponse)(nil), "babylon.incentive.MsgWithdrawRewardResponse") proto.RegisterType((*MsgUpdateParams)(nil), "babylon.incentive.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "babylon.incentive.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSetWithdrawAddress)(nil), "babylon.incentive.MsgSetWithdrawAddress") + proto.RegisterType((*MsgSetWithdrawAddressResponse)(nil), "babylon.incentive.MsgSetWithdrawAddressResponse") } func init() { proto.RegisterFile("babylon/incentive/tx.proto", fileDescriptor_b4de6776d39a3a22) } var fileDescriptor_b4de6776d39a3a22 = []byte{ - // 469 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0xd8, 0x1f, 0xd2, 0xb1, 0x54, 0x3a, 0x14, 0xba, 0xd9, 0xc3, 0xb6, 0x2c, 0x1e, 0x42, - 0x30, 0x3b, 0xa6, 0x05, 0x85, 0xde, 0x8c, 0xe7, 0xa0, 0xac, 0x88, 0xe0, 0x41, 0x99, 0xcd, 0x0e, - 0x93, 0xc1, 0xee, 0xce, 0xb2, 0x6f, 0x9a, 0x36, 0x17, 0x11, 0xff, 0x02, 0xf1, 0xcf, 0xf0, 0xd4, - 0x83, 0x7f, 0x44, 0x8f, 0xa5, 0x27, 0x4f, 0x2a, 0xc9, 0xa1, 0xff, 0x86, 0xcc, 0xce, 0x6c, 0x1b, - 0xbb, 0x05, 0x7b, 0x9a, 0x79, 0xf9, 0xbe, 0xf9, 0xde, 0xf7, 0xbe, 0x97, 0xc5, 0x7e, 0xc2, 0x92, - 0xe9, 0xa1, 0xca, 0xa9, 0xcc, 0x47, 0x3c, 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x00, 0x00, + // 550 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0xf6, 0x0f, 0xcd, 0x4c, 0xdb, 0x6a, 0x0d, 0x96, 0x46, 0x22, 0x9d, 0x22, 0x0e, 0x55, + 0x45, 0x93, 0x75, 0x93, 0x40, 0xea, 0x8d, 0x4e, 0x1c, 0x23, 0x50, 0x26, 0x84, 0xc4, 0x81, 0xca, + 0x69, 0x2c, 0x37, 0xa2, 0x8d, 0xa3, 0xd8, 0x6b, 0xd7, 0x0b, 0x42, 0x7c, 0x02, 0xc4, 0xc7, 0xe0, + 0xb4, 0x03, 0x37, 0xae, 0x1c, 0x76, 0x9c, 0x38, 0x71, 0x02, 0xd4, 0x1e, 0xf6, 0x35, 0x90, 0x13, + 0xbb, 0x6b, 0x97, 0x88, 0xf5, 0x14, 0xff, 0xfa, 0x9e, 0x9f, 0xdf, 0xef, 0xfd, 0xec, 0x02, 0xc3, + 0x47, 0xfe, 0xb8, 0x4f, 0x23, 0x27, 0x8c, 0xba, 0x38, 0xe2, 0xe1, 0x10, 0x3b, 0xfc, 0xdc, 0x8e, + 0x13, 0xca, 0x29, 0x2c, 0x4b, 0xcc, 0x9e, 0x61, 0xc6, 0x1e, 0xa1, 0x84, 0xa6, 0xa8, 0x23, 0x56, + 0x19, 0xd1, 0xa8, 0x74, 0x29, 0x1b, 0x50, 0xd6, 0xc9, 0x80, 0xac, 0x90, 0xd0, 0x7e, 0x56, 0x39, + 0x03, 0x46, 0x9c, 0x61, 0x53, 0x7c, 0x24, 0x60, 0x4a, 0xc0, 0x47, 0x0c, 0x3b, 0xc3, 0xa6, 0x8f, + 0x39, 0x6a, 0x3a, 0x5d, 0x1a, 0x46, 0x0a, 0xcf, 0x1b, 0x8b, 0x51, 0x82, 0x06, 0x52, 0xd8, 0x7a, + 0x09, 0xca, 0x2e, 0x23, 0x6f, 0x42, 0xde, 0x0b, 0x12, 0x34, 0xf2, 0xf0, 0x08, 0x25, 0x01, 0x84, + 0x60, 0x8d, 0x8f, 0x63, 0xac, 0x6b, 0x07, 0x5a, 0x6d, 0xd3, 0x4b, 0xd7, 0x50, 0x07, 0xf7, 0x50, + 0x10, 0x24, 0x98, 0x31, 0x7d, 0x25, 0xfd, 0x59, 0x95, 0xad, 0xad, 0x4f, 0xd7, 0x17, 0x75, 0x55, + 0x59, 0x1f, 0x40, 0x25, 0x27, 0xe8, 0x61, 0x16, 0xd3, 0x88, 0x61, 0x88, 0xc0, 0xba, 0xf0, 0xc6, + 0x74, 0xed, 0x60, 0xb5, 0x76, 0xff, 0xa8, 0x62, 0xcb, 0x26, 0x85, 0x7b, 0x5b, 0xba, 0xb7, 0x4f, + 0x68, 0x18, 0xb5, 0x0f, 0x2f, 0x7f, 0x57, 0x4b, 0x5f, 0xff, 0x54, 0x6b, 0x24, 0xe4, 0xbd, 0x33, + 0xdf, 0xee, 0xd2, 0x81, 0x4c, 0x44, 0x7e, 0x1a, 0x2c, 0x78, 0xef, 0x08, 0x67, 0x2c, 0xdd, 0xc0, + 0xbc, 0x4c, 0xd9, 0xfa, 0xa2, 0x81, 0x1d, 0x97, 0x91, 0xd7, 0x71, 0x80, 0x38, 0x7e, 0x95, 0xb6, + 0x0a, 0x9f, 0x82, 0x4d, 0x74, 0xc6, 0x7b, 0x34, 0x09, 0xf9, 0x38, 0x6b, 0xaa, 0xad, 0xff, 0xfc, + 0xd6, 0xd8, 0x93, 0xa7, 0x3f, 0xcf, 0xac, 0x9f, 0xf2, 0x24, 0x8c, 0x88, 0x77, 0x43, 0x85, 0xcf, + 0xc0, 0x46, 0x16, 0x56, 0xda, 0xb2, 0xf0, 0x9b, 0x1b, 0xa5, 0x9d, 0x1d, 0xd1, 0x5e, 0x13, 0x7e, + 0x3d, 0x49, 0x6f, 0x6d, 0x8b, 0x48, 0x6e, 0x84, 0xac, 0x0a, 0xd8, 0xbf, 0xe5, 0x49, 0x45, 0x62, + 0x7d, 0xd7, 0xc0, 0x03, 0x97, 0x91, 0x53, 0xcc, 0x55, 0x66, 0xd2, 0x0e, 0x7c, 0x01, 0xca, 0x01, + 0xee, 0x63, 0x82, 0x38, 0x4d, 0x3a, 0x2a, 0xfb, 0xbb, 0xdc, 0xef, 0xce, 0xb6, 0x28, 0x99, 0x13, + 0xb0, 0x3b, 0x92, 0xca, 0x9d, 0x85, 0x09, 0xfe, 0x47, 0x65, 0x67, 0xb4, 0xe8, 0xa5, 0xf5, 0x50, + 0x34, 0x94, 0xb7, 0x63, 0x55, 0xc1, 0xa3, 0x42, 0xf3, 0xaa, 0xbd, 0xa3, 0x1f, 0x2b, 0x60, 0xd5, + 0x65, 0x04, 0x06, 0x60, 0xfb, 0xd6, 0x25, 0x7b, 0x5c, 0x10, 0x66, 0xee, 0xe6, 0x18, 0x4f, 0x96, + 0x61, 0xcd, 0xee, 0xd7, 0x3b, 0xb0, 0xb5, 0x30, 0x78, 0xab, 0x78, 0xf7, 0x3c, 0xc7, 0xa8, 0xdf, + 0xcd, 0x99, 0xe9, 0xc7, 0x00, 0x16, 0x0c, 0xaa, 0x56, 0xac, 0x90, 0x67, 0x1a, 0x87, 0xcb, 0x32, + 0xd5, 0x89, 0xc6, 0xfa, 0xc7, 0xeb, 0x8b, 0xba, 0xd6, 0x76, 0x2f, 0x27, 0xa6, 0x76, 0x35, 0x31, + 0xb5, 0xbf, 0x13, 0x53, 0xfb, 0x3c, 0x35, 0x4b, 0x57, 0x53, 0xb3, 0xf4, 0x6b, 0x6a, 0x96, 0xde, + 0x1e, 0xcf, 0x3d, 0x10, 0x29, 0xde, 0x47, 0x3e, 0x6b, 0x84, 0x54, 0x95, 0xce, 0xf9, 0xfc, 0xbf, + 0x92, 0x78, 0x31, 0xfe, 0x46, 0xfa, 0xf8, 0x8f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xd2, + 0x38, 0x7d, 0xb7, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -290,6 +388,8 @@ type MsgClient interface { WithdrawReward(ctx context.Context, in *MsgWithdrawReward, opts ...grpc.CallOption) (*MsgWithdrawRewardResponse, error) // UpdateParams updates the incentive module parameters. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SetWithdrawAddress defines a method to change the withdraw address of a stakeholder + SetWithdrawAddress(ctx context.Context, in *MsgSetWithdrawAddress, opts ...grpc.CallOption) (*MsgSetWithdrawAddressResponse, error) } type msgClient struct { @@ -318,12 +418,23 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) SetWithdrawAddress(ctx context.Context, in *MsgSetWithdrawAddress, opts ...grpc.CallOption) (*MsgSetWithdrawAddressResponse, error) { + out := new(MsgSetWithdrawAddressResponse) + err := c.cc.Invoke(ctx, "/babylon.incentive.Msg/SetWithdrawAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // WithdrawReward defines a method to withdraw rewards of a stakeholder WithdrawReward(context.Context, *MsgWithdrawReward) (*MsgWithdrawRewardResponse, error) // UpdateParams updates the incentive module parameters. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SetWithdrawAddress defines a method to change the withdraw address of a stakeholder + SetWithdrawAddress(context.Context, *MsgSetWithdrawAddress) (*MsgSetWithdrawAddressResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -336,6 +447,9 @@ func (*UnimplementedMsgServer) WithdrawReward(ctx context.Context, req *MsgWithd func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) SetWithdrawAddress(ctx context.Context, req *MsgSetWithdrawAddress) (*MsgSetWithdrawAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetWithdrawAddress not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -377,6 +491,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +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: "/babylon.incentive.Msg/SetWithdrawAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetWithdrawAddress(ctx, req.(*MsgSetWithdrawAddress)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.incentive.Msg", HandlerType: (*MsgServer)(nil), @@ -389,6 +521,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "SetWithdrawAddress", + Handler: _Msg_SetWithdrawAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "babylon/incentive/tx.proto", @@ -531,6 +667,66 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgSetWithdrawAddress) 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 *MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + 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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -598,6 +794,32 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgSetWithdrawAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetWithdrawAddressResponse) 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 } @@ -967,6 +1189,170 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSetWithdrawAddress) 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: MsgSetWithdrawAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = 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 *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) || (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