diff --git a/CHANGELOG.md b/CHANGELOG.md index 28c5f44a..31baf043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,19 @@ ## [Unreleased] +### Improvements + +- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Allow protocol validator commission rewards to be claimed. + +### Client Breaking + +- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Include `MsgClaimCommissionRewards` for claiming commission rewards. + +### API Breaking + + +- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Emit an [event](https://github.com/KYVENetwork/chain/blob/main/x/stakers/spec/05_events.md#eventclaimcommissionrewards) when claiming protocol validator commission rewards. + ## [v1.2.1](https://github.com/KYVENetwork/chain/releases/tag/v1.2.1) - 2023-05-25 ### Bug Fixes diff --git a/proto/kyve/stakers/v1beta1/events.proto b/proto/kyve/stakers/v1beta1/events.proto index e7b162b9..693e8f15 100644 --- a/proto/kyve/stakers/v1beta1/events.proto +++ b/proto/kyve/stakers/v1beta1/events.proto @@ -61,6 +61,15 @@ message EventUpdateCommission { ]; } +// EventClaimCommissionRewards ... +// emitted_by: MsgClaimCommissionRewards +message EventClaimCommissionRewards { + // staker is the account address of the protocol node. + string staker = 1; + // amount ... + uint64 amount = 2; +} + // EventJoinPool ... // emitted_by: MsgJoinPool message EventJoinPool { diff --git a/proto/kyve/stakers/v1beta1/stakers.proto b/proto/kyve/stakers/v1beta1/stakers.proto index 44403fa9..de25b27b 100644 --- a/proto/kyve/stakers/v1beta1/stakers.proto +++ b/proto/kyve/stakers/v1beta1/stakers.proto @@ -26,6 +26,8 @@ message Staker { string security_contact = 6; // details are some additional notes the staker finds important string details = 7; + // commission_rewards are the rewards in $KYVE earned through commission + uint64 commission_rewards = 8; } // Valaccount gets authorized by a staker to diff --git a/proto/kyve/stakers/v1beta1/tx.proto b/proto/kyve/stakers/v1beta1/tx.proto index f64353f0..6bc2f041 100644 --- a/proto/kyve/stakers/v1beta1/tx.proto +++ b/proto/kyve/stakers/v1beta1/tx.proto @@ -15,6 +15,8 @@ service Msg { rpc UpdateMetadata(MsgUpdateMetadata) returns (MsgUpdateMetadataResponse); // UpdateCommission ... rpc UpdateCommission(MsgUpdateCommission) returns (MsgUpdateCommissionResponse); + // ClaimCommissionRewards ... + rpc ClaimCommissionRewards(MsgClaimCommissionRewards) returns (MsgClaimCommissionRewardsResponse); // JoinPool ... rpc JoinPool(MsgJoinPool) returns (MsgJoinPoolResponse); // LeavePool ... @@ -75,6 +77,17 @@ message MsgUpdateCommission { // MsgUpdateCommissionResponse ... message MsgUpdateCommissionResponse {} +// MsgClaimCommissionRewards ... +message MsgClaimCommissionRewards { + // creator ... + string creator = 1; + // amount ... + uint64 amount = 2; +} + +// MsgClaimCommissionRewardsResponse ... +message MsgClaimCommissionRewardsResponse {} + // MsgJoinPool ... message MsgJoinPool { // creator ... diff --git a/testutil/integration/checks.go b/testutil/integration/checks.go index 0a3ff216..3f6c55ba 100644 --- a/testutil/integration/checks.go +++ b/testutil/integration/checks.go @@ -8,6 +8,7 @@ import ( "github.com/KYVENetwork/chain/x/pool" querytypes "github.com/KYVENetwork/chain/x/query/types" "github.com/KYVENetwork/chain/x/stakers" + stakertypes "github.com/KYVENetwork/chain/x/stakers/types" "github.com/KYVENetwork/chain/x/team" "github.com/cosmos/cosmos-sdk/types/query" . "github.com/onsi/gomega" @@ -56,6 +57,7 @@ func (suite *KeeperTestSuite) VerifyPoolModuleAssetsIntegrity() { actualBalance := uint64(0) for _, pool := range suite.App().PoolKeeper.GetAllPools(suite.Ctx()) { + // pool funds should be in pool module for _, funder := range pool.Funders { expectedBalance += funder.Amount } @@ -166,17 +168,17 @@ func (suite *KeeperTestSuite) VerifyPoolGenesisImportExport() { // ===================== func (suite *KeeperTestSuite) VerifyStakersModuleAssetsIntegrity() { - //expectedBalance := uint64(0) - //actualBalance := uint64(0) - // - //for _, staker := range suite.App().StakersKeeper.GetAllStakers(suite.Ctx()) { - // expectedBalance += suite.App().DelegationKeeper - //} - // - //moduleAcc := suite.App().AccountKeeper.GetModuleAccount(suite.Ctx(), stakerstypes.ModuleName).GetAddress() - //actualBalance = suite.App().BankKeeper.GetBalance(suite.Ctx(), moduleAcc, globalTypes.Denom).Amount.Uint64() - // - //Expect(actualBalance).To(Equal(expectedBalance)) + expectedBalance := uint64(0) + actualBalance := uint64(0) + + for _, staker := range suite.App().StakersKeeper.GetAllStakers(suite.Ctx()) { + expectedBalance += staker.CommissionRewards + } + + moduleAcc := suite.App().AccountKeeper.GetModuleAccount(suite.Ctx(), stakertypes.ModuleName).GetAddress() + actualBalance = suite.App().BankKeeper.GetBalance(suite.Ctx(), moduleAcc, globalTypes.Denom).Amount.Uint64() + + Expect(actualBalance).To(Equal(expectedBalance)) } func (suite *KeeperTestSuite) VerifyPoolTotalStake() { diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index 213799ba..9a0585de 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -227,7 +227,9 @@ var _ = Describe("stakers leave", Ordered, func() { uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) }) diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 82948132..ad1b380f 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -188,7 +188,9 @@ var _ = Describe("valid bundles", Ordered, func() { uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) @@ -307,7 +309,9 @@ var _ = Describe("valid bundles", Ordered, func() { delegatorDelegationReward := uint64(sdk.NewDec(int64(totalDelegationReward)).Quo(sdk.NewDec(4)).Mul(sdk.NewDec(3)).TruncateInt64()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) // assert delegator delegation rewards @@ -451,7 +455,9 @@ var _ = Describe("valid bundles", Ordered, func() { uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) @@ -609,7 +615,9 @@ var _ = Describe("valid bundles", Ordered, func() { delegatorDelegationReward := uint64(sdk.NewDec(int64(totalDelegationReward)).Quo(sdk.NewDec(3)).Mul(sdk.NewDec(2)).TruncateInt64()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) // assert delegator delegation rewards @@ -619,7 +627,9 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) @@ -768,7 +778,9 @@ var _ = Describe("valid bundles", Ordered, func() { delegatorDelegationReward := uint64(sdk.NewDec(int64(totalDelegationReward)).Quo(sdk.NewDec(4)).Mul(sdk.NewDec(3)).TruncateInt64()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) // assert delegator delegation rewards @@ -777,11 +789,6 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) - // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) @@ -935,7 +942,9 @@ var _ = Describe("valid bundles", Ordered, func() { delegatorDelegationReward := uint64(sdk.NewDec(int64(totalDelegationReward)).Quo(sdk.NewDec(4)).Mul(sdk.NewDec(3)).TruncateInt64()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) // assert delegator delegation rewards @@ -944,11 +953,6 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) - // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) @@ -1112,7 +1116,9 @@ var _ = Describe("valid bundles", Ordered, func() { delegatorDelegationReward := uint64(sdk.NewDec(int64(totalDelegationReward)).Quo(sdk.NewDec(4)).Mul(sdk.NewDec(3)).TruncateInt64()) // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) // assert delegator delegation rewards @@ -1121,11 +1127,6 @@ var _ = Describe("valid bundles", Ordered, func() { // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeZero()) - // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + uploaderPayoutReward)) - // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) - // check pool funds pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index e4d2c634..e2a60931 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -390,8 +390,12 @@ var _ = Describe("valid bundles", Ordered, func() { treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + // assert payout transfer - Expect(balanceUploader).To(Equal(initialBalanceStaker0 + totalUploaderReward)) + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(totalUploaderReward)) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal.go b/x/bundles/keeper/msg_server_submit_bundle_proposal.go index f72efe04..5307fa36 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal.go @@ -3,12 +3,16 @@ package keeper import ( "context" - delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" - "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/bundles/types" - pooltypes "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" + + // Delegation + delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + // Pool + poolTypes "github.com/KYVENetwork/chain/x/pool/types" + // Stakers + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" ) // SubmitBundleProposal handles the logic of an SDK message that allows protocol nodes to submit a new bundle proposal. @@ -73,7 +77,7 @@ func (k msgServer) SubmitBundleProposal( k.SetBundleProposal(ctx, bundleProposal) // emit event which indicates that pool has run out of funds - _ = ctx.EventManager().EmitTypedEvent(&pooltypes.EventPoolOutOfFunds{ + _ = ctx.EventManager().EmitTypedEvent(&poolTypes.EventPoolOutOfFunds{ PoolId: msg.PoolId, }) @@ -85,19 +89,22 @@ func (k msgServer) SubmitBundleProposal( uploaderPayout := bundleReward.Uploader - delegationPayoutSuccessful := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleReward.Delegation, pooltypes.ModuleName) + delegationPayoutSuccessful := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleReward.Delegation, poolTypes.ModuleName) // If staker has no delegators add all delegation rewards to the staker rewards if !delegationPayoutSuccessful { uploaderPayout += bundleReward.Delegation } - // send commission to uploader - if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, pooltypes.ModuleName, bundleProposal.Uploader, uploaderPayout); err != nil { + // transfer funds from pool to stakers module + if err := util.TransferFromModuleToModule(k.bankKeeper, ctx, poolTypes.ModuleName, stakersTypes.ModuleName, uploaderPayout); err != nil { return nil, err } + // increase commission rewards of uploader + k.stakerKeeper.IncreaseStakerCommissionRewards(ctx, bundleProposal.Uploader, uploaderPayout) + // send network fee to treasury - if err := util.TransferFromModuleToTreasury(k.accountKeeper, k.distrkeeper, ctx, pooltypes.ModuleName, bundleReward.Treasury); err != nil { + if err := util.TransferFromModuleToTreasury(k.accountKeeper, k.distrkeeper, ctx, poolTypes.ModuleName, bundleReward.Treasury); err != nil { return nil, err } diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index 1b488f68..b30db737 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -42,6 +42,7 @@ type PoolKeeper interface { type StakerKeeper interface { GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (stakers []string) GetCommission(ctx sdk.Context, stakerAddress string) sdk.Dec + IncreaseStakerCommissionRewards(ctx sdk.Context, address string, amount uint64) AssertValaccountAuthorized(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) error DoesStakerExist(ctx sdk.Context, staker string) bool diff --git a/x/stakers/client/cli/tx.go b/x/stakers/client/cli/tx.go index f0420583..161d179d 100644 --- a/x/stakers/client/cli/tx.go +++ b/x/stakers/client/cli/tx.go @@ -23,6 +23,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdJoinPool()) cmd.AddCommand(CmdLeavePool()) cmd.AddCommand(CmdUpdateCommission()) + cmd.AddCommand(CmdClaimCommissionRewards()) cmd.AddCommand(CmdUpdateMetadata()) return cmd diff --git a/x/stakers/client/cli/tx_claim_commission_rewards.go b/x/stakers/client/cli/tx_claim_commission_rewards.go new file mode 100644 index 00000000..f90a9340 --- /dev/null +++ b/x/stakers/client/cli/tx_claim_commission_rewards.go @@ -0,0 +1,44 @@ +package cli + +import ( + "github.com/KYVENetwork/chain/x/stakers/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +func CmdClaimCommissionRewards() *cobra.Command { + cmd := &cobra.Command{ + Use: "claim-commission-rewards [amount]", + Short: "Broadcast message claim-commission-rewards", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + argAmount, err := cast.ToUint64E(args[0]) + if err != nil { + return err + } + + msg := types.MsgClaimCommissionRewards{ + Creator: clientCtx.GetFromAddress().String(), + Amount: argAmount, + } + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/stakers/keeper/getters_staker.go b/x/stakers/keeper/getters_staker.go index 588addde..e5922652 100644 --- a/x/stakers/keeper/getters_staker.go +++ b/x/stakers/keeper/getters_staker.go @@ -42,6 +42,15 @@ func (k Keeper) UpdateStakerCommission(ctx sdk.Context, address string, commissi } } +// IncreaseStakerCommissionRewards ... +func (k Keeper) IncreaseStakerCommissionRewards(ctx sdk.Context, address string, amount uint64) { + staker, found := k.GetStaker(ctx, address) + if found { + staker.CommissionRewards += amount + k.setStaker(ctx, staker) + } +} + // AddValaccountToPool adds a valaccount to a pool. // If valaccount already belongs to pool, nothing happens. func (k Keeper) AddValaccountToPool(ctx sdk.Context, poolId uint64, stakerAddress string, valaddress string) { diff --git a/x/stakers/keeper/msg_server_claim_commission_rewards.go b/x/stakers/keeper/msg_server_claim_commission_rewards.go new file mode 100644 index 00000000..7f2b4c24 --- /dev/null +++ b/x/stakers/keeper/msg_server_claim_commission_rewards.go @@ -0,0 +1,44 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" + "github.com/KYVENetwork/chain/x/stakers/types" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" +) + +// ClaimCommissionRewards ... +func (k msgServer) ClaimCommissionRewards(goCtx context.Context, msg *types.MsgClaimCommissionRewards) (*types.MsgClaimCommissionRewardsResponse, error) { + // Unwrap context and attempt to fetch the pool. + ctx := sdk.UnwrapSDKContext(goCtx) + + // Check if staker exists + staker, found := k.GetStaker(ctx, msg.Creator) + if !found { + return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrNoStaker.Error(), msg.Creator) + } + + // Check if amount can be claimed + if staker.CommissionRewards < msg.Amount { + return nil, types.ErrNotEnoughRewards.Wrapf("%d > %d", msg.Amount, staker.CommissionRewards) + } + + // send commission rewards from stakers module to claimer + if err := util.TransferFromModuleToAddress(k.bankKeeper, ctx, types.ModuleName, msg.Creator, msg.Amount); err != nil { + return nil, err + } + + // calculate new commission rewards and save + staker.CommissionRewards -= msg.Amount + k.setStaker(ctx, staker) + + _ = ctx.EventManager().EmitTypedEvent(&types.EventClaimCommissionRewards{ + Staker: msg.Creator, + Amount: msg.Amount, + }) + + return &types.MsgClaimCommissionRewardsResponse{}, nil +} diff --git a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go new file mode 100644 index 00000000..b2c93dfc --- /dev/null +++ b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go @@ -0,0 +1,345 @@ +package keeper_test + +import ( + i "github.com/KYVENetwork/chain/testutil/integration" + bundletypes "github.com/KYVENetwork/chain/x/bundles/types" + pooltypes "github.com/KYVENetwork/chain/x/pool/types" + stakertypes "github.com/KYVENetwork/chain/x/stakers/types" + sdk "github.com/cosmos/cosmos-sdk/types" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +/* + +TEST CASES - msg_server_claim_commission_rewards.go + +* Produce a valid bundle and check commission rewards // TODO: move to bundles module tests +* Claim with non-staker account +* Claim more rewards than available +* Claim zero rewards +* Claim partial rewards +* Claim partial rewards twice +* Claim all rewards + +*/ + +var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { + s := i.NewCleanChain() + + initialBalanceStaker0 := s.GetBalanceFromAddress(i.STAKER_0) + + BeforeEach(func() { + // init new clean chain + s = i.NewCleanChain() + + // create clean pool for every test case + s.App().PoolKeeper.AppendPool(s.Ctx(), pooltypes.Pool{ + Name: "PoolTest", + MaxBundleSize: 100, + StartKey: "0", + UploadInterval: 60, + OperatingCost: 10_000, + Protocol: &pooltypes.Protocol{ + Version: "0.0.0", + Binaries: "{}", + LastUpgrade: uint64(s.Ctx().BlockTime().Unix()), + }, + UpgradePlan: &pooltypes.UpgradePlan{}, + }) + + s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ + Creator: i.STAKER_0, + Amount: 100 * i.KYVE, + }) + + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_0, + PoolId: 0, + Valaddress: i.VALADDRESS_0, + }) + + initialBalanceStaker0 = s.GetBalanceFromAddress(i.STAKER_0) + + // create a valid bundle so that uploader earns commission rewards + s.RunTxPoolSuccess(&pooltypes.MsgFundPool{ + Creator: i.ALICE, + Id: 0, + Amount: 100 * i.KYVE, + }) + + s.RunTxBundlesSuccess(&bundletypes.MsgClaimUploaderRole{ + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, + PoolId: 0, + }) + + s.CommitAfterSeconds(60) + + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + DataSize: 100, + DataHash: "test_hash", + FromIndex: 0, + BundleSize: 100, + FromKey: "0", + ToKey: "99", + BundleSummary: "test_value", + }) + + s.CommitAfterSeconds(60) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", + DataSize: 100, + DataHash: "test_hash2", + FromIndex: 100, + BundleSize: 100, + FromKey: "100", + ToKey: "199", + BundleSummary: "test_value2", + }) + }) + + AfterEach(func() { + s.PerformValidityChecks() + }) + + It("Produce a valid bundle and check commission rewards", func() { + // ASSERT + // check if bundle got finalized on pool + pool, poolFound := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + Expect(poolFound).To(BeTrue()) + + Expect(pool.CurrentKey).To(Equal("99")) + Expect(pool.CurrentSummary).To(Equal("test_value")) + Expect(pool.CurrentIndex).To(Equal(uint64(100))) + Expect(pool.TotalBundles).To(Equal(uint64(1))) + + // calculate uploader rewards + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) + + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + + // assert payout transfer + Expect(balanceUploader).To(Equal(initialBalanceStaker0)) + // assert uploader self delegation rewards + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(uploaderDelegationReward)) + + // assert commission rewards + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) + + // check pool funds + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(pool.Funders).To(HaveLen(1)) + Expect(pool.GetFunderAmount(i.ALICE)).To(Equal(100*i.KYVE - totalReward)) + }) + + It("Claim with non-staker account", func() { + // ACT + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_1, + Amount: 1, + }) + + // ASSERT + Expect(err).To(HaveOccurred()) + + // assert commission rewards + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0)) + }) + + It("Claim more rewards than available", func() { + // ACT + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_1, + Amount: uploader.CommissionRewards + 1, + }) + + // ASSERT + Expect(err).To(HaveOccurred()) + + // assert commission rewards + uploader, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) + }) + + It("Claim zero rewards", func() { + // ACT + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_0, + Amount: 0, + }) + + // ASSERT + Expect(err).NotTo(HaveOccurred()) + + // assert commission rewards + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward)) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0)) + }) + + It("Claim partial rewards", func() { + // ACT + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_0, + Amount: 100, + }) + + // ASSERT + Expect(err).NotTo(HaveOccurred()) + + // assert commission rewards + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward - 100)) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0 + 100)) + }) + + It("Claim partial rewards twice", func() { + // ACT + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_0, + Amount: 100, + }) + + // ASSERT + Expect(err).NotTo(HaveOccurred()) + + // assert commission rewards + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward := totalReward - treasuryReward + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward - 100)) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0 + 100)) + + // ACT + s.CommitAfterSeconds(60) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", + DataSize: 100, + DataHash: "test_hash3", + FromIndex: 200, + BundleSize: 100, + FromKey: "200", + ToKey: "299", + BundleSummary: "test_value3", + }) + + _, err = s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_0, + Amount: 200, + }) + + // ASSERT + Expect(err).NotTo(HaveOccurred()) + + // assert commission rewards + uploader, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + totalReward = uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost + networkFee = s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + + treasuryReward = uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) + totalUploaderReward = totalReward - treasuryReward + uploaderPayoutReward = 2 * uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) + + Expect(uploader.CommissionRewards).To(Equal(uploaderPayoutReward - 300)) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0 + 300)) + }) + + It("Claim all rewards", func() { + // ACT + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + rewards := uploader.CommissionRewards + + _, err := s.RunTx(&stakertypes.MsgClaimCommissionRewards{ + Creator: i.STAKER_0, + Amount: rewards, + }) + + // ASSERT + Expect(err).NotTo(HaveOccurred()) + + // assert commission rewards + uploader, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + Expect(uploader.CommissionRewards).To(BeZero()) + + Expect(s.GetBalanceFromAddress(i.STAKER_0)).To(Equal(initialBalanceStaker0 + rewards)) + }) +}) diff --git a/x/stakers/spec/03_messages.md b/x/stakers/spec/03_messages.md index 9b1b11fa..764ae0c5 100644 --- a/x/stakers/spec/03_messages.md +++ b/x/stakers/spec/03_messages.md @@ -24,6 +24,12 @@ the given staker is about to change its commission. After the `CommissionChangeTime` has passed the new commission is applied. +## `MsgClaimCommissionRewards` + +This message claims the commission rewards of a protocol node. When a protocol +node receives commission rewards, it is transferred from the pool module to the +stakers module, which can be claimed with this message. + ## `MsgJoinPool` This message allows a staker to join a pool. For joining a pool the staker must diff --git a/x/stakers/spec/05_events.md b/x/stakers/spec/05_events.md index d1157772..ae45a563 100644 --- a/x/stakers/spec/05_events.md +++ b/x/stakers/spec/05_events.md @@ -89,6 +89,24 @@ It gets thrown from the following actions: - EndBlock +## EventClaimCommissionRewards + +MsgClaimCommissionRewards indicates that a protocol node has claimed a portion +of their commission rewards. + +```protobuf +message EventClaimCommissionRewards { + // staker is the account address of the protocol node. + string staker = 1; + // amount ... + uint64 amount = 2; +} +``` + +It gets thrown from the following messages: + +- `MsgClaimCommissionRewards` + ## EventJoinPool EventClaimUploaderRole indicates that a staker has joined a pool. diff --git a/x/stakers/spec/07_exported.md b/x/stakers/spec/07_exported.md index 836664cb..eae8a6d5 100644 --- a/x/stakers/spec/07_exported.md +++ b/x/stakers/spec/07_exported.md @@ -61,5 +61,10 @@ type StakersKeeper interface { DoesValaccountExist(ctx sdk.Context, poolId uint64, stakerAddress string) bool DoesStakerExist(ctx sdk.Context, staker string) bool + + // IncreaseStakerCommissionRewards increases the commission rewards of a + // staker by a specific amount. It can not be decreased, only the + // MsgClaimCommissionRewards message can decrease this value. + IncreaseStakerCommissionRewards(ctx sdk.Context, address string, amount uint64) } ``` diff --git a/x/stakers/types/codec.go b/x/stakers/types/codec.go index beaa92ae..90c22298 100644 --- a/x/stakers/types/codec.go +++ b/x/stakers/types/codec.go @@ -10,6 +10,7 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateStaker{}, "kyve/stakers/MsgCreateStaker", nil) cdc.RegisterConcrete(&MsgUpdateCommission{}, "kyve/stakers/MsgUpdateCommission", nil) + cdc.RegisterConcrete(&MsgClaimCommissionRewards{}, "kyve/stakers/MsgClaimCommissionRewards", nil) cdc.RegisterConcrete(&MsgUpdateMetadata{}, "kyve/stakers/MsgUpdateMetadata", nil) cdc.RegisterConcrete(&MsgJoinPool{}, "kyve/stakers/MsgJoinPool", nil) cdc.RegisterConcrete(&MsgLeavePool{}, "kyve/stakers/MsgLeavePool", nil) @@ -19,6 +20,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateStaker{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateCommission{}) + registry.RegisterImplementations((*sdk.Msg)(nil), &MsgClaimCommissionRewards{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateMetadata{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgJoinPool{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgLeavePool{}) diff --git a/x/stakers/types/errors.go b/x/stakers/types/errors.go index 6e82dfb8..4fc21036 100644 --- a/x/stakers/types/errors.go +++ b/x/stakers/types/errors.go @@ -17,6 +17,7 @@ var ( ErrValaddressSameAsStaker = errors.Register(ModuleName, 1111, "Valaddress has same address as Valaddress") ErrCanNotJoinDisabledPool = errors.Register(ModuleName, 1112, "can not join disabled pool") ErrInvalidIdentityString = errors.Register(ModuleName, 1113, "invalid identity: %s") + ErrNotEnoughRewards = errors.Register(ModuleName, 1114, "claim amount is larger than current rewards") ErrPoolLeaveAlreadyInProgress = errors.Register(ModuleName, 1117, "Pool leave is already in progress") ErrValaccountUnauthorized = errors.Register(ModuleName, 1118, "valaccount unauthorized") diff --git a/x/stakers/types/events.pb.go b/x/stakers/types/events.pb.go index 757b8f7e..f0b4756a 100644 --- a/x/stakers/types/events.pb.go +++ b/x/stakers/types/events.pb.go @@ -288,6 +288,62 @@ func (m *EventUpdateCommission) GetStaker() string { return "" } +// EventClaimCommissionRewards ... +// emitted_by: MsgClaimCommissionRewards +type EventClaimCommissionRewards struct { + // staker is the account address of the protocol node. + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventClaimCommissionRewards) Reset() { *m = EventClaimCommissionRewards{} } +func (m *EventClaimCommissionRewards) String() string { return proto.CompactTextString(m) } +func (*EventClaimCommissionRewards) ProtoMessage() {} +func (*EventClaimCommissionRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_7a1b3dc9634155a0, []int{4} +} +func (m *EventClaimCommissionRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClaimCommissionRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClaimCommissionRewards.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 *EventClaimCommissionRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClaimCommissionRewards.Merge(m, src) +} +func (m *EventClaimCommissionRewards) XXX_Size() int { + return m.Size() +} +func (m *EventClaimCommissionRewards) XXX_DiscardUnknown() { + xxx_messageInfo_EventClaimCommissionRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClaimCommissionRewards proto.InternalMessageInfo + +func (m *EventClaimCommissionRewards) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *EventClaimCommissionRewards) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + // EventJoinPool ... // emitted_by: MsgJoinPool type EventJoinPool struct { @@ -306,7 +362,7 @@ func (m *EventJoinPool) Reset() { *m = EventJoinPool{} } func (m *EventJoinPool) String() string { return proto.CompactTextString(m) } func (*EventJoinPool) ProtoMessage() {} func (*EventJoinPool) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{4} + return fileDescriptor_7a1b3dc9634155a0, []int{5} } func (m *EventJoinPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -376,7 +432,7 @@ func (m *EventLeavePool) Reset() { *m = EventLeavePool{} } func (m *EventLeavePool) String() string { return proto.CompactTextString(m) } func (*EventLeavePool) ProtoMessage() {} func (*EventLeavePool) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{5} + return fileDescriptor_7a1b3dc9634155a0, []int{6} } func (m *EventLeavePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -424,6 +480,7 @@ func init() { proto.RegisterType((*EventCreateStaker)(nil), "kyve.stakers.v1beta1.EventCreateStaker") proto.RegisterType((*EventUpdateMetadata)(nil), "kyve.stakers.v1beta1.EventUpdateMetadata") proto.RegisterType((*EventUpdateCommission)(nil), "kyve.stakers.v1beta1.EventUpdateCommission") + proto.RegisterType((*EventClaimCommissionRewards)(nil), "kyve.stakers.v1beta1.EventClaimCommissionRewards") proto.RegisterType((*EventJoinPool)(nil), "kyve.stakers.v1beta1.EventJoinPool") proto.RegisterType((*EventLeavePool)(nil), "kyve.stakers.v1beta1.EventLeavePool") } @@ -431,39 +488,41 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/events.proto", fileDescriptor_7a1b3dc9634155a0) } var fileDescriptor_7a1b3dc9634155a0 = []byte{ - // 511 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x43, 0x48, 0xc8, 0x20, 0x5e, 0xa6, 0x80, 0x15, 0x21, 0xb7, 0x78, 0x81, 0x8a, 0x04, - 0xb6, 0x0a, 0x5f, 0xd0, 0x84, 0x22, 0xf1, 0xaa, 0x2a, 0x23, 0x90, 0x60, 0x13, 0x4d, 0x3c, 0x57, - 0xe9, 0x28, 0xf6, 0x5c, 0xcb, 0x33, 0x71, 0xea, 0x15, 0xbf, 0x80, 0xc4, 0xa7, 0xf0, 0x07, 0xac, - 0xba, 0xec, 0x12, 0xb1, 0xa8, 0x50, 0xf2, 0x23, 0xc8, 0xe3, 0x71, 0x70, 0xa5, 0x56, 0x42, 0xb0, - 0xb2, 0xcf, 0xbd, 0x67, 0xce, 0x39, 0xf7, 0x6a, 0x86, 0x3c, 0x98, 0x15, 0x39, 0x04, 0x52, 0xd1, - 0x19, 0x64, 0x32, 0xc8, 0x77, 0x26, 0xa0, 0xe8, 0x4e, 0x00, 0x39, 0x08, 0x25, 0xfd, 0x34, 0x43, - 0x85, 0xf6, 0x46, 0x49, 0xf1, 0x0d, 0xc5, 0x37, 0x94, 0xc1, 0xc6, 0x14, 0xa7, 0xa8, 0x09, 0x41, - 0xf9, 0x57, 0x71, 0x07, 0xe7, 0xcb, 0xa5, 0x34, 0xa3, 0x89, 0x91, 0xf3, 0xbe, 0x59, 0xe4, 0xd6, - 0x5e, 0xa9, 0xff, 0x3e, 0x65, 0x54, 0xc1, 0x81, 0xee, 0xd9, 0xbb, 0x84, 0x60, 0xcc, 0xc6, 0x15, - 0xd3, 0xb1, 0xb6, 0xac, 0xed, 0xab, 0x4f, 0xef, 0xfb, 0xe7, 0x39, 0xfb, 0xd5, 0x89, 0x61,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c0, 0x40, 0x51, 0x1e, 0x4b, 0xa7, 0x5b, 0x19, 0x18, 0xe8, - 0x7d, 0x26, 0x77, 0x1a, 0x33, 0x8c, 0xd6, 0xd3, 0x5d, 0x38, 0xc5, 0xd9, 0x2d, 0xb6, 0xff, 0x7b, - 0x8b, 0x47, 0xe4, 0x9a, 0x0e, 0xf0, 0x0a, 0xb9, 0x38, 0x40, 0x8c, 0xed, 0x7b, 0xa4, 0x97, 0x22, - 0xc6, 0x63, 0xce, 0xb4, 0x73, 0x27, 0xec, 0x96, 0xf0, 0x25, 0x6b, 0x24, 0x6a, 0x9f, 0x49, 0xe4, - 0x12, 0x92, 0xd3, 0x98, 0x32, 0x96, 0x81, 0x94, 0x66, 0x81, 0x8d, 0x4a, 0xe3, 0x3e, 0x74, 0x9a, - 0xf7, 0xc1, 0xdb, 0x25, 0xd7, 0xb5, 0xf3, 0x1b, 0xa0, 0x39, 0xfc, 0x93, 0xf5, 0xf0, 0xc5, 0xf1, - 0xd2, 0xb5, 0x4e, 0x96, 0xae, 0xf5, 0x6b, 0xe9, 0x5a, 0x5f, 0x56, 0x6e, 0xeb, 0x64, 0xe5, 0xb6, - 0x7e, 0xac, 0xdc, 0xd6, 0xa7, 0xc7, 0x8d, 0x55, 0xbc, 0xfe, 0xf8, 0x61, 0x6f, 0x1f, 0xd4, 0x02, - 0xb3, 0x59, 0x10, 0x1d, 0x52, 0x2e, 0x82, 0xa3, 0xf5, 0x2b, 0xd5, 0x4b, 0x99, 0x74, 0xf5, 0xeb, - 0x7c, 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x78, 0x7d, 0x88, 0x0f, 0x11, 0x04, 0x00, 0x00, + // 529 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe3, 0x10, 0x52, 0xb2, 0x88, 0x2f, 0x53, 0xc0, 0x0a, 0xc8, 0x2d, 0x39, 0xa0, 0x22, + 0x81, 0xad, 0xc2, 0x13, 0x34, 0xa1, 0x48, 0x7c, 0xb4, 0xaa, 0x8c, 0x40, 0x82, 0x4b, 0x34, 0xf1, + 0x8e, 0xd2, 0x55, 0x6c, 0x8f, 0xe5, 0xdd, 0x24, 0xcd, 0x89, 0x57, 0x40, 0xe2, 0x51, 0x78, 0x03, + 0x4e, 0x3d, 0xf6, 0x88, 0x38, 0x54, 0x28, 0x79, 0x11, 0xe4, 0xf5, 0x3a, 0x75, 0xa4, 0x56, 0xe2, + 0xe3, 0x94, 0xfc, 0x77, 0xfe, 0xfe, 0xfd, 0x67, 0x66, 0xb5, 0xec, 0xe1, 0x68, 0x36, 0x41, 0x5f, + 0x2a, 0x18, 0x61, 0x26, 0xfd, 0xc9, 0xf6, 0x00, 0x15, 0x6c, 0xfb, 0x38, 0xc1, 0x44, 0x49, 0x2f, + 0xcd, 0x48, 0x91, 0xbd, 0x9e, 0x5b, 0x3c, 0x63, 0xf1, 0x8c, 0xa5, 0xbd, 0x3e, 0xa4, 0x21, 0x69, + 0x83, 0x9f, 0xff, 0x2b, 0xbc, 0xed, 0xf3, 0x71, 0x29, 0x64, 0x10, 0x1b, 0x5c, 0xe7, 0x9b, 0xc5, + 0x6e, 0xed, 0xe6, 0xfc, 0xf7, 0x29, 0x07, 0x85, 0x07, 0xba, 0x66, 0xef, 0x30, 0x46, 0x11, 0xef, + 0x17, 0x4e, 0xc7, 0xda, 0xb4, 0xb6, 0xae, 0x3e, 0x7b, 0xe0, 0x9d, 0x97, 0xec, 0x15, 0x5f, 0x74, + 0x1b, 0xc7, 0xa7, 0x1b, 0xb5, 0xa0, 0x45, 0x11, 0x3f, 0x43, 0x24, 0x38, 0x2d, 0x11, 0xf5, 0x3f, + 0x47, 0x24, 0x38, 0x35, 0x08, 0x87, 0xad, 0xa5, 0x30, 0x8b, 0x08, 0xb8, 0x73, 0x69, 0xd3, 0xda, + 0x6a,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, 0x10, 0xf1, 0x59, 0x7e, 0x80, 0x53, 0xc8, + 0xb8, 0xfc, 0xdb, 0x4b, 0xee, 0x1c, 0xb1, 0x6b, 0x1a, 0xf7, 0x9a, 0x44, 0x72, 0x40, 0x14, 0xd9, + 0xf7, 0xd8, 0x5a, 0x4a, 0x14, 0xf5, 0x05, 0xd7, 0x84, 0x46, 0xd0, 0xcc, 0xe5, 0x2b, 0x5e, 0x21, + 0xd7, 0x57, 0xc8, 0x2e, 0x63, 0x13, 0x88, 0x80, 0xf3, 0x0c, 0xa5, 0x34, 0xf7, 0x51, 0x39, 0xa9, + 0x24, 0x37, 0x56, 0x92, 0x77, 0xd8, 0x75, 0x9d, 0xfc, 0x16, 0x61, 0x82, 0xff, 0x14, 0xdd, 0x7d, + 0x79, 0x3c, 0x77, 0xad, 0x93, 0xb9, 0x6b, 0xfd, 0x9a, 0xbb, 0xd6, 0x97, 0x85, 0x5b, 0x3b, 0x59, + 0xb8, 0xb5, 0x1f, 0x0b, 0xb7, 0xf6, 0xe9, 0x49, 0x65, 0xb3, 0x6f, 0x3e, 0x7e, 0xd8, 0xdd, 0x47, + 0x35, 0xa5, 0x6c, 0xe4, 0x87, 0x87, 0x20, 0x12, 0xff, 0x68, 0xf9, 0xe8, 0xf5, 0x8e, 0x07, 0x4d, + 0xfd, 0xd8, 0x9f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xc3, 0xc5, 0xf4, 0x60, 0x04, 0x00, + 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -666,6 +725,41 @@ func (m *EventUpdateCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventClaimCommissionRewards) 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 *EventClaimCommissionRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClaimCommissionRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *EventJoinPool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -842,6 +936,22 @@ func (m *EventUpdateCommission) Size() (n int) { return n } +func (m *EventClaimCommissionRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovEvents(uint64(m.Amount)) + } + return n +} + func (m *EventJoinPool) Size() (n int) { if m == nil { return 0 @@ -1528,6 +1638,107 @@ func (m *EventUpdateCommission) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventClaimCommissionRewards) 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 ErrIntOverflowEvents + } + 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: EventClaimCommissionRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClaimCommissionRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *EventJoinPool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/stakers/types/message_claim_commission_rewards.go b/x/stakers/types/message_claim_commission_rewards.go new file mode 100644 index 00000000..31955234 --- /dev/null +++ b/x/stakers/types/message_claim_commission_rewards.go @@ -0,0 +1,43 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" +) + +var ( + _ legacytx.LegacyMsg = &MsgClaimCommissionRewards{} + _ sdk.Msg = &MsgClaimCommissionRewards{} +) + +func (msg *MsgClaimCommissionRewards) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgClaimCommissionRewards) GetSigners() []sdk.AccAddress { + validator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{validator} +} + +func (msg *MsgClaimCommissionRewards) Route() string { + return RouterKey +} + +func (msg *MsgClaimCommissionRewards) Type() string { + return "kyve/stakers/MsgClaimCommissionRewards" +} + +func (msg *MsgClaimCommissionRewards) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) + } + + return nil +} diff --git a/x/stakers/types/stakers.pb.go b/x/stakers/types/stakers.pb.go index ae6ac79c..04573d96 100644 --- a/x/stakers/types/stakers.pb.go +++ b/x/stakers/types/stakers.pb.go @@ -41,6 +41,8 @@ type Staker struct { SecurityContact string `protobuf:"bytes,6,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` // details are some additional notes the staker finds important Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // commission_rewards are the rewards in $KYVE earned through commission + CommissionRewards uint64 `protobuf:"varint,8,opt,name=commission_rewards,json=commissionRewards,proto3" json:"commission_rewards,omitempty"` } func (m *Staker) Reset() { *m = Staker{} } @@ -118,6 +120,13 @@ func (m *Staker) GetDetails() string { return "" } +func (m *Staker) GetCommissionRewards() uint64 { + if m != nil { + return m.CommissionRewards + } + return 0 +} + // Valaccount gets authorized by a staker to // vote in a given pool by favor of the staker. type Valaccount struct { @@ -427,40 +436,41 @@ func init() { } var fileDescriptor_d209d1a2a74d375d = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x5d, 0x6b, 0x13, 0x41, - 0x14, 0xcd, 0x36, 0x6d, 0x3e, 0x2e, 0x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8b, 0x7d, 0xd5, 0xa3, 0x5b, 0x25, 0x79, 0xc4, 0x0d, 0x76, 0x3f, 0xc3, 0x1d, 0x3b, 0x07, 0xbe, - 0x27, 0x4a, 0xff, 0xa5, 0xe9, 0xca, 0x12, 0xea, 0x37, 0x96, 0xf0, 0x57, 0xee, 0x6f, 0x00, 0x3e, - 0xcc, 0x70, 0x86, 0x67, 0x86, 0x1b, 0x64, 0x8f, 0xa0, 0x9d, 0xd2, 0x62, 0x50, 0x75, 0x6f, 0xa5, - 0xb4, 0x38, 0x71, 0x0d, 0xec, 0x01, 0x8c, 0x64, 0x32, 0x2a, 0xd4, 0x2d, 0xa7, 0xb6, 0x2d, 0xe3, - 0xe4, 0xc3, 0xd7, 0x97, 0xab, 0xc0, 0xbb, 0x5a, 0x05, 0xde, 0xaf, 0x55, 0xe0, 0x7d, 0x5d, 0x07, - 0xb5, 0xab, 0x75, 0x50, 0xfb, 0xb1, 0x0e, 0x6a, 0x9f, 0x5e, 0x54, 0xa2, 0x7b, 0xfb, 0xf1, 0xfc, - 0xf8, 0x14, 0xcd, 0x82, 0xb2, 0x71, 0x28, 0x46, 0x5c, 0xaa, 0xf0, 0x62, 0xf3, 0x52, 0x5d, 0x88, - 0xc3, 0x86, 0x7b, 0x74, 0xaf, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x53, 0x59, 0x34, 0xc6, - 0x03, 0x00, 0x00, + // 537 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xdd, 0x6a, 0x13, 0x41, + 0x18, 0xcd, 0x36, 0x69, 0x7e, 0x3e, 0xfc, 0x1d, 0xa2, 0x2e, 0x95, 0x6e, 0x4b, 0x04, 0xa9, 0x60, + 0xb3, 0x14, 0xdf, 0xa0, 0x69, 0xc5, 0xa2, 0x14, 0xdd, 0x42, 0x41, 0x6f, 0xc2, 0x64, 0xf6, 0x63, + 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0x37, 0xad, 0xb4, 0xc6, 0xe4, 0x05, 0x3c, 0x50, 0xc8, 0xa6, + 0x19, 0xd7, 0x8b, 0x3e, 0x93, 0x42, 0x53, 0xa6, 0xfd, 0xba, 0x9d, 0xb9, 0x5f, 0xf0, 0x3d, 0x47, + 0x9b, 0x05, 0x31, 0x6a, 0xca, 0x53, 0xe5, 0x37, 0xdc, 0x82, 0x1c, 0x92, 0x7d, 0x20, 0x37, 0x16, + 0xfb, 0x19, 0xce, 0x69, 0x16, 0x2b, 0xbf, 0xb9, 0xeb, 0xed, 0xd5, 0xa2, 0x87, 0x37, 0x4a, 0xe4, + 0x84, 0xce, 0x57, 0x0f, 0xe0, 0x9c, 0xa6, 0x94, 0x31, 0x39, 0x15, 0x9a, 0x3c, 0x81, 0xc6, 0x44, + 0xca, 0xb4, 0xcf, 0x63, 0x1b, 0x5e, 0x2d, 0xaa, 0x1b, 0x78, 0x12, 0x93, 0xc7, 0x50, 0x77, 0x4d, + 0xb8, 0xdc, 0xa2, 0x1c, 0x91, 0x00, 0x60, 0x46, 0xd3, 0x22, 0x70, 0x17, 0x43, 0x89, 0x31, 0xdf, + 0x4d, 0x24, 0x17, 0x5a, 0xd9, 0x20, 0xec, 0x79, 0x06, 0x91, 0x6d, 0x00, 0xae, 0xfa, 0x29, 0xd2, + 0x19, 0x17, 0x89, 0x4d, 0xa2, 0x19, 0xb5, 0xb8, 0x7a, 0xe7, 0x88, 0xce, 0x77, 0x0f, 0x1e, 0xf5, + 0xd6, 0x66, 0x7b, 0x43, 0x2a, 0x12, 0x3c, 0x16, 0x3a, 0x5b, 0x90, 0x36, 0x6c, 0x72, 0x11, 0xe3, + 0x45, 0xee, 0xcf, 0x81, 0x3f, 0xda, 0xbb, 0x5d, 0x79, 0xf5, 0xbf, 0x2b, 0x7f, 0x06, 0x77, 0x59, + 0x86, 0x54, 0x9b, 0x6c, 0x63, 0x9a, 0xd7, 0x5b, 0x8d, 0xee, 0x14, 0xe4, 0x11, 0xd5, 0xd8, 0xf9, + 0x0c, 0xf7, 0xcc, 0x7f, 0xe0, 0x7b, 0x29, 0xd3, 0x7f, 0x31, 0x5d, 0x2a, 0xa1, 0x7a, 0xab, 0x84, + 0xbf, 0xda, 0xfe, 0x06, 0xe0, 0xc3, 0x14, 0xa7, 0x78, 0xa6, 0xa9, 0x46, 0xf2, 0x14, 0x5a, 0xa9, + 0x9c, 0xf7, 0xcb, 0xdb, 0x9b, 0xa9, 0x9c, 0x9f, 0x58, 0x03, 0xdb, 0x00, 0x43, 0x9e, 0x0c, 0x73, + 0x75, 0xc3, 0xaa, 0x2d, 0xc3, 0x58, 0xf9, 0xf0, 0xf5, 0xe5, 0x32, 0xf0, 0xae, 0x96, 0x81, 0xf7, + 0x6b, 0x19, 0x78, 0x5f, 0x56, 0x41, 0xe5, 0x6a, 0x15, 0x54, 0x7e, 0xac, 0x82, 0xca, 0xa7, 0x97, + 0xa5, 0xe8, 0xde, 0x7e, 0x3c, 0x3f, 0x3e, 0x45, 0x3d, 0x97, 0xd9, 0x28, 0x64, 0x43, 0xca, 0x45, + 0x78, 0xb1, 0xbe, 0xd8, 0x36, 0xc4, 0x41, 0xdd, 0xde, 0xd1, 0x57, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x97, 0x01, 0x39, 0x24, 0xf5, 0x03, 0x00, 0x00, } func (m *Staker) Marshal() (dAtA []byte, err error) { @@ -483,6 +493,11 @@ func (m *Staker) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.CommissionRewards != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CommissionRewards)) + i-- + dAtA[i] = 0x40 + } if len(m.Details) > 0 { i -= len(m.Details) copy(dAtA[i:], m.Details) @@ -766,6 +781,9 @@ func (m *Staker) Size() (n int) { if l > 0 { n += 1 + l + sovStakers(uint64(l)) } + if m.CommissionRewards != 0 { + n += 1 + sovStakers(uint64(m.CommissionRewards)) + } return n } @@ -1114,6 +1132,25 @@ func (m *Staker) Unmarshal(dAtA []byte) error { } m.Details = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRewards", wireType) + } + m.CommissionRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommissionRewards |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipStakers(dAtA[iNdEx:]) diff --git a/x/stakers/types/tx.pb.go b/x/stakers/types/tx.pb.go index 4a5d5aaa..5aec6821 100644 --- a/x/stakers/types/tx.pb.go +++ b/x/stakers/types/tx.pb.go @@ -338,6 +338,98 @@ func (m *MsgUpdateCommissionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateCommissionResponse proto.InternalMessageInfo +// MsgClaimCommissionRewards ... +type MsgClaimCommissionRewards struct { + // creator ... + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgClaimCommissionRewards) Reset() { *m = MsgClaimCommissionRewards{} } +func (m *MsgClaimCommissionRewards) String() string { return proto.CompactTextString(m) } +func (*MsgClaimCommissionRewards) ProtoMessage() {} +func (*MsgClaimCommissionRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_f52b730e69b9fb06, []int{6} +} +func (m *MsgClaimCommissionRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimCommissionRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimCommissionRewards.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 *MsgClaimCommissionRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimCommissionRewards.Merge(m, src) +} +func (m *MsgClaimCommissionRewards) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimCommissionRewards) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimCommissionRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimCommissionRewards proto.InternalMessageInfo + +func (m *MsgClaimCommissionRewards) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgClaimCommissionRewards) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// MsgClaimCommissionRewardsResponse ... +type MsgClaimCommissionRewardsResponse struct { +} + +func (m *MsgClaimCommissionRewardsResponse) Reset() { *m = MsgClaimCommissionRewardsResponse{} } +func (m *MsgClaimCommissionRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClaimCommissionRewardsResponse) ProtoMessage() {} +func (*MsgClaimCommissionRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f52b730e69b9fb06, []int{7} +} +func (m *MsgClaimCommissionRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimCommissionRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimCommissionRewardsResponse.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 *MsgClaimCommissionRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimCommissionRewardsResponse.Merge(m, src) +} +func (m *MsgClaimCommissionRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimCommissionRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimCommissionRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimCommissionRewardsResponse proto.InternalMessageInfo + // MsgJoinPool ... type MsgJoinPool struct { // creator ... @@ -354,7 +446,7 @@ func (m *MsgJoinPool) Reset() { *m = MsgJoinPool{} } func (m *MsgJoinPool) String() string { return proto.CompactTextString(m) } func (*MsgJoinPool) ProtoMessage() {} func (*MsgJoinPool) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{6} + return fileDescriptor_f52b730e69b9fb06, []int{8} } func (m *MsgJoinPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -419,7 +511,7 @@ func (m *MsgJoinPoolResponse) Reset() { *m = MsgJoinPoolResponse{} } func (m *MsgJoinPoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgJoinPoolResponse) ProtoMessage() {} func (*MsgJoinPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{7} + return fileDescriptor_f52b730e69b9fb06, []int{9} } func (m *MsgJoinPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -460,7 +552,7 @@ func (m *MsgLeavePool) Reset() { *m = MsgLeavePool{} } func (m *MsgLeavePool) String() string { return proto.CompactTextString(m) } func (*MsgLeavePool) ProtoMessage() {} func (*MsgLeavePool) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{8} + return fileDescriptor_f52b730e69b9fb06, []int{10} } func (m *MsgLeavePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -511,7 +603,7 @@ func (m *MsgLeavePoolResponse) Reset() { *m = MsgLeavePoolResponse{} } func (m *MsgLeavePoolResponse) String() string { return proto.CompactTextString(m) } func (*MsgLeavePoolResponse) ProtoMessage() {} func (*MsgLeavePoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{9} + return fileDescriptor_f52b730e69b9fb06, []int{11} } func (m *MsgLeavePoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -552,7 +644,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{10} + return fileDescriptor_f52b730e69b9fb06, []int{12} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -603,7 +695,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f52b730e69b9fb06, []int{11} + return fileDescriptor_f52b730e69b9fb06, []int{13} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,6 +731,8 @@ func init() { proto.RegisterType((*MsgUpdateMetadataResponse)(nil), "kyve.stakers.v1beta1.MsgUpdateMetadataResponse") proto.RegisterType((*MsgUpdateCommission)(nil), "kyve.stakers.v1beta1.MsgUpdateCommission") proto.RegisterType((*MsgUpdateCommissionResponse)(nil), "kyve.stakers.v1beta1.MsgUpdateCommissionResponse") + proto.RegisterType((*MsgClaimCommissionRewards)(nil), "kyve.stakers.v1beta1.MsgClaimCommissionRewards") + proto.RegisterType((*MsgClaimCommissionRewardsResponse)(nil), "kyve.stakers.v1beta1.MsgClaimCommissionRewardsResponse") proto.RegisterType((*MsgJoinPool)(nil), "kyve.stakers.v1beta1.MsgJoinPool") proto.RegisterType((*MsgJoinPoolResponse)(nil), "kyve.stakers.v1beta1.MsgJoinPoolResponse") proto.RegisterType((*MsgLeavePool)(nil), "kyve.stakers.v1beta1.MsgLeavePool") @@ -650,49 +744,52 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/tx.proto", fileDescriptor_f52b730e69b9fb06) } var fileDescriptor_f52b730e69b9fb06 = []byte{ - // 665 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0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xa5, 0xea, 0xe6, 0x48, 0xdd, 0x06, 0xf0, - 0x58, 0x10, 0x50, 0xce, 0x29, 0x0b, 0xb5, 0xd1, 0xe4, 0xd2, 0xa6, 0x75, 0x74, 0xb2, 0x58, 0xf9, - 0x79, 0xb2, 0x78, 0xd7, 0xa7, 0x62, 0xbf, 0xdd, 0xb0, 0x3c, 0x16, 0xe4, 0x82, 0xf2, 0x9f, 0x35, - 0x8e, 0x9b, 0xb6, 0xe8, 0x46, 0x84, 0x5b, 0x4f, 0x88, 0xe7, 0x96, 0x32, 0x98, 0x73, 0x30, 0x7b, - 0x41, 0x94, 0x4b, 0x78, 0xc4, 0x42, 0x4e, 0xcc, 0x6f, 0x0a, 0xdc, 0x74, 0xb8, 0xff, 0x3a, 0xc2, - 0x48, 0x10, 0x87, 0x08, 0x84, 0x91, 0x40, 0x7d, 0x24, 0x6b, 0x30, 0x1e, 0xb0, 0x90, 0x36, 0x49, - 0x9c, 0x6a, 0xae, 0xb9, 0x05, 0x4c, 0x22, 0x07, 0xa4, 0xc1, 0xa9, 0x20, 0x99, 0x62, 0xb7, 0x80, - 0xaa, 0x0e, 0x13, 0x14, 0x93, 0x50, 0x50, 0xd1, 0xd5, 0xaa, 0x69, 0x48, 0x62, 0x75, 0x15, 0xa6, - 0x39, 0xf1, 0xda, 0x31, 0x15, 0xdd, 0x3d, 0x8f, 0x85, 0x02, 0x79, 0x42, 0xfb, 0x2f, 0xe5, 0x4c, - 0x15, 0xe7, 0x5b, 0xd9, 0x71, 0x52, 0x00, 0x13, 0x81, 0x68, 0x8b, 0x6b, 0x63, 0x59, 0x81, 0x1c, - 0x9a, 0xf3, 0x30, 0x77, 0xa9, 0x07, 0xd9, 0xe1, 0x27, 0xb8, 0x25, 0x83, 0x5b, 0x72, 0x26, 0x7d, - 0x5a, 0xec, 0x9d, 0xfe, 0xc8, 0x3f, 0x4f, 0x7f, 0x01, 0xe6, 0xaf, 0x10, 0x20, 0xf5, 0x1d, 0xc2, - 0xff, 0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x0b, 0x13, 0xd2, 0xb4, 0x77, 0xae, 0xbd, 0x5e, 0x50, - 0xf4, 0xd5, 0x81, 0x14, 0x99, 0xf9, 0x03, 0xd4, 0xce, 0xdd, 0x67, 0x5e, 0x7b, 0x4f, 0x72, 0xf4, - 0xfb, 0x83, 0x39, 0x32, 0x39, 0x86, 0xc9, 0x1e, 0xff, 0x2d, 0x0f, 0xe8, 0x3c, 0xa3, 0xf5, 0x79, - 0xf4, 0x57, 0x19, 0x6d, 0xf3, 0xd9, 0xd1, 0xa9, 0xa1, 0x1c, 0x9f, 0x1a, 0xca, 0xaf, 0x53, 0x43, - 0xf9, 0x7c, 0x66, 0x54, 0x8e, 0xcf, 0x8c, 0xca, 0x8f, 0x33, 0xa3, 0xf2, 0xfe, 0x41, 0xe9, 0x0d, - 0xf2, 0xf2, 0xdd, 0x9b, 0xa7, 0xdb, 0x44, 0x1c, 0xb0, 0xb8, 0x69, 0x7b, 0xfb, 0x88, 0x86, 0xf6, - 0xa1, 0xfc, 0x42, 0xa5, 0xef, 0x92, 0xc6, 0x58, 0xfa, 0x59, 0x79, 0xf4, 0x27, 0x00, 0x00, 0xff, - 0xff, 0xe2, 0xf4, 0xaa, 0xce, 0xbe, 0x06, 0x00, 0x00, + // 705 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5b, 0x4f, 0xd4, 0x4c, + 0x18, 0xde, 0x72, 0xde, 0xf7, 0x23, 0x1f, 0x7c, 0xfd, 0x56, 0x28, 0x25, 0x14, 0xa8, 0x41, 0xc1, + 0x48, 0x1b, 0x34, 0xd1, 0x6b, 0x58, 0x35, 0xf1, 0x50, 0x42, 0x4a, 0x34, 0x1e, 0x2e, 0xc8, 0x6c, + 0x3b, 0x29, 0xe3, 0x6e, 0x3b, 0x4d, 0x67, 0x76, 0x61, 0xaf, 0x4c, 0xfc, 0x05, 0x26, 0xfe, 0x15, + 0x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, 0x27, 0x30, 0xea, 0x9d, 0xc1, 0x18, 0x41, 0xee, 0xc2, 0x64, 0x47, + 0x08, 0x56, 0x06, 0x6c, 0x7f, 0x0a, 0xeb, 0x73, 0xfe, 0xba, 0x9d, 0xf6, 0xad, 0x27, 0x47, 0xa7, + 0x9a, 0x74, 0x7c, 0xaa, 0x49, 0x3f, 0x4f, 0x35, 0xe9, 0xd3, 0x99, 0x56, 0x3a, 0x3e, 0xd3, 0x4a, + 0xdf, 0xcf, 0xb4, 0xd2, 0xdb, 0xbb, 0x85, 0xab, 0xf3, 0xf9, 0x9b, 0x57, 0x8f, 0xb7, 0x31, 0x3f, + 0xa0, 0x51, 0xdd, 0x74, 0xf6, 0x11, 0x09, 0xcc, 0x43, 0xf1, 0x34, 0x27, 0x97, 0x68, 0x6d, 0x2c, + 0x79, 0x4f, 0xef, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x68, 0xe4, 0x47, 0xc0, 0xb7, 0x07, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -713,6 +810,8 @@ type MsgClient interface { UpdateMetadata(ctx context.Context, in *MsgUpdateMetadata, opts ...grpc.CallOption) (*MsgUpdateMetadataResponse, error) // UpdateCommission ... UpdateCommission(ctx context.Context, in *MsgUpdateCommission, opts ...grpc.CallOption) (*MsgUpdateCommissionResponse, error) + // ClaimCommissionRewards ... + ClaimCommissionRewards(ctx context.Context, in *MsgClaimCommissionRewards, opts ...grpc.CallOption) (*MsgClaimCommissionRewardsResponse, error) // JoinPool ... JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc.CallOption) (*MsgJoinPoolResponse, error) // LeavePool ... @@ -757,6 +856,15 @@ func (c *msgClient) UpdateCommission(ctx context.Context, in *MsgUpdateCommissio return out, nil } +func (c *msgClient) ClaimCommissionRewards(ctx context.Context, in *MsgClaimCommissionRewards, opts ...grpc.CallOption) (*MsgClaimCommissionRewardsResponse, error) { + out := new(MsgClaimCommissionRewardsResponse) + err := c.cc.Invoke(ctx, "/kyve.stakers.v1beta1.Msg/ClaimCommissionRewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc.CallOption) (*MsgJoinPoolResponse, error) { out := new(MsgJoinPoolResponse) err := c.cc.Invoke(ctx, "/kyve.stakers.v1beta1.Msg/JoinPool", in, out, opts...) @@ -792,6 +900,8 @@ type MsgServer interface { UpdateMetadata(context.Context, *MsgUpdateMetadata) (*MsgUpdateMetadataResponse, error) // UpdateCommission ... UpdateCommission(context.Context, *MsgUpdateCommission) (*MsgUpdateCommissionResponse, error) + // ClaimCommissionRewards ... + ClaimCommissionRewards(context.Context, *MsgClaimCommissionRewards) (*MsgClaimCommissionRewardsResponse, error) // JoinPool ... JoinPool(context.Context, *MsgJoinPool) (*MsgJoinPoolResponse, error) // LeavePool ... @@ -814,6 +924,9 @@ func (*UnimplementedMsgServer) UpdateMetadata(ctx context.Context, req *MsgUpdat func (*UnimplementedMsgServer) UpdateCommission(ctx context.Context, req *MsgUpdateCommission) (*MsgUpdateCommissionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateCommission not implemented") } +func (*UnimplementedMsgServer) ClaimCommissionRewards(ctx context.Context, req *MsgClaimCommissionRewards) (*MsgClaimCommissionRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClaimCommissionRewards not implemented") +} func (*UnimplementedMsgServer) JoinPool(ctx context.Context, req *MsgJoinPool) (*MsgJoinPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method JoinPool not implemented") } @@ -882,6 +995,24 @@ func _Msg_UpdateCommission_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_ClaimCommissionRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClaimCommissionRewards) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClaimCommissionRewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.stakers.v1beta1.Msg/ClaimCommissionRewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClaimCommissionRewards(ctx, req.(*MsgClaimCommissionRewards)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_JoinPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgJoinPool) if err := dec(in); err != nil { @@ -952,6 +1083,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateCommission", Handler: _Msg_UpdateCommission_Handler, }, + { + MethodName: "ClaimCommissionRewards", + Handler: _Msg_ClaimCommissionRewards_Handler, + }, { MethodName: "JoinPool", Handler: _Msg_JoinPool_Handler, @@ -1188,6 +1323,64 @@ func (m *MsgUpdateCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgClaimCommissionRewards) 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 *MsgClaimCommissionRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimCommissionRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClaimCommissionRewardsResponse) 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 *MsgClaimCommissionRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimCommissionRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgJoinPool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1480,6 +1673,31 @@ func (m *MsgUpdateCommissionResponse) Size() (n int) { return n } +func (m *MsgClaimCommissionRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + return n +} + +func (m *MsgClaimCommissionRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgJoinPool) Size() (n int) { if m == nil { return 0 @@ -2212,6 +2430,157 @@ func (m *MsgUpdateCommissionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgClaimCommissionRewards) 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: MsgClaimCommissionRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimCommissionRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgClaimCommissionRewardsResponse) 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: MsgClaimCommissionRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimCommissionRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0