diff --git a/app/app.go b/app/app.go index 6a6b4dc0a..6fbecba00 100644 --- a/app/app.go +++ b/app/app.go @@ -752,6 +752,15 @@ func NewElysApp( ) stablestake := stablestake.NewAppModule(appCodec, app.StablestakeKeeper, app.AccountKeeper, app.BankKeeper) + app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper( + appCodec, + keys[tokenomicsmoduletypes.StoreKey], + keys[tokenomicsmoduletypes.MemStoreKey], + app.GetSubspace(tokenomicsmoduletypes.ModuleName), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper) + app.IncentiveKeeper = *incentivemodulekeeper.NewKeeper( appCodec, keys[incentivemoduletypes.StoreKey], @@ -766,8 +775,10 @@ func NewElysApp( app.AssetprofileKeeper, app.EpochsKeeper, app.StablestakeKeeper, + app.TokenomicsKeeper, authtypes.FeeCollectorName, DexRevenueCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) incentiveModule := incentivemodule.NewAppModule(appCodec, app.IncentiveKeeper) @@ -779,15 +790,6 @@ func NewElysApp( commitmentModule := commitmentmodule.NewAppModule(appCodec, app.CommitmentKeeper, app.AccountKeeper, app.BankKeeper) - app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper( - appCodec, - keys[tokenomicsmoduletypes.StoreKey], - keys[tokenomicsmoduletypes.MemStoreKey], - app.GetSubspace(tokenomicsmoduletypes.ModuleName), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper) - app.BurnerKeeper = *burnermodulekeeper.NewKeeper( appCodec, keys[burnermoduletypes.StoreKey], diff --git a/config.yml b/config.yml index 85569e0da..ec76dc02b 100644 --- a/config.yml +++ b/config.yml @@ -287,24 +287,8 @@ genesis: amount: "200000" incentive: params: - lp_incentives: - - eden_amount_per_year: "10000000000000" - distribution_start_block: "1" - total_blocks_per_year: "10512000" - allocation_epoch_in_blocks: "28800" - max_eden_per_allocation: "27397238400" - distribution_epoch_in_blocks: "10" - current_epoch_in_blocks: "0" - eden_boost_apr: "1" - stake_incentives: - - eden_amount_per_year: "10000000000000" - distribution_start_block: "1" - total_blocks_per_year: "10512000" - allocation_epoch_in_blocks: "28800" - max_eden_per_allocation: "27397238400" - distribution_epoch_in_blocks: "20" - current_epoch_in_blocks: "0" - eden_boost_apr: "1" + lp_incentives: [] + stake_incentives: [] community_tax: "0.00" withdraw_addr_enabled: true reward_portion_for_lps: "0.65" diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 8693376b9..788c628cf 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -39622,9 +39622,20 @@ paths: type: string amount_collected_by_other_tracker: type: string - max_eden_reward_apr: + max_eden_reward_apr_stakers: type: string - title: Maximum eden reward apr + title: Maximum eden reward apr for stakers + max_eden_reward_apr_lps: + type: string + title: Maximum eden reward apr for lps + distribution_epoch_for_stakers_in_blocks: + type: string + format: int64 + title: Distribution epochs for stakers in blocks + distribution_epoch_for_lps_in_blocks: + type: string + format: int64 + title: Distribution epochs for LPs in blocks description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -84408,6 +84419,8 @@ definitions: type: string title: eden boost apr (0-1) range title: Incentive Info + elys.incentive.MsgUpdateIncentiveParamsResponse: + type: object elys.incentive.MsgWithdrawRewardsResponse: type: object description: >- @@ -84532,9 +84545,20 @@ definitions: type: string amount_collected_by_other_tracker: type: string - max_eden_reward_apr: + max_eden_reward_apr_stakers: + type: string + title: Maximum eden reward apr for stakers + max_eden_reward_apr_lps: + type: string + title: Maximum eden reward apr for lps + distribution_epoch_for_stakers_in_blocks: type: string - title: Maximum eden reward apr + format: int64 + title: Distribution epochs for stakers in blocks + distribution_epoch_for_lps_in_blocks: + type: string + format: int64 + title: Distribution epochs for LPs in blocks description: Params defines the parameters for the module. elys.incentive.PoolInfo: type: object @@ -84686,9 +84710,20 @@ definitions: type: string amount_collected_by_other_tracker: type: string - max_eden_reward_apr: + max_eden_reward_apr_stakers: + type: string + title: Maximum eden reward apr for stakers + max_eden_reward_apr_lps: type: string - title: Maximum eden reward apr + title: Maximum eden reward apr for lps + distribution_epoch_for_stakers_in_blocks: + type: string + format: int64 + title: Distribution epochs for stakers in blocks + distribution_epoch_for_lps_in_blocks: + type: string + format: int64 + title: Distribution epochs for LPs in blocks description: QueryParamsResponse is response type for the Query/Params RPC method. elys.leveragelp.IsWhitelistedResponse: type: object diff --git a/proto/elys/incentive/params.proto b/proto/elys/incentive/params.proto index 17fa3c0dd..f858b56a9 100644 --- a/proto/elys/incentive/params.proto +++ b/proto/elys/incentive/params.proto @@ -38,9 +38,21 @@ message Params { // Tracking dex rewards given to LPs DexRewardsTracker dex_rewards_lps = 9 [(gogoproto.nullable) = false]; - // Maximum eden reward apr - string max_eden_reward_apr = 10 [ + // Maximum eden reward apr for stakers + string max_eden_reward_apr_stakers = 10 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + + // Maximum eden reward apr for lps + string max_eden_reward_apr_lps = 11 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + + // Distribution epochs for stakers in blocks + int64 distribution_epoch_for_stakers_in_blocks = 12; + + // Distribution epochs for LPs in blocks + int64 distribution_epoch_for_lps_in_blocks = 13; } diff --git a/proto/elys/incentive/tx.proto b/proto/elys/incentive/tx.proto index d3ce01d9e..765ef1841 100644 --- a/proto/elys/incentive/tx.proto +++ b/proto/elys/incentive/tx.proto @@ -10,42 +10,63 @@ option go_package = "github.com/elys-network/elys/x/incentive/types"; // Msg defines the Msg service. service Msg { - + // WithdrawDelegatorReward defines a method to withdraw rewards of delegator // from a single validator. - rpc WithdrawRewards(MsgWithdrawRewards) returns (MsgWithdrawRewardsResponse); - + rpc WithdrawRewards (MsgWithdrawRewards) returns (MsgWithdrawRewardsResponse); + // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. - rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse); - + rpc WithdrawValidatorCommission (MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse); + rpc UpdateIncentiveParams (MsgUpdateIncentiveParams ) returns (MsgUpdateIncentiveParamsResponse ); } - // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // from a single validator. message MsgWithdrawRewards { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - elys.commitment.EarnType withdraw_type = 2; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + elys.commitment.EarnType withdraw_type = 2; } - + // MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. -message MsgWithdrawRewardsResponse { -} - +message MsgWithdrawRewardsResponse {} + // MsgWithdrawValidatorCommission withdraws the full commission to the validator // address. message MsgWithdrawValidatorCommission { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. -message MsgWithdrawValidatorCommissionResponse { +message MsgWithdrawValidatorCommissionResponse {} + +message MsgUpdateIncentiveParams { + string authority = 1; + string communityTax = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool withdrawAddrEnabled = 3; + string rewardPortionForLps = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + int64 elysStakeTrackingRate = 5; + string maxEdenRewardAprStakers = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string maxEdenRewardAprLps = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + int64 distributionEpochForStakers = 8; + int64 distributionEpochForLps = 9; } - \ No newline at end of file + +message MsgUpdateIncentiveParamsResponse {} + diff --git a/testutil/keeper/incentive.go b/testutil/keeper/incentive.go index d4cbfddbf..0577ab835 100644 --- a/testutil/keeper/incentive.go +++ b/testutil/keeper/incentive.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/elys-network/elys/x/incentive/keeper" "github.com/elys-network/elys/x/incentive/types" @@ -29,6 +30,7 @@ func IncentiveKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) + govAddress := sdk.AccAddress(address.Module("gov")) paramsSubspace := typesparams.NewSubspace(cdc, types.Amino, @@ -50,8 +52,10 @@ func IncentiveKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { nil, nil, nil, + nil, "", "", + govAddress.String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/x/incentive/client/cli/tx.go b/x/incentive/client/cli/tx.go index 9305919a2..bef3a26ef 100644 --- a/x/incentive/client/cli/tx.go +++ b/x/incentive/client/cli/tx.go @@ -49,6 +49,7 @@ func GetTxCmd() *cobra.Command { CmdUpdatePoolInfoProposal(), ) + cmd.AddCommand(CmdUpdateIncentiveParams()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/incentive/client/cli/tx_update_incentive_params.go b/x/incentive/client/cli/tx_update_incentive_params.go new file mode 100644 index 000000000..32f076249 --- /dev/null +++ b/x/incentive/client/cli/tx_update_incentive_params.go @@ -0,0 +1,134 @@ +package cli + +import ( + "errors" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/elys-network/elys/x/incentive/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdUpdateIncentiveParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-incentive-params [community-tax] [withdraw-addr-enabled] [reward-portion-for-lps] [elys-stake-tracking-rate] [max-eden-reward-apr-stakers] [max-eden-reward-apr-lps] [distribution-epoch-for-stakers] [distribution-epoch-for-lps]", + Short: "Broadcast message update-incentive-params", + Args: cobra.ExactArgs(8), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argCommunityTax := args[0] + argWithdrawAddrEnabled := args[1] + argRewardPortionForLps := args[2] + argElysStakeTrackingRate := args[3] + argMaxEdenRewardAprStakers := args[4] + argMaxEdenRewardAprLps := args[5] + argDistributionEpochForStakers := args[6] + argDistributionEpochForLps := args[7] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + title, err := cmd.Flags().GetString(cli.FlagTitle) + if err != nil { + return err + } + + summary, err := cmd.Flags().GetString(cli.FlagSummary) + if err != nil { + return err + } + + metadata, err := cmd.Flags().GetString(cli.FlagMetadata) + if err != nil { + return err + } + + signer := clientCtx.GetFromAddress() + if signer == nil { + return errors.New("signer address is missing") + } + + communityTax := sdk.MustNewDecFromStr(argCommunityTax) + withdarwAddrEnabled, err := strconv.ParseBool(argWithdrawAddrEnabled) + if err != nil { + return err + } + rewardPortionForLps := sdk.MustNewDecFromStr(argRewardPortionForLps) + elysStakeTrackingRate, err := strconv.ParseInt(argElysStakeTrackingRate, 10, 64) + if err != nil { + return err + } + maxEdenRewardAprStakers := sdk.MustNewDecFromStr(argMaxEdenRewardAprStakers) + maxEdenRewardLps := sdk.MustNewDecFromStr(argMaxEdenRewardAprLps) + distributionEpochForStaker, err := strconv.ParseInt(argDistributionEpochForStakers, 10, 64) + if err != nil { + return err + } + distributionEpochForLps, err := strconv.ParseInt(argDistributionEpochForLps, 10, 64) + if err != nil { + return err + } + + govAddress := sdk.AccAddress(address.Module("gov")) + msg := types.NewMsgUpdateIncentiveParams( + govAddress.String(), + communityTax, + withdarwAddrEnabled, + rewardPortionForLps, + elysStakeTrackingRate, + maxEdenRewardAprStakers, + maxEdenRewardLps, + distributionEpochForStaker, + distributionEpochForLps, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) + if err != nil { + return err + } + + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + govMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{msg}, deposit, signer.String(), metadata, title, summary) + if err != nil { + return err + } + + err = tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), govMsg) + if err != nil { + return err + } + + return nil + }, + } + + cmd.Flags().String(cli.FlagTitle, "", "title of proposal") + cmd.Flags().String(cli.FlagSummary, "", "summary of proposal") + cmd.Flags().String(cli.FlagMetadata, "", "metadata of proposal") + cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") + + _ = cmd.MarkFlagRequired(cli.FlagTitle) + _ = cmd.MarkFlagRequired(cli.FlagSummary) + _ = cmd.MarkFlagRequired(cli.FlagMetadata) + _ = cmd.MarkFlagRequired(cli.FlagDeposit) + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/incentive/client/cli/tx_update_incentive_params_test.go b/x/incentive/client/cli/tx_update_incentive_params_test.go new file mode 100644 index 000000000..869f87a48 --- /dev/null +++ b/x/incentive/client/cli/tx_update_incentive_params_test.go @@ -0,0 +1,52 @@ +package cli_test + +import ( + "strconv" + "testing" + + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + + "github.com/elys-network/elys/testutil/network" + "github.com/elys-network/elys/x/incentive/client/cli" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func setupNetwork(t *testing.T) *network.Network { + t.Helper() + + cfg := network.DefaultConfig() + return network.New(t, cfg) +} + +func TestGovUpdateIncentiveParams(t *testing.T) { + net := setupNetwork(t) + ctx := net.Validators[0].ClientCtx + val := net.Validators[0] + + // Use baseURL to make API HTTP requests or use val.RPCClient to make direct + // Tendermint RPC calls. + // ... + // [community-tax] [withdraw-addr-enabled] [reward-portion-for-lps] [elys-stake-tracking-rate] [max-eden-reward-apr-stakers] [max-eden-reward-par-lps] [distribution-epoch-for-stakers] [distribution-epoch-for-lps] + args := []string{ + "0.00", + "true", + "0.65", + "10", + "0.30", + "0.30", + "10", + "10", + "--title=test", + "--summary=test", + "--metadata=test", + "--deposit=1000000uelys", + "--from=" + val.Address.String(), + "-y", + } + + _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdateIncentiveParams(), args) + require.NoError(t, err) +} diff --git a/x/incentive/keeper/abci.go b/x/incentive/keeper/abci.go index 5999c824f..4c00810c0 100644 --- a/x/incentive/keeper/abci.go +++ b/x/incentive/keeper/abci.go @@ -17,6 +17,7 @@ package keeper import ( + "errors" "time" "github.com/cosmos/cosmos-sdk/telemetry" @@ -24,6 +25,7 @@ import ( ctypes "github.com/elys-network/elys/x/commitment/types" "github.com/elys-network/elys/x/incentive/types" + ptypes "github.com/elys-network/elys/x/parameter/types" ) // EndBlocker of incentive module @@ -74,6 +76,12 @@ func (k Keeper) ProcessElysStakedTracking(ctx sdk.Context) { // Rewards distribution func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context) { + // Read tokenomics time based inflation params and update incentive module params. + if !k.ProcessUpdateIncentiveParams(ctx) { + ctx.Logger().Error("Invalid tokenomics params", "error", errors.New("Invalid tokenomics params")) + return + } + stakerEpoch, stakeIncentive := k.IsStakerRewardsDistributionEpoch(ctx) if stakerEpoch { err := k.UpdateStakersRewardsUnclaimed(ctx, stakeIncentive) @@ -91,6 +99,76 @@ func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context) { } } +func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { + listTimeBasedInflations := k.tokenomicsKeeper.GetAllTimeBasedInflation(ctx) + if len(listTimeBasedInflations) < 1 { + return false + } + + params := k.GetParams(ctx) + + for _, inflation := range listTimeBasedInflations { + if inflation.StartBlockHeight > uint64(ctx.BlockHeight()) || inflation.EndBlockHeight < uint64(ctx.BlockHeight()) { + continue + } + + totalBlocksPerYear := sdk.NewInt(int64(inflation.EndBlockHeight - inflation.StartBlockHeight + 1)) + allocationEpochInblocks := totalBlocksPerYear.Quo(sdk.NewInt(ptypes.DaysPerYear)) + if len(params.LpIncentives) == 0 { + totalDistributionEpochPerYear := totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionEpochForLpsInBlocks)) + currentEpochInBlocks := sdk.NewInt(ctx.BlockHeight() - int64(inflation.StartBlockHeight)).Mul(totalDistributionEpochPerYear).Quo(totalBlocksPerYear) + maxEdenPerAllocation := sdk.NewInt(int64(inflation.Inflation.LmRewards)).Mul(allocationEpochInblocks).Quo(totalBlocksPerYear) + params.LpIncentives = append(params.LpIncentives, types.IncentiveInfo{ + // reward amount in eden for 1 year + EdenAmountPerYear: sdk.NewInt(int64(inflation.Inflation.LmRewards)), + // starting block height of the distribution + DistributionStartBlock: sdk.NewInt(int64(inflation.StartBlockHeight)), + // distribution duration - block number per year + TotalBlocksPerYear: totalBlocksPerYear, + // we set block numbers in 24 hrs + AllocationEpochInBlocks: allocationEpochInblocks, + // maximum eden allocation per day that won't exceed 30% apr + MaxEdenPerAllocation: maxEdenPerAllocation, + // number of block intervals that distribute rewards. + DistributionEpochInBlocks: sdk.NewInt(params.DistributionEpochForLpsInBlocks), + // current epoch in block number + CurrentEpochInBlocks: currentEpochInBlocks, + // eden boost apr (0-1) range + EdenBoostApr: sdk.NewDec(1), + }) + } + + if len(params.StakeIncentives) == 0 { + totalDistributionEpochPerYear := totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionEpochForStakersInBlocks)) + currentEpochInBlocks := sdk.NewInt(ctx.BlockHeight() - int64(inflation.StartBlockHeight)).Mul(totalDistributionEpochPerYear).Quo(totalBlocksPerYear) + maxEdenPerAllocation := sdk.NewInt(int64(inflation.Inflation.IcsStakingRewards)).Mul(allocationEpochInblocks).Quo(totalBlocksPerYear) + params.StakeIncentives = append(params.StakeIncentives, types.IncentiveInfo{ + // reward amount in eden for 1 year + EdenAmountPerYear: sdk.NewInt(int64(inflation.Inflation.IcsStakingRewards)), + // starting block height of the distribution + DistributionStartBlock: sdk.NewInt(int64(inflation.StartBlockHeight)), + // distribution duration - block number per year + TotalBlocksPerYear: totalBlocksPerYear, + // we set block numbers in 24 hrs + AllocationEpochInBlocks: allocationEpochInblocks, + // maximum eden allocation per day that won't exceed 30% apr + MaxEdenPerAllocation: maxEdenPerAllocation, + // number of block intervals that distribute rewards. + DistributionEpochInBlocks: sdk.NewInt(params.DistributionEpochForStakersInBlocks), + // current epoch in block number + CurrentEpochInBlocks: currentEpochInBlocks, + // eden boost apr (0-1) range + EdenBoostApr: sdk.NewDec(1), + }) + } + + break + } + + k.SetParams(ctx, params) + return true +} + func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.IncentiveInfo) { // Fetch incentive params params := k.GetParams(ctx) @@ -98,9 +176,6 @@ func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.I return false, types.IncentiveInfo{} } - // Update params - defer k.SetParams(ctx, params) - // If we don't have enough params if len(params.StakeIncentives) < 1 { return false, types.IncentiveInfo{} @@ -108,7 +183,6 @@ func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.I // Incentive params initialize stakeIncentive := params.StakeIncentives[0] - if ctx.BlockHeight()%stakeIncentive.DistributionEpochInBlocks.Int64() != 0 { return false, types.IncentiveInfo{} } @@ -120,14 +194,21 @@ func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.I // Increase current epoch of Stake incentive param stakeIncentive.CurrentEpochInBlocks = stakeIncentive.CurrentEpochInBlocks.Add(stakeIncentive.DistributionEpochInBlocks) - if stakeIncentive.CurrentEpochInBlocks.GTE(stakeIncentive.TotalBlocksPerYear) { + if stakeIncentive.CurrentEpochInBlocks.GTE(stakeIncentive.TotalBlocksPerYear) || curBlockHeight.GT(stakeIncentive.TotalBlocksPerYear.Add(stakeIncentive.DistributionStartBlock)) { if len(params.StakeIncentives) > 1 { params.StakeIncentives = params.StakeIncentives[1:] + k.SetParams(ctx, params) + return false, types.IncentiveInfo{} } else { + params.StakeIncentives = []types.IncentiveInfo(nil) + k.SetParams(ctx, params) return false, types.IncentiveInfo{} } } + params.StakeIncentives[0].CurrentEpochInBlocks = stakeIncentive.CurrentEpochInBlocks + k.SetParams(ctx, params) + // return found, stake incentive params return true, stakeIncentive } @@ -139,9 +220,6 @@ func (k Keeper) IsLPRewardsDistributionEpoch(ctx sdk.Context) (bool, types.Incen return false, types.IncentiveInfo{} } - // Update params - defer k.SetParams(ctx, params) - // If we don't have enough params if len(params.LpIncentives) < 1 { return false, types.IncentiveInfo{} @@ -160,14 +238,21 @@ func (k Keeper) IsLPRewardsDistributionEpoch(ctx sdk.Context) (bool, types.Incen // Increase current epoch of Stake incentive param lpIncentive.CurrentEpochInBlocks = lpIncentive.CurrentEpochInBlocks.Add(lpIncentive.DistributionEpochInBlocks) - if lpIncentive.CurrentEpochInBlocks.GTE(lpIncentive.TotalBlocksPerYear) { - if len(params.StakeIncentives) > 1 { + if lpIncentive.CurrentEpochInBlocks.GTE(lpIncentive.TotalBlocksPerYear) || curBlockHeight.GT(lpIncentive.TotalBlocksPerYear.Add(lpIncentive.DistributionStartBlock)) { + if len(params.LpIncentives) > 1 { params.LpIncentives = params.LpIncentives[1:] + k.SetParams(ctx, params) + return false, types.IncentiveInfo{} } else { + params.LpIncentives = []types.IncentiveInfo(nil) + k.SetParams(ctx, params) return false, types.IncentiveInfo{} } } + params.LpIncentives[0].CurrentEpochInBlocks = lpIncentive.CurrentEpochInBlocks + k.SetParams(ctx, params) + // return found, lp incentive params return true, lpIncentive } diff --git a/x/incentive/keeper/abci_test.go b/x/incentive/keeper/abci_test.go index 72c7948e8..391798808 100644 --- a/x/incentive/keeper/abci_test.go +++ b/x/incentive/keeper/abci_test.go @@ -5,9 +5,13 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" simapp "github.com/elys-network/elys/app" ctypes "github.com/elys-network/elys/x/commitment/types" ptypes "github.com/elys-network/elys/x/parameter/types" + tokenomicskeeper "github.com/elys-network/elys/x/tokenomics/keeper" + tokenomicstypes "github.com/elys-network/elys/x/tokenomics/types" "github.com/stretchr/testify/require" ) @@ -40,4 +44,82 @@ func TestABCI_EndBlocker(t *testing.T) { elysStaked, found := ik.GetElysStaked(ctx, genAccount.String()) require.Equal(t, found, true) require.Equal(t, elysStaked.Amount, sdk.DefaultPowerReduction) + + authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + srv := tokenomicskeeper.NewMsgServerImpl(app.TokenomicsKeeper) + + expected := &tokenomicstypes.MsgCreateTimeBasedInflation{Authority: authority, + StartBlockHeight: uint64(1), + EndBlockHeight: uint64(6307200), + Inflation: &tokenomicstypes.InflationEntry{ + LmRewards: 9999999, + IcsStakingRewards: 9999999, + CommunityFund: 9999999, + StrategicReserve: 9999999, + TeamTokensVested: 9999999, + }, + } + + wctx := sdk.WrapSDKContext(ctx) + _, err = srv.CreateTimeBasedInflation(wctx, expected) + require.NoError(t, err) + + expected = &tokenomicstypes.MsgCreateTimeBasedInflation{Authority: authority, + StartBlockHeight: uint64(6307201), + EndBlockHeight: uint64(12614401), + Inflation: &tokenomicstypes.InflationEntry{ + LmRewards: 9999999, + IcsStakingRewards: 9999999, + CommunityFund: 9999999, + StrategicReserve: 9999999, + TeamTokensVested: 9999999, + }, + } + _, err = srv.CreateTimeBasedInflation(wctx, expected) + require.NoError(t, err) + + // Set tokenomics params + listTimeBasdInflations := app.TokenomicsKeeper.GetAllTimeBasedInflation(ctx) + + // After the first year + ctx = ctx.WithBlockHeight(1) + paramSet := ik.ProcessUpdateIncentiveParams(ctx) + require.Equal(t, paramSet, true) + + // Check if the params are correctly set + params := ik.GetParams(ctx) + require.Equal(t, len(params.StakeIncentives), 1) + require.Equal(t, len(params.LpIncentives), 1) + + require.Equal(t, params.StakeIncentives[0].EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.IcsStakingRewards))) + require.Equal(t, params.LpIncentives[0].EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.LmRewards))) + + // After the first year + ctx = ctx.WithBlockHeight(6307210) + + // Incentive param should be empty + stakerEpoch, stakeIncentive := ik.IsStakerRewardsDistributionEpoch(ctx) + params = ik.GetParams(ctx) + require.Equal(t, stakerEpoch, false) + require.Equal(t, len(params.StakeIncentives), 0) + + // Incentive param should be empty + lpEpoch, lpIncentive := ik.IsLPRewardsDistributionEpoch(ctx) + params = ik.GetParams(ctx) + require.Equal(t, lpEpoch, false) + require.Equal(t, len(params.LpIncentives), 0) + + // After reading tokenomics again + paramSet = ik.ProcessUpdateIncentiveParams(ctx) + require.Equal(t, paramSet, true) + // Check params + stakerEpoch, stakeIncentive = ik.IsStakerRewardsDistributionEpoch(ctx) + params = ik.GetParams(ctx) + require.Equal(t, stakeIncentive.EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.IcsStakingRewards))) + + // Check params + lpEpoch, lpIncentive = ik.IsLPRewardsDistributionEpoch(ctx) + params = ik.GetParams(ctx) + require.Equal(t, lpIncentive.EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.IcsStakingRewards))) } diff --git a/x/incentive/keeper/apr.go b/x/incentive/keeper/apr.go index fd5fb1073..59a47415b 100644 --- a/x/incentive/keeper/apr.go +++ b/x/incentive/keeper/apr.go @@ -49,7 +49,12 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk poolShare := k.CalculatePoolShareForStableStakeLPs(ctx, totalProxyTVL, baseCurrency) // Eden amount for LP in 24hrs = AllocationEpochInBlocks is the number of block for 24 hrs - edenAmountPerDay := lpIncentive.EdenAmountPerYear.Quo(lpIncentive.AllocationEpochInBlocks) + edenAmountPerDay := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.AllocationEpochInBlocks).Quo(lpIncentive.TotalBlocksPerYear) + + maxEdenAmountPerLps := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) + + // Use min amount (eden allocation from tokenomics and max apr based eden amount) + edenAmountPerDay = sdk.MinInt(edenAmountPerDay, maxEdenAmountPerLps.TruncateInt()) // Eden amount for stable stake LP in 24hrs edenAmountPerStableStakePerDay := sdk.NewDecFromInt(edenAmountPerDay).Mul(poolShare) @@ -60,7 +65,7 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk // Eden Apr for usdc earn program = {(Eden allocated for stable stake pool per day*365*price{eden/usdc}/(total usdc deposit)}*100 // we divide 100000 as we have use 100000elys as input in the price estimation - apr := edenAmountPerStableStakePerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(edenPrice).QuoInt(totalUSDCDeposit.Amount).QuoInt(sdk.NewInt(100000)) + apr := edenAmountPerStableStakePerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(edenPrice).MulInt(sdk.NewInt(100)).QuoInt(totalUSDCDeposit.Amount).QuoInt(sdk.NewInt(100000)) return apr.TruncateInt(), nil } else { // Elys staking, Eden committed, EdenB committed. @@ -69,11 +74,18 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk k.UpdateTotalCommitmentInfo(ctx, baseCurrency) totalStakedSnapshot := k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted) + // Calculate + edenAmountPerEpochStakersPerDay := stkIncentive.EdenAmountPerYear.Mul(stkIncentive.AllocationEpochInBlocks).Quo(stkIncentive.TotalBlocksPerYear) + + // Maximum eden based per distribution epoch on maximum APR - 30% by default + // Allocated for staking per day = (0.3/365)* ( total elys staked + total Eden committed + total Eden boost committed) + maxEdenAmountPerStakers := params.MaxEdenRewardAprStakers.MulInt(totalStakedSnapshot).MulInt(stkIncentive.AllocationEpochInBlocks).QuoInt(stkIncentive.TotalBlocksPerYear) + + // Use min amount (eden allocation from tokenomics and max apr based eden amount) + edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakers.TruncateInt()) + // For Eden reward Apr for elys staking = {(amount of Eden allocated for staking per day)*365/( total elys staked + total Eden committed + total Eden boost committed)}*100 - apr := stkIncentive.EdenAmountPerYear.Mul(sdk.NewInt(100)).Quo(totalStakedSnapshot) - params := k.GetParams(ctx) - maxApr := params.MaxEdenRewardApr.MulInt(sdk.NewInt(100)).TruncateInt() - apr = sdk.MinInt(apr, maxApr) + apr := edenAmountPerEpochStakersPerDay.Mul(sdk.NewInt(ptypes.DaysPerYear)).Mul(sdk.NewInt(100)).Quo(totalStakedSnapshot) return apr, nil } @@ -109,7 +121,7 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk // Usdc apr for elys staking = (24 hour dex rewards in USDC generated for stakers) * 365*100/ {price ( elys/usdc)*( sum of (elys staked, Eden committed, Eden boost committed))} // we multiply 10 as we have use 10elys as input in the price estimation - apr := amtDexRewardPerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(sdk.NewInt(10)).QuoInt(edenPrice).QuoInt(totalStakedSnapshot) + apr := amtDexRewardPerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(sdk.NewInt(100)).MulInt(sdk.NewInt(10)).QuoInt(edenPrice).QuoInt(totalStakedSnapshot) return apr.TruncateInt(), nil } diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 6740eef96..767b179b3 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -20,23 +20,25 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - cmk types.CommitmentKeeper - stk types.StakingKeeper - tci *types.TotalCommitmentInfo - authKeeper types.AccountKeeper - bankKeeper types.BankKeeper - amm types.AmmKeeper - oracleKeeper types.OracleKeeper - apKeeper types.AssetProfileKeeper - epochsKeeper types.EpochsKeeper - stableKeeper types.StableStakeKeeper + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + paramstore paramtypes.Subspace + cmk types.CommitmentKeeper + stk types.StakingKeeper + tci *types.TotalCommitmentInfo + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + amm types.AmmKeeper + oracleKeeper types.OracleKeeper + apKeeper types.AssetProfileKeeper + epochsKeeper types.EpochsKeeper + stableKeeper types.StableStakeKeeper + tokenomicsKeeper types.TokenomicsKeeper feeCollectorName string // name of the FeeCollector ModuleAccount dexRevCollectorName string // name of the Dex Revenue ModuleAccount + authority string // gov module addresss } ) @@ -54,8 +56,10 @@ func NewKeeper( ap types.AssetProfileKeeper, epochsKeeper types.EpochsKeeper, stableKeeper types.StableStakeKeeper, + tokenomicsKeeper types.TokenomicsKeeper, feeCollectorName string, dexRevCollectorName string, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -79,6 +83,8 @@ func NewKeeper( apKeeper: ap, epochsKeeper: epochsKeeper, stableKeeper: stableKeeper, + tokenomicsKeeper: tokenomicsKeeper, + authority: authority, } } @@ -129,14 +135,17 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty params := k.GetParams(ctx) // Calculate - edenAmountPerEpochStakers := stakeIncentive.EdenAmountPerYear.Quo(stakeIncentive.TotalBlocksPerYear).Mul(stakeIncentive.DistributionEpochInBlocks) + edenAmountPerEpochStakersPerDay := stakeIncentive.EdenAmountPerYear.Mul(stakeIncentive.AllocationEpochInBlocks).Quo(stakeIncentive.TotalBlocksPerYear) // Maximum eden based per distribution epoch on maximum APR - 30% by default // Allocated for staking per day = (0.3/365)* ( total elys staked + total Eden committed + total Eden boost committed) - maxEdenAmountPerStakers := params.MaxEdenRewardApr.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.DistributionEpochInBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) + maxEdenAmountPerStakers := params.MaxEdenRewardAprStakers.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.AllocationEpochInBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochStakers = sdk.MinInt(edenAmountPerEpochStakers, maxEdenAmountPerStakers.TruncateInt()) + edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakers.TruncateInt()) + + // Calculate eden amount per distribution epoch + edenAmountPerEpochStakers := edenAmountPerEpochStakersPerDay.Mul(stakeIncentive.DistributionEpochInBlocks).Quo(stakeIncentive.AllocationEpochInBlocks) // Track the DEX rewards distribution for stakers // Add dexRevenue amount that was tracked by Lp tracker @@ -337,11 +346,29 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince dexRevenueStakersAmt := dexRevenueRemainedForStakers.AmountOf(baseCurrency) gasFeesLPsAmt := gasFeesForLps.AmountOf(baseCurrency) + // Proxy TVL + // Multiplier on each liquidity pool + // We have 3 pools of 20, 30, 40 TVL + // We have mulitplier of 0.3, 0.5, 1.0 + // Proxy TVL = 20*0.3+30*0.5+40*1.0 + totalProxyTVL := k.CalculateProxyTVL(ctx, baseCurrency) + // Calculate eden amount per epoch - edenAmountPerEpochLPs := lpIncentive.EdenAmountPerYear.Quo(lpIncentive.TotalBlocksPerYear).Mul(lpIncentive.DistributionEpochInBlocks) + edenAmountPerEpochLPsPerDay := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.AllocationEpochInBlocks).Quo(lpIncentive.TotalBlocksPerYear) // Track the DEX rewards distribution for stakers params := k.GetParams(ctx) + + // Maximum eden based per distribution epoch on maximum APR - 30% by default + // Allocated for staking per day = (0.3/365)* (total weighted proxy TVL) + maxEdenAmountPerLps := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) + + // Use min amount (eden allocation from tokenomics and max apr based eden amount) + edenAmountPerEpochLPsPerDay = sdk.MinInt(edenAmountPerEpochLPsPerDay, maxEdenAmountPerLps.TruncateInt()) + + // Calculate Eden amount per distribution epoch + edenAmountPerEpochLPs := edenAmountPerEpochLPsPerDay.Mul(lpIncentive.DistributionEpochInBlocks).Quo(lpIncentive.AllocationEpochInBlocks) + // Add dexRevenue amount that was tracked by Lp tracker dexRevenueLPsAmt = dexRevenueLPsAmt.Add(params.DexRewardsLps.AmountCollectedByOtherTracker) // Increase block number @@ -354,13 +381,6 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince params.DexRewardsStakers.AmountCollectedByOtherTracker = params.DexRewardsStakers.AmountCollectedByOtherTracker.Add(dexRevenueStakersAmt) k.SetParams(ctx, params) - // Proxy TVL - // Multiplier on each liquidity pool - // We have 3 pools of 20, 30, 40 TVL - // We have mulitplier of 0.3, 0.5, 1.0 - // Proxy TVL = 20*0.3+30*0.5+40*1.0 - totalProxyTVL := k.CalculateProxyTVL(ctx, baseCurrency) - totalEdenGivenLP := sdk.ZeroInt() totalRewardsGivenLP := sdk.ZeroInt() // Process to increase uncomitted token amount of Eden & Eden boost diff --git a/x/incentive/keeper/msg_server_update_incentive_params.go b/x/incentive/keeper/msg_server_update_incentive_params.go new file mode 100644 index 000000000..17cc56972 --- /dev/null +++ b/x/incentive/keeper/msg_server_update_incentive_params.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/elys-network/elys/x/incentive/types" +) + +func (k msgServer) UpdateIncentiveParams(goCtx context.Context, msg *types.MsgUpdateIncentiveParams) (*types.MsgUpdateIncentiveParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.authority != msg.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + params := k.GetParams(ctx) + params.CommunityTax = msg.CommunityTax + params.WithdrawAddrEnabled = msg.WithdrawAddrEnabled + params.RewardPortionForLps = msg.RewardPortionForLps + params.ElysStakeTrackingRate = msg.ElysStakeTrackingRate + params.MaxEdenRewardAprLps = msg.MaxEdenRewardAprLps + params.MaxEdenRewardAprStakers = msg.MaxEdenRewardAprStakers + params.DistributionEpochForLpsInBlocks = msg.DistributionEpochForLps + params.DistributionEpochForStakersInBlocks = msg.DistributionEpochForStakers + + k.SetParams(ctx, params) + + return &types.MsgUpdateIncentiveParamsResponse{}, nil +} diff --git a/x/incentive/migrations/v7_migration.go b/x/incentive/migrations/v7_migration.go new file mode 100644 index 000000000..adcfe5a75 --- /dev/null +++ b/x/incentive/migrations/v7_migration.go @@ -0,0 +1,11 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/incentive/types" +) + +func (m Migrator) V7Migration(ctx sdk.Context) error { + m.keeper.SetParams(ctx, types.NewParams()) + return nil +} diff --git a/x/incentive/module.go b/x/incentive/module.go index 2ba2bb2c1..1f692362f 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -111,7 +111,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) m := migrations.NewMigrator(am.keeper) - err := cfg.RegisterMigration(types.ModuleName, 5, m.V6Migration) + err := cfg.RegisterMigration(types.ModuleName, 6, m.V7Migration) if err != nil { panic(err) } @@ -137,7 +137,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 6 } +func (AppModule) ConsensusVersion() uint64 { return 7 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/incentive/module_simulation.go b/x/incentive/module_simulation.go index e8fb23b75..b122db5ba 100644 --- a/x/incentive/module_simulation.go +++ b/x/incentive/module_simulation.go @@ -34,6 +34,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgWithdrawDelegatorReward int = 100 + opWeightMsgUpdateIncentiveParams = "op_weight_msg_update_incentive_params" + // TODO: Determine the simulation weight value + defaultWeightMsgUpdateIncentiveParams int = 100 + // this line is used by starport scaffolding # simapp/module/const ) diff --git a/x/incentive/simulation/update_incentive_params.go b/x/incentive/simulation/update_incentive_params.go new file mode 100644 index 000000000..b94d52943 --- /dev/null +++ b/x/incentive/simulation/update_incentive_params.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/elys-network/elys/x/incentive/keeper" + "github.com/elys-network/elys/x/incentive/types" +) + +func SimulateMsgUpdateIncentiveParams( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUpdateIncentiveParams{ + Authority: simAccount.Address.String(), + } + + // TODO: Handling the UpdateIncentiveParams simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateIncentiveParams simulation not implemented"), nil, nil + } +} diff --git a/x/incentive/types/codec.go b/x/incentive/types/codec.go index 3769f7a77..c8f710dac 100644 --- a/x/incentive/types/codec.go +++ b/x/incentive/types/codec.go @@ -3,16 +3,20 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - // this line is used by starport scaffolding # 1 ) func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateIncentiveParams{}, "incentive/UpdateIncentiveParams", nil) // this line is used by starport scaffolding # 2 } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateIncentiveParams{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations( (*govtypes.Content)(nil), diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index eb1e48828..33a214595 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -10,6 +10,7 @@ import ( epochstypes "github.com/elys-network/elys/x/epochs/types" oracletypes "github.com/elys-network/elys/x/oracle/types" stabletypes "github.com/elys-network/elys/x/stablestake/types" + tokenomictypes "github.com/elys-network/elys/x/tokenomics/types" ) // CommitmentKeeper @@ -137,3 +138,8 @@ type EpochsKeeper interface { type StableStakeKeeper interface { GetParams(ctx sdk.Context) (params stabletypes.Params) } + +// TokenomicsKeeper defines the expected tokenomics keeper used for simulations (noalias) +type TokenomicsKeeper interface { + GetAllTimeBasedInflation(ctx sdk.Context) (list []tokenomictypes.TimeBasedInflation) +} diff --git a/x/incentive/types/message_update_incentive_params.go b/x/incentive/types/message_update_incentive_params.go new file mode 100644 index 000000000..1184d6086 --- /dev/null +++ b/x/incentive/types/message_update_incentive_params.go @@ -0,0 +1,73 @@ +package types + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdateIncentiveParams = "update_incentive_params" + +var _ sdk.Msg = &MsgUpdateIncentiveParams{} + +func NewMsgUpdateIncentiveParams(creator string, communityTax sdk.Dec, withdrawAddrEnabled bool, rewardPortionForLps sdk.Dec, elysStakeTrackingRate int64, maxEdenRewardAprStakers sdk.Dec, maxEdenRewardParLps sdk.Dec, distributionEpochForStakers int64, distributionEpochForLps int64) *MsgUpdateIncentiveParams { + return &MsgUpdateIncentiveParams{ + Authority: creator, + CommunityTax: communityTax, + WithdrawAddrEnabled: withdrawAddrEnabled, + RewardPortionForLps: rewardPortionForLps, + ElysStakeTrackingRate: elysStakeTrackingRate, + MaxEdenRewardAprStakers: maxEdenRewardAprStakers, + MaxEdenRewardAprLps: maxEdenRewardParLps, + DistributionEpochForStakers: distributionEpochForStakers, + DistributionEpochForLps: distributionEpochForLps, + } +} + +func (msg *MsgUpdateIncentiveParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateIncentiveParams) Type() string { + return TypeMsgUpdateIncentiveParams +} + +func (msg *MsgUpdateIncentiveParams) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateIncentiveParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateIncentiveParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if msg.RewardPortionForLps.GT(sdk.NewDec(1)) { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid rewards portion for LPs (%s)", errors.New("Invalid LP portion")) + } + if msg.MaxEdenRewardAprStakers.LT(sdk.ZeroDec()) { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid max eden rewards apr for stakers (%s)", errors.New("Invalid Rewards APR")) + } + if msg.MaxEdenRewardAprLps.LT(sdk.ZeroDec()) { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid max eden rewards apr for stakers (%s)", errors.New("Invalid Rewards APR")) + } + if msg.DistributionEpochForStakers < 1 { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid distribution epoch (%s)", errors.New("Invalid epoch")) + } + if msg.DistributionEpochForLps < 1 { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid distribution epoch (%s)", errors.New("Invalid epoch")) + } + if msg.ElysStakeTrackingRate < 1 { + return sdkerrors.Wrapf(sdkerrors.ErrNotSupported, "invalid elys staked tracking epoch (%s)", errors.New("Invalid elys staked tracking epoch")) + } + return nil +} diff --git a/x/incentive/types/message_update_incentive_params_test.go b/x/incentive/types/message_update_incentive_params_test.go new file mode 100644 index 000000000..907a6f7aa --- /dev/null +++ b/x/incentive/types/message_update_incentive_params_test.go @@ -0,0 +1,53 @@ +package types + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/elys-network/elys/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgUpdateIncentiveParams_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdateIncentiveParams + err error + }{ + { + name: "invalid address", + msg: MsgUpdateIncentiveParams{ + Authority: "invalid_address", + RewardPortionForLps: sdk.NewDecWithPrec(65, 2), + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), + DistributionEpochForStakers: 10, + DistributionEpochForLps: 10, + ElysStakeTrackingRate: 10, + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUpdateIncentiveParams{ + Authority: sample.AccAddress(), + RewardPortionForLps: sdk.NewDecWithPrec(65, 2), + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), + DistributionEpochForStakers: 10, + DistributionEpochForLps: 10, + ElysStakeTrackingRate: 10, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 64937c0a0..906ad8beb 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -12,16 +12,19 @@ var _ paramtypes.ParamSet = (*Params)(nil) // Parameter keys var ( - ParamStoreKeyCommunityTax = []byte("communitytax") - ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") - ParamStoreKeyRewardPortionForLps = []byte("rewardportionforlps") - ParamStoreKeyLPIncentives = []byte("lpincentives") - ParamStoreKeyStkIncentives = []byte("stkincentives") - ParamStoreKeyPoolInfos = []byte("poolinfos") - ParamStoreKeyElysStakeTrackingRate = []byte("elysstaketrackingrate") - ParamStoreKeyDexRewardsStakers = []byte("dexrewardsstakers") - ParamStoreKeyDexRewardsLps = []byte("dexrewardslps") - ParamStoreKeyMaxEdenRewardApr = []byte("maxedenrewardapr") + ParamStoreKeyCommunityTax = []byte("communitytax") + ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") + ParamStoreKeyRewardPortionForLps = []byte("rewardportionforlps") + ParamStoreKeyLPIncentives = []byte("lpincentives") + ParamStoreKeyStkIncentives = []byte("stkincentives") + ParamStoreKeyPoolInfos = []byte("poolinfos") + ParamStoreKeyElysStakeTrackingRate = []byte("elysstaketrackingrate") + ParamStoreKeyDexRewardsStakers = []byte("dexrewardsstakers") + ParamStoreKeyDexRewardsLps = []byte("dexrewardslps") + ParamStoreKeyMaxEdenRewardAprForStakers = []byte("maxedenrewardaprstakers") + ParamStoreKeyMaxEdenRewardAprForLPs = []byte("maxedenrewardaprlps") + ParamStoreKeyDistributionEpochLPs = []byte("distributionepochlps") + ParamStoreKeyDistributionEpochStakers = []byte("distributionepochstakers") ) // ParamKeyTable the param key table for launch module @@ -49,7 +52,10 @@ func NewParams() Params { Amount: sdk.ZeroDec(), AmountCollectedByOtherTracker: sdk.ZeroDec(), }, - MaxEdenRewardApr: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), + DistributionEpochForStakersInBlocks: 10, + DistributionEpochForLpsInBlocks: 10, } } @@ -70,7 +76,10 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(ParamStoreKeyElysStakeTrackingRate, &p.ElysStakeTrackingRate, validateElysStakeTrakcingRate), paramtypes.NewParamSetPair(ParamStoreKeyDexRewardsStakers, &p.DexRewardsStakers, validateDexRewardsStakers), paramtypes.NewParamSetPair(ParamStoreKeyDexRewardsLps, &p.DexRewardsLps, validateDexRewardsLps), - paramtypes.NewParamSetPair(ParamStoreKeyMaxEdenRewardApr, &p.MaxEdenRewardApr, validateEdenRewardApr), + paramtypes.NewParamSetPair(ParamStoreKeyMaxEdenRewardAprForStakers, &p.MaxEdenRewardAprStakers, validateEdenRewardApr), + paramtypes.NewParamSetPair(ParamStoreKeyMaxEdenRewardAprForLPs, &p.MaxEdenRewardAprLps, validateEdenRewardApr), + paramtypes.NewParamSetPair(ParamStoreKeyDistributionEpochLPs, &p.DistributionEpochForLpsInBlocks, validateDistributionEpochLps), + paramtypes.NewParamSetPair(ParamStoreKeyDistributionEpochStakers, &p.DistributionEpochForStakersInBlocks, validateDistributionEpochStakers), } } @@ -116,6 +125,14 @@ func (p Params) Validate() error { return err } + if err := validateDistributionEpochLps(p.DistributionEpochForLpsInBlocks); err != nil { + return err + } + + if err := validateDistributionEpochStakers(p.DistributionEpochForStakersInBlocks); err != nil { + return err + } + return nil } @@ -315,3 +332,29 @@ func validateEdenRewardApr(i interface{}) error { return nil } + +func validateDistributionEpochLps(i interface{}) error { + v, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} + +func validateDistributionEpochStakers(i interface{}) error { + v, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index 3782999c2..c6c8e66ef 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -40,8 +40,14 @@ type Params struct { DexRewardsStakers DexRewardsTracker `protobuf:"bytes,8,opt,name=dex_rewards_stakers,json=dexRewardsStakers,proto3" json:"dex_rewards_stakers"` // Tracking dex rewards given to LPs DexRewardsLps DexRewardsTracker `protobuf:"bytes,9,opt,name=dex_rewards_lps,json=dexRewardsLps,proto3" json:"dex_rewards_lps"` - // Maximum eden reward apr - MaxEdenRewardApr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=max_eden_reward_apr,json=maxEdenRewardApr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr"` + // Maximum eden reward apr for stakers + MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=max_eden_reward_apr_stakers,json=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_stakers"` + // Maximum eden reward apr for lps + MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=max_eden_reward_apr_lps,json=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_lps"` + // Distribution epochs for stakers in blocks + DistributionEpochForStakersInBlocks int64 `protobuf:"varint,12,opt,name=distribution_epoch_for_stakers_in_blocks,json=distributionEpochForStakersInBlocks,proto3" json:"distribution_epoch_for_stakers_in_blocks,omitempty"` + // Distribution epochs for LPs in blocks + DistributionEpochForLpsInBlocks int64 `protobuf:"varint,13,opt,name=distribution_epoch_for_lps_in_blocks,json=distributionEpochForLpsInBlocks,proto3" json:"distribution_epoch_for_lps_in_blocks,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -125,6 +131,20 @@ func (m *Params) GetDexRewardsLps() DexRewardsTracker { return DexRewardsTracker{} } +func (m *Params) GetDistributionEpochForStakersInBlocks() int64 { + if m != nil { + return m.DistributionEpochForStakersInBlocks + } + return 0 +} + +func (m *Params) GetDistributionEpochForLpsInBlocks() int64 { + if m != nil { + return m.DistributionEpochForLpsInBlocks + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "elys.incentive.Params") } @@ -132,40 +152,46 @@ func init() { func init() { proto.RegisterFile("elys/incentive/params.proto", fileDescriptor_3bca0267cb466fec) } var fileDescriptor_3bca0267cb466fec = []byte{ - // 524 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0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0x60, 0x4d, - 0xed, 0xf7, 0xa0, 0xf3, 0x97, 0xff, 0x04, 0x6e, 0xf4, 0x2c, 0x77, 0xb3, 0xff, 0x64, 0xbd, 0x81, - 0x43, 0x9a, 0x06, 0x79, 0x65, 0x26, 0xa1, 0xb2, 0xe8, 0xe4, 0x1e, 0x29, 0xc1, 0x28, 0x37, 0xd8, - 0xef, 0xc0, 0x76, 0x55, 0x6c, 0xe2, 0x6a, 0xfd, 0x9f, 0xb4, 0xfd, 0x5b, 0x6a, 0x12, 0xfa, 0x08, - 0x3a, 0x09, 0x4e, 0x11, 0x25, 0x94, 0x15, 0x56, 0x84, 0x85, 0x84, 0xe0, 0x46, 0x67, 0xb0, 0x93, - 0xe0, 0xf4, 0x88, 0x50, 0x96, 0xfb, 0x0f, 0x84, 0x7c, 0xd9, 0xf8, 0xfa, 0xad, 0x5b, 0x1b, 0x1c, - 0x5f, 0x2c, 0x1d, 0xeb, 0x72, 0xe9, 0x58, 0x3f, 0x97, 0x8e, 0xf5, 0x79, 0xe5, 0xd4, 0x2e, 0x57, - 0x4e, 0xed, 0xfb, 0xca, 0xa9, 0x7d, 0xf0, 0x2a, 0x66, 0xf3, 0x01, 0xfb, 0x8c, 0xea, 0x39, 0x97, - 0xb3, 0x6c, 0xe2, 0xa7, 0x95, 0x7b, 0x97, 0xed, 0x32, 0x6e, 0x66, 0x57, 0xed, 0xf9, 0xaf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xea, 0x74, 0xfc, 0xe3, 0x14, 0x04, 0x00, 0x00, + // 609 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x9b, 0xdf, 0xf6, 0x1b, 0x9b, 0xb7, 0x32, 0xc8, 0x18, 0x0b, 0x9b, 0x48, 0xcb, 0x1f, + 0xa1, 0x5c, 0x96, 0x48, 0xe3,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 0x9b, 0x8f, 0x20, 0xab, 0x3c, 0x49, 0x26, 0x8e, 0xee, 0x82, + 0x79, 0x85, 0x9e, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x05, 0xba, 0xe8, 0x80, 0x2f, 0x05, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -188,10 +214,30 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DistributionEpochForLpsInBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForLpsInBlocks)) + i-- + dAtA[i] = 0x68 + } + if m.DistributionEpochForStakersInBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForStakersInBlocks)) + i-- + dAtA[i] = 0x60 + } { - size := m.MaxEdenRewardApr.Size() + size := m.MaxEdenRewardAprLps.Size() i -= size - if _, err := m.MaxEdenRewardApr.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.MaxEdenRewardAprLps.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size := m.MaxEdenRewardAprStakers.Size() + i -= size + if _, err := m.MaxEdenRewardAprStakers.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintParams(dAtA, i, uint64(size)) @@ -347,8 +393,16 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.DexRewardsLps.Size() n += 1 + l + sovParams(uint64(l)) - l = m.MaxEdenRewardApr.Size() + l = m.MaxEdenRewardAprStakers.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.MaxEdenRewardAprLps.Size() n += 1 + l + sovParams(uint64(l)) + if m.DistributionEpochForStakersInBlocks != 0 { + n += 1 + sovParams(uint64(m.DistributionEpochForStakersInBlocks)) + } + if m.DistributionEpochForLpsInBlocks != 0 { + n += 1 + sovParams(uint64(m.DistributionEpochForLpsInBlocks)) + } return n } @@ -664,7 +718,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardApr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprStakers", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -692,10 +746,82 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.MaxEdenRewardApr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxEdenRewardAprStakers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprLps", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxEdenRewardAprLps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForStakersInBlocks", wireType) + } + m.DistributionEpochForStakersInBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DistributionEpochForStakersInBlocks |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForLpsInBlocks", wireType) + } + m.DistributionEpochForLpsInBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DistributionEpochForLpsInBlocks |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 90c816d04..fbd2cdb5c 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -186,43 +187,176 @@ func (m *MsgWithdrawValidatorCommissionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawValidatorCommissionResponse proto.InternalMessageInfo +type MsgUpdateIncentiveParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"communityTax"` + WithdrawAddrEnabled bool `protobuf:"varint,3,opt,name=withdrawAddrEnabled,proto3" json:"withdrawAddrEnabled,omitempty"` + RewardPortionForLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=rewardPortionForLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rewardPortionForLps"` + ElysStakeTrackingRate int64 `protobuf:"varint,5,opt,name=elysStakeTrackingRate,proto3" json:"elysStakeTrackingRate,omitempty"` + MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprStakers"` + MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprLps"` + DistributionEpochForStakers int64 `protobuf:"varint,8,opt,name=distributionEpochForStakers,proto3" json:"distributionEpochForStakers,omitempty"` + DistributionEpochForLps int64 `protobuf:"varint,9,opt,name=distributionEpochForLps,proto3" json:"distributionEpochForLps,omitempty"` +} + +func (m *MsgUpdateIncentiveParams) Reset() { *m = MsgUpdateIncentiveParams{} } +func (m *MsgUpdateIncentiveParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIncentiveParams) ProtoMessage() {} +func (*MsgUpdateIncentiveParams) Descriptor() ([]byte, []int) { + return fileDescriptor_59dc3bedfb1cce84, []int{4} +} +func (m *MsgUpdateIncentiveParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIncentiveParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIncentiveParams.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 *MsgUpdateIncentiveParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIncentiveParams.Merge(m, src) +} +func (m *MsgUpdateIncentiveParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIncentiveParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIncentiveParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIncentiveParams proto.InternalMessageInfo + +func (m *MsgUpdateIncentiveParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateIncentiveParams) GetWithdrawAddrEnabled() bool { + if m != nil { + return m.WithdrawAddrEnabled + } + return false +} + +func (m *MsgUpdateIncentiveParams) GetElysStakeTrackingRate() int64 { + if m != nil { + return m.ElysStakeTrackingRate + } + return 0 +} + +func (m *MsgUpdateIncentiveParams) GetDistributionEpochForStakers() int64 { + if m != nil { + return m.DistributionEpochForStakers + } + return 0 +} + +func (m *MsgUpdateIncentiveParams) GetDistributionEpochForLps() int64 { + if m != nil { + return m.DistributionEpochForLps + } + return 0 +} + +type MsgUpdateIncentiveParamsResponse struct { +} + +func (m *MsgUpdateIncentiveParamsResponse) Reset() { *m = MsgUpdateIncentiveParamsResponse{} } +func (m *MsgUpdateIncentiveParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateIncentiveParamsResponse) ProtoMessage() {} +func (*MsgUpdateIncentiveParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_59dc3bedfb1cce84, []int{5} +} +func (m *MsgUpdateIncentiveParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateIncentiveParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateIncentiveParamsResponse.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 *MsgUpdateIncentiveParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateIncentiveParamsResponse.Merge(m, src) +} +func (m *MsgUpdateIncentiveParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateIncentiveParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateIncentiveParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateIncentiveParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgWithdrawRewards)(nil), "elys.incentive.MsgWithdrawRewards") proto.RegisterType((*MsgWithdrawRewardsResponse)(nil), "elys.incentive.MsgWithdrawRewardsResponse") proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "elys.incentive.MsgWithdrawValidatorCommission") proto.RegisterType((*MsgWithdrawValidatorCommissionResponse)(nil), "elys.incentive.MsgWithdrawValidatorCommissionResponse") + proto.RegisterType((*MsgUpdateIncentiveParams)(nil), "elys.incentive.MsgUpdateIncentiveParams") + proto.RegisterType((*MsgUpdateIncentiveParamsResponse)(nil), "elys.incentive.MsgUpdateIncentiveParamsResponse") } func init() { proto.RegisterFile("elys/incentive/tx.proto", fileDescriptor_59dc3bedfb1cce84) } var fileDescriptor_59dc3bedfb1cce84 = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcd, 0xa9, 0x2c, - 0xd6, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x49, 0xe8, 0xc1, 0x25, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, - 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x3c, - 0x44, 0x02, 0xc2, 0x81, 0x4a, 0xc9, 0x80, 0x4d, 0x4e, 0xce, 0xcf, 0xcd, 0xcd, 0x2c, 0xc9, 0x4d, - 0xcd, 0x2b, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0xca, 0x2a, 0x2d, 0x65, 0xe4, 0x12, 0xf2, - 0x2d, 0x4e, 0x0f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0x0f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, - 0x29, 0x16, 0x72, 0xe5, 0x12, 0x4c, 0x49, 0xcd, 0x49, 0x4d, 0x4f, 0x2c, 0xc9, 0x2f, 0x8a, 0x4f, - 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, - 0x45, 0x57, 0x04, 0x6a, 0x83, 0x23, 0x44, 0x26, 0xb8, 0xa4, 0x28, 0x33, 0x2f, 0x3d, 0x48, 0x00, - 0xae, 0x05, 0x2a, 0x2e, 0x64, 0xc7, 0xc5, 0x5b, 0x0e, 0x35, 0x39, 0xbe, 0xa4, 0xb2, 0x20, 0x55, - 0x82, 0x49, 0x81, 0x51, 0x83, 0xcf, 0x48, 0x52, 0x0f, 0xec, 0x29, 0x84, 0x9b, 0xf4, 0x5c, 0x13, - 0x8b, 0xf2, 0x42, 0x2a, 0x0b, 0x52, 0x83, 0x78, 0x60, 0xea, 0x41, 0x3c, 0x2b, 0x8e, 0x8e, 0x05, - 0xf2, 0x0c, 0x2f, 0x16, 0xc8, 0x33, 0x28, 0xc9, 0x70, 0x49, 0x61, 0x3a, 0x33, 0x28, 0xb5, 0xb8, - 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x69, 0x07, 0x23, 0x97, 0x1c, 0x92, 0x74, 0x58, 0x62, 0x4e, 0x66, - 0x0a, 0xc8, 0x1d, 0xce, 0x20, 0x1b, 0x8a, 0x8b, 0x33, 0xf3, 0xf3, 0xa8, 0xe5, 0x23, 0x57, 0x2e, - 0xc1, 0x32, 0x98, 0xe9, 0x70, 0x63, 0x98, 0x08, 0x19, 0x03, 0xd7, 0x02, 0x15, 0x47, 0xf2, 0x98, - 0x06, 0x97, 0x1a, 0x7e, 0x97, 0xc3, 0x3c, 0x69, 0xf4, 0x81, 0x91, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, - 0x28, 0x91, 0x8b, 0x1f, 0x3d, 0xba, 0x94, 0xf4, 0x50, 0x53, 0x89, 0x1e, 0x66, 0x58, 0x49, 0x69, - 0x11, 0x56, 0x03, 0xb3, 0x4a, 0xa8, 0x95, 0x91, 0x4b, 0x1a, 0x5f, 0x60, 0xea, 0xe1, 0x31, 0x0b, - 0x8b, 0x7a, 0x29, 0x33, 0xd2, 0xd4, 0xc3, 0xdc, 0xe1, 0xe4, 0x71, 0xe2, 0x91, 0x1c, 0xe3, 0x85, - 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, - 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x7a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0xa0, 0x34, 0xa4, 0x0f, - 0x32, 0x5b, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x1b, 0xcc, 0xd1, 0xaf, 0x40, 0xce, 0x49, - 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xe4, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xa5, - 0x7b, 0xff, 0x7c, 0x68, 0x03, 0x00, 0x00, + // 656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4e, 0x13, 0x41, + 0x1c, 0xee, 0x82, 0x20, 0x4c, 0x10, 0x65, 0x80, 0xb0, 0x14, 0xb2, 0x6d, 0x7a, 0x20, 0x1b, 0x13, + 0x76, 0x09, 0x1a, 0x63, 0x3c, 0x18, 0x41, 0x97, 0x68, 0x22, 0x09, 0x59, 0x50, 0x13, 0x2f, 0x38, + 0xdd, 0x9d, 0x6c, 0x27, 0xed, 0xce, 0x6c, 0x66, 0xa6, 0xb4, 0x7d, 0x00, 0x13, 0x8f, 0x3e, 0x81, + 0xe1, 0xe2, 0x1b, 0x78, 0xf0, 0x11, 0x38, 0x12, 0x4f, 0xc6, 0x03, 0x31, 0x10, 0x13, 0x1f, 0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, 0x2e, 0x16, 0x11, 0xa3, 0x02, 0xd7, 0xbe, 0x6a, 0xc0, + 0xe8, 0x83, 0x5f, 0xa3, 0x16, 0xf1, 0x95, 0x8f, 0xa7, 0x2a, 0x82, 0x10, 0x84, 0xd1, 0xff, 0x95, + 0x91, 0x03, 0xa6, 0xf6, 0x32, 0xf5, 0x5c, 0x66, 0xe8, 0x2a, 0x99, 0xfc, 0x48, 0xba, 0xdf, 0x97, + 0x98, 0x09, 0x96, 0x06, 0x3b, 0xcf, 0x93, 0xfc, 0x34, 0x02, 0xf4, 0x4d, 0x11, 0xbc, 0x8a, 0x7c, + 0x24, 0xf1, 0x8b, 0x6c, 0x20, 0xb6, 0xe2, 0x6e, 0xc2, 0x45, 0x30, 0x8e, 0xda, 0xb2, 0xc1, 0x38, + 0x91, 0xbd, 0x24, 0x2d, 0xf7, 0x74, 0x03, 0xba, 0x60, 0x42, 0x15, 0xbb, 0x4d, 0x89, 0xec, 0xed, + 0xa0, 0x6e, 0x6a, 0xd8, 0x3a, 0x38, 0xaa, 0x94, 0x7e, 0x1c, 0x55, 0x96, 0x02, 0x22, 0x1b, 0xed, + 0xba, 0xea, 0x47, 0x3a, 0x3a, 0xe9, 0xcf, 0xb2, 0xf0, 0x9b, 0xb6, 0xea, 0x9b, 0xb0, 0x9e, 0x61, + 0xcf, 0x3d, 0xa3, 0x01, 0x57, 0xc0, 0x74, 0xd6, 0x2b, 0x95, 0x95, 0x43, 0x51, 0xbd, 0x85, 0x7d, + 0x7d, 0xb8, 0xaa, 0x99, 0x63, 0x6e, 0x11, 0x04, 0xdf, 0x81, 0x69, 0x1e, 0x37, 0x6e, 0x8b, 0x71, + 0x49, 0x18, 0xdd, 0x60, 0xfc, 0x65, 0x24, 0xf4, 0x1b, 0xd7, 0x32, 0x53, 0x24, 0x05, 0xef, 0x83, + 0x59, 0x35, 0x59, 0xdb, 0x12, 0x35, 0xf1, 0x0e, 0x47, 0x5e, 0x53, 0x55, 0x1f, 0x49, 0xac, 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x8c, 0x37, 0xe3, 0x85, 0xdd, 0xed, 0x7f, 0x83, 0xd4, 0xa8, 0xd5, 0x47, 0xe3, 0x87, + 0xe2, 0xde, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xf1, 0x05, 0x2c, 0xa2, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -243,6 +377,7 @@ type MsgClient interface { // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. WithdrawValidatorCommission(ctx context.Context, in *MsgWithdrawValidatorCommission, opts ...grpc.CallOption) (*MsgWithdrawValidatorCommissionResponse, error) + UpdateIncentiveParams(ctx context.Context, in *MsgUpdateIncentiveParams, opts ...grpc.CallOption) (*MsgUpdateIncentiveParamsResponse, error) } type msgClient struct { @@ -271,6 +406,15 @@ func (c *msgClient) WithdrawValidatorCommission(ctx context.Context, in *MsgWith return out, nil } +func (c *msgClient) UpdateIncentiveParams(ctx context.Context, in *MsgUpdateIncentiveParams, opts ...grpc.CallOption) (*MsgUpdateIncentiveParamsResponse, error) { + out := new(MsgUpdateIncentiveParamsResponse) + err := c.cc.Invoke(ctx, "/elys.incentive.Msg/UpdateIncentiveParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // WithdrawDelegatorReward defines a method to withdraw rewards of delegator @@ -279,6 +423,7 @@ type MsgServer interface { // WithdrawValidatorCommission defines a method to withdraw the // full commission to the validator address. WithdrawValidatorCommission(context.Context, *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error) + UpdateIncentiveParams(context.Context, *MsgUpdateIncentiveParams) (*MsgUpdateIncentiveParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -291,6 +436,9 @@ func (*UnimplementedMsgServer) WithdrawRewards(ctx context.Context, req *MsgWith func (*UnimplementedMsgServer) WithdrawValidatorCommission(ctx context.Context, req *MsgWithdrawValidatorCommission) (*MsgWithdrawValidatorCommissionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawValidatorCommission not implemented") } +func (*UnimplementedMsgServer) UpdateIncentiveParams(ctx context.Context, req *MsgUpdateIncentiveParams) (*MsgUpdateIncentiveParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateIncentiveParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -332,6 +480,24 @@ func _Msg_WithdrawValidatorCommission_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Msg_UpdateIncentiveParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateIncentiveParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateIncentiveParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.incentive.Msg/UpdateIncentiveParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateIncentiveParams(ctx, req.(*MsgUpdateIncentiveParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.incentive.Msg", HandlerType: (*MsgServer)(nil), @@ -344,6 +510,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "WithdrawValidatorCommission", Handler: _Msg_WithdrawValidatorCommission_Handler, }, + { + MethodName: "UpdateIncentiveParams", + Handler: _Msg_UpdateIncentiveParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "elys/incentive/tx.proto", @@ -467,6 +637,124 @@ func (m *MsgWithdrawValidatorCommissionResponse) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } +func (m *MsgUpdateIncentiveParams) 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 *MsgUpdateIncentiveParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DistributionEpochForLps != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DistributionEpochForLps)) + i-- + dAtA[i] = 0x48 + } + if m.DistributionEpochForStakers != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DistributionEpochForStakers)) + i-- + dAtA[i] = 0x40 + } + { + size := m.MaxEdenRewardAprLps.Size() + i -= size + if _, err := m.MaxEdenRewardAprLps.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.MaxEdenRewardAprStakers.Size() + i -= size + if _, err := m.MaxEdenRewardAprStakers.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if m.ElysStakeTrackingRate != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ElysStakeTrackingRate)) + i-- + dAtA[i] = 0x28 + } + { + size := m.RewardPortionForLps.Size() + i -= size + if _, err := m.RewardPortionForLps.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.WithdrawAddrEnabled { + i-- + if m.WithdrawAddrEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size := m.CommunityTax.Size() + i -= size + if _, err := m.CommunityTax.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateIncentiveParamsResponse) 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 *MsgUpdateIncentiveParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateIncentiveParamsResponse) 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 @@ -529,6 +817,48 @@ func (m *MsgWithdrawValidatorCommissionResponse) Size() (n int) { return n } +func (m *MsgUpdateIncentiveParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.CommunityTax.Size() + n += 1 + l + sovTx(uint64(l)) + if m.WithdrawAddrEnabled { + n += 2 + } + l = m.RewardPortionForLps.Size() + n += 1 + l + sovTx(uint64(l)) + if m.ElysStakeTrackingRate != 0 { + n += 1 + sovTx(uint64(m.ElysStakeTrackingRate)) + } + l = m.MaxEdenRewardAprStakers.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MaxEdenRewardAprLps.Size() + n += 1 + l + sovTx(uint64(l)) + if m.DistributionEpochForStakers != 0 { + n += 1 + sovTx(uint64(m.DistributionEpochForStakers)) + } + if m.DistributionEpochForLps != 0 { + n += 1 + sovTx(uint64(m.DistributionEpochForLps)) + } + return n +} + +func (m *MsgUpdateIncentiveParamsResponse) 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 } @@ -850,6 +1180,351 @@ func (m *MsgWithdrawValidatorCommissionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateIncentiveParams) 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: MsgUpdateIncentiveParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIncentiveParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommunityTax", 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 + } + if err := m.CommunityTax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddrEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WithdrawAddrEnabled = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardPortionForLps", 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 + } + if err := m.RewardPortionForLps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeTrackingRate", wireType) + } + m.ElysStakeTrackingRate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ElysStakeTrackingRate |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprStakers", 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 + } + if err := m.MaxEdenRewardAprStakers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprLps", 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 + } + if err := m.MaxEdenRewardAprLps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForStakers", wireType) + } + m.DistributionEpochForStakers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DistributionEpochForStakers |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForLps", wireType) + } + m.DistributionEpochForLps = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DistributionEpochForLps |= int64(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 *MsgUpdateIncentiveParamsResponse) 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: MsgUpdateIncentiveParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateIncentiveParamsResponse: 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 diff --git a/x/tokenomics/client/cli/query_time_based_inflation_test.go b/x/tokenomics/client/cli/query_time_based_inflation_test.go index a060e9d37..42c539bf0 100644 --- a/x/tokenomics/client/cli/query_time_based_inflation_test.go +++ b/x/tokenomics/client/cli/query_time_based_inflation_test.go @@ -31,6 +31,13 @@ func networkWithTimeBasedInflationObjects(t *testing.T, n int) (*network.Network timeBasedInflation := types.TimeBasedInflation{ StartBlockHeight: uint64(i), EndBlockHeight: uint64(i), + Inflation: &types.InflationEntry{ + LmRewards: 9999999, + IcsStakingRewards: 9999999, + CommunityFund: 9999999, + StrategicReserve: 9999999, + TeamTokensVested: 9999999, + }, } nullify.Fill(&timeBasedInflation) state.TimeBasedInflationList = append(state.TimeBasedInflationList, timeBasedInflation)