diff --git a/app/app.go b/app/app.go index 98ac0a55a..c7e6ad278 100644 --- a/app/app.go +++ b/app/app.go @@ -775,7 +775,6 @@ func NewElysApp( appCodec, keys[incentivemoduletypes.StoreKey], keys[incentivemoduletypes.MemStoreKey], - app.GetSubspace(incentivemoduletypes.ModuleName), commitmentKeeper, app.StakingKeeper, app.AccountKeeper, @@ -1493,7 +1492,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(oracletypes.ModuleName) paramsKeeper.Subspace(commitmentmoduletypes.ModuleName) paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName) - paramsKeeper.Subspace(incentivemoduletypes.ModuleName) paramsKeeper.Subspace(burnermoduletypes.ModuleName) paramsKeeper.Subspace(ammmoduletypes.ModuleName) paramsKeeper.Subspace(marginmoduletypes.ModuleName) diff --git a/app/setup_handlers.go b/app/setup_handlers.go index 2775ef4a9..855c837bd 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -21,11 +21,9 @@ import ( burnertypes "github.com/elys-network/elys/x/burner/types" clocktypes "github.com/elys-network/elys/x/clock/types" commitmenttypes "github.com/elys-network/elys/x/commitment/types" - incentivetypes "github.com/elys-network/elys/x/incentive/types" leveragelptypes "github.com/elys-network/elys/x/leveragelp/types" margintypes "github.com/elys-network/elys/x/margin/types" oracletypes "github.com/elys-network/elys/x/oracle/types" - parametertypes "github.com/elys-network/elys/x/parameter/types" stablestaketypes "github.com/elys-network/elys/x/stablestake/types" tokenomicstypes "github.com/elys-network/elys/x/tokenomics/types" transferhooktypes "github.com/elys-network/elys/x/transferhook/types" @@ -68,8 +66,6 @@ func setUpgradeHandler(app *ElysApp) { keyTable = burnertypes.ParamKeyTable() //nolint:staticcheck case commitmenttypes.ModuleName: keyTable = commitmenttypes.ParamKeyTable() //nolint:staticcheck - case incentivetypes.ModuleName: - keyTable = incentivetypes.ParamKeyTable() //nolint:staticcheck case margintypes.ModuleName: keyTable = margintypes.ParamKeyTable() //nolint:staticcheck case leveragelptypes.ModuleName: @@ -84,8 +80,6 @@ func setUpgradeHandler(app *ElysApp) { keyTable = transferhooktypes.ParamKeyTable() //nolint:staticcheck case stablestaketypes.ModuleName: keyTable = stablestaketypes.ParamKeyTable() //nolint:staticcheck - case parametertypes.ModuleName: - keyTable = parametertypes.ParamKeyTable() //nolint:staticcheck } if !subspace.HasKeyTable() { diff --git a/architecture.md b/architecture.md index 5124f65fb..cbf914d11 100644 --- a/architecture.md +++ b/architecture.md @@ -544,12 +544,10 @@ Defines the rules for proposing and voting on changes to the network. To make a ## Distribution -Defines the distribution of rewards and fees in the network. Block proposers receive a portion of the block rewards as an incentive to maintain the network. The `community_tax` parameter specifies the percentage of the rewards that are allocated to a community pool for network development and improvement. +Defines the distribution of rewards and fees in the network. Block proposers receive a portion of the block rewards as an incentive to maintain the network. -- `Community_tax`: The percentage of inflation that is allocated to the community pool. Current value: 2%. - `Base_proposer_reward`: The base percentage of block rewards given to proposers. Current value: 1%. - `Bonus_proposer_reward`: The additional percentage of block rewards given to proposers if they include all valid transactions. Current value: 4%. -- `Withdraw_addr_enabled`: A boolean flag that indicates whether withdraw addresses are enabled. Current value: true. ## Slashing diff --git a/config.yml b/config.yml index e44e2e7d7..d52167bf3 100644 --- a/config.yml +++ b/config.yml @@ -287,13 +287,11 @@ genesis: amount: "200000" incentive: params: - lp_incentives: [] - stake_incentives: [] - community_tax: "0.00" - withdraw_addr_enabled: true + lp_incentives: null + stake_incentives: null reward_portion_for_lps: "0.65" pool_infos: [] - elys_stake_tracking_rate: "10" + elys_stake_snap_interval: "10" dex_rewards_stakers: num_blocks: "0" amount: "0" diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 442d1c454..0323bb9fc 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -39643,85 +39643,81 @@ paths: type: object properties: lp_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: >- - maximum eden allocation per day that won't exceed - 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: >- + maximum eden allocation per day that won't exceed 30% + apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, + this is set from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info stake_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: >- - maximum eden allocation per day that won't exceed - 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info - community_tax: - type: string - withdraw_addr_enabled: - type: boolean + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: >- + maximum eden allocation per day that won't exceed 30% + apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, + this is set from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info reward_portion_for_lps: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps + Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for - protocol. + protocol`. reward_portion_for_stakers: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps + Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for - protocol. + protocol`. pool_infos: type: array items: @@ -39739,7 +39735,7 @@ paths: title: multiplier for lp rewards num_blocks: type: string - title: Block number since creation + title: Block number since the creation of PoolInfo dex_reward_amount_given: type: string title: Total dex rewards given @@ -39748,51 +39744,70 @@ paths: title: Total eden rewards given eden_apr: type: string - title: Eden APR + title: Eden APR, updated at every distribution dex_apr: type: string - title: Dex APR + title: Dex APR, updated at every distribution title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier, dex rewards given - elys_stake_tracking_rate: + poolId, reward wallet, **multiplier**, dex rewards given + elys_stake_snap_interval: type: string format: int64 + title: >- + Number of blocks to update elys staked amount for + delegators dex_rewards_stakers: title: Tracking dex rewards given to stakers type: object properties: num_blocks: type: string + title: >- + Number of blocks since start of epoch (distribution + epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - + recalculated at every distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for + staking, from lp, if it's for lp, from staking) dex_rewards_lps: title: Tracking dex rewards given to LPs type: object properties: num_blocks: type: string + title: >- + Number of blocks since start of epoch (distribution + epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - + recalculated at every distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for + staking, from lp, if it's for lp, from staking) max_eden_reward_apr_stakers: type: string - title: Maximum eden reward apr for stakers + title: Maximum eden reward apr for stakers - [0 - 0.3] max_eden_reward_apr_lps: type: string - title: Maximum eden reward apr for lps - distribution_epoch_for_stakers_in_blocks: + title: Maximum eden reward apr for lps - [0 - 0.3] + distribution_interval: 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 + title: >- + Distribution interval in blocks - number of blocks on + distribution epoch description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -84092,11 +84107,20 @@ definitions: properties: num_blocks: type: string + title: Number of blocks since start of epoch (distribution epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - recalculated at every + distribution epoch amount_collected_by_other_tracker: type: string - title: DexRewardsTracker + title: >- + Accumulated rewards tracked by other (when it's for staking, from lp, + if it's for lp, from staking) + title: >- + DexRewardsTracker is used for tracking rewards for stakers & lps - all + amount here is in USDC elys.incentive.IncentiveInfo: type: object properties: @@ -84109,15 +84133,17 @@ definitions: total_blocks_per_year: type: string title: distribution duration - block number per year - allocation_epoch_in_blocks: + epoch_num_blocks: type: string - title: we set block numbers in 24 hrs + title: we set block count in 24 hrs max_eden_per_allocation: type: string title: maximum eden allocation per day that won't exceed 30% apr distribution_epoch_in_blocks: type: string - description: number of block intervals that distribute rewards. + title: >- + number of block intervals that distribute rewards, this is set from + params.distribution_interval current_epoch_in_blocks: type: string title: current epoch in block number @@ -84143,79 +84169,75 @@ definitions: type: object properties: lp_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: maximum eden allocation per day that won't exceed 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: maximum eden allocation per day that won't exceed 30% apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, this is set + from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info stake_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: maximum eden allocation per day that won't exceed 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info - community_tax: - type: string - withdraw_addr_enabled: - type: boolean + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: maximum eden allocation per day that won't exceed 30% apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, this is set + from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info reward_portion_for_lps: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps - - reward_portion_for_stakers = revenue percent for protocol. + Dex revenue percent for lps, `100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol`. reward_portion_for_stakers: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps - - reward_portion_for_stakers = revenue percent for protocol. + Dex revenue percent for lps, `100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol`. pool_infos: type: array items: @@ -84233,7 +84255,7 @@ definitions: title: multiplier for lp rewards num_blocks: type: string - title: Block number since creation + title: Block number since the creation of PoolInfo dex_reward_amount_given: type: string title: Total dex rewards given @@ -84242,51 +84264,64 @@ definitions: title: Total eden rewards given eden_apr: type: string - title: Eden APR + title: Eden APR, updated at every distribution dex_apr: type: string - title: Dex APR + title: Dex APR, updated at every distribution title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier, dex rewards given - elys_stake_tracking_rate: + poolId, reward wallet, **multiplier**, dex rewards given + elys_stake_snap_interval: type: string format: int64 + title: Number of blocks to update elys staked amount for delegators dex_rewards_stakers: title: Tracking dex rewards given to stakers type: object properties: num_blocks: type: string + title: Number of blocks since start of epoch (distribution epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - recalculated at every + distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for staking, from + lp, if it's for lp, from staking) dex_rewards_lps: title: Tracking dex rewards given to LPs type: object properties: num_blocks: type: string + title: Number of blocks since start of epoch (distribution epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - recalculated at every + distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for staking, from + lp, if it's for lp, from staking) max_eden_reward_apr_stakers: type: string - title: Maximum eden reward apr for stakers + title: Maximum eden reward apr for stakers - [0 - 0.3] 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: + title: Maximum eden reward apr for lps - [0 - 0.3] + distribution_interval: type: string format: int64 - title: Distribution epochs for LPs in blocks + title: >- + Distribution interval in blocks - number of blocks on distribution + epoch description: Params defines the parameters for the module. elys.incentive.PoolInfo: type: object @@ -84303,7 +84338,7 @@ definitions: title: multiplier for lp rewards num_blocks: type: string - title: Block number since creation + title: Block number since the creation of PoolInfo dex_reward_amount_given: type: string title: Total dex rewards given @@ -84312,10 +84347,10 @@ definitions: title: Total eden rewards given eden_apr: type: string - title: Eden APR + title: Eden APR, updated at every distribution dex_apr: type: string - title: Dex APR + title: Dex APR, updated at every distribution title: Pool Info elys.incentive.PoolMultiplier: type: object @@ -84356,79 +84391,75 @@ definitions: type: object properties: lp_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: maximum eden allocation per day that won't exceed 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: maximum eden allocation per day that won't exceed 30% apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, this is set + from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info stake_incentives: - type: array - items: - type: object - properties: - eden_amount_per_year: - type: string - title: reward amount in eden for 1 year - distribution_start_block: - type: string - title: starting block height of the distribution - total_blocks_per_year: - type: string - title: distribution duration - block number per year - allocation_epoch_in_blocks: - type: string - title: we set block numbers in 24 hrs - max_eden_per_allocation: - type: string - title: maximum eden allocation per day that won't exceed 30% apr - distribution_epoch_in_blocks: - type: string - description: number of block intervals that distribute rewards. - current_epoch_in_blocks: - type: string - title: current epoch in block number - eden_boost_apr: - type: string - title: eden boost apr (0-1) range - title: Incentive Info - community_tax: - type: string - withdraw_addr_enabled: - type: boolean + type: object + properties: + eden_amount_per_year: + type: string + title: reward amount in eden for 1 year + distribution_start_block: + type: string + title: starting block height of the distribution + total_blocks_per_year: + type: string + title: distribution duration - block number per year + epoch_num_blocks: + type: string + title: we set block count in 24 hrs + max_eden_per_allocation: + type: string + title: maximum eden allocation per day that won't exceed 30% apr + distribution_epoch_in_blocks: + type: string + title: >- + number of block intervals that distribute rewards, this is set + from params.distribution_interval + current_epoch_in_blocks: + type: string + title: current epoch in block number + eden_boost_apr: + type: string + title: eden boost apr (0-1) range + title: Incentive Info reward_portion_for_lps: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps - - reward_portion_for_stakers = revenue percent for protocol. + Dex revenue percent for lps, `100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol`. reward_portion_for_stakers: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps - - reward_portion_for_stakers = revenue percent for protocol. + Dex revenue percent for lps, `100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol`. pool_infos: type: array items: @@ -84446,7 +84477,7 @@ definitions: title: multiplier for lp rewards num_blocks: type: string - title: Block number since creation + title: Block number since the creation of PoolInfo dex_reward_amount_given: type: string title: Total dex rewards given @@ -84455,51 +84486,64 @@ definitions: title: Total eden rewards given eden_apr: type: string - title: Eden APR + title: Eden APR, updated at every distribution dex_apr: type: string - title: Dex APR + title: Dex APR, updated at every distribution title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier, dex rewards given - elys_stake_tracking_rate: + poolId, reward wallet, **multiplier**, dex rewards given + elys_stake_snap_interval: type: string format: int64 + title: Number of blocks to update elys staked amount for delegators dex_rewards_stakers: title: Tracking dex rewards given to stakers type: object properties: num_blocks: type: string + title: Number of blocks since start of epoch (distribution epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - recalculated at + every distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for staking, + from lp, if it's for lp, from staking) dex_rewards_lps: title: Tracking dex rewards given to LPs type: object properties: num_blocks: type: string + title: Number of blocks since start of epoch (distribution epoch) amount: type: string + title: >- + Accumulated amount at distribution epoch - recalculated at + every distribution epoch amount_collected_by_other_tracker: type: string + title: >- + Accumulated rewards tracked by other (when it's for staking, + from lp, if it's for lp, from staking) max_eden_reward_apr_stakers: type: string - title: Maximum eden reward apr for stakers + title: Maximum eden reward apr for stakers - [0 - 0.3] max_eden_reward_apr_lps: type: string - title: Maximum eden reward apr for lps - distribution_epoch_for_stakers_in_blocks: + title: Maximum eden reward apr for lps - [0 - 0.3] + distribution_interval: 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 + title: >- + Distribution interval in blocks - number of blocks on distribution + epoch description: QueryParamsResponse is response type for the Query/Params RPC method. elys.leveragelp.IsWhitelistedResponse: type: object diff --git a/proto/elys/incentive/dex_rewards_traker.proto b/proto/elys/incentive/dex_rewards_traker.proto index afeccca24..0b2fee4e3 100644 --- a/proto/elys/incentive/dex_rewards_traker.proto +++ b/proto/elys/incentive/dex_rewards_traker.proto @@ -6,19 +6,21 @@ option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; -// DexRewardsTracker +// DexRewardsTracker is used for tracking rewards for stakers and LPs, all amount here is in USDC message DexRewardsTracker { + // Number of blocks since start of epoch (distribution epoch) string num_blocks = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false - ]; + ]; + // Accumulated amount at distribution epoch - recalculated at every distribution epoch string amount = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false - ]; + ]; + // Accumulated rewards tracked by other (when it's for staking, from lp, if it's for lp, from staking) string amount_collected_by_other_tracker = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; } - \ No newline at end of file diff --git a/proto/elys/incentive/elys_staked.proto b/proto/elys/incentive/elys_staked.proto index 78ac28ca9..2ca15b45c 100644 --- a/proto/elys/incentive/elys_staked.proto +++ b/proto/elys/incentive/elys_staked.proto @@ -6,7 +6,8 @@ option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; -// Elys staked +// Elys staked amount is tracked because EdenBoost has to be burnt when unstake ELYS event happens, +// and there's no way to track staked amount change from staking hook and this struct is added. message ElysStaked { string address = 1; string amount = 2 [ @@ -14,4 +15,3 @@ message ElysStaked { (gogoproto.nullable) = false ]; } - \ No newline at end of file diff --git a/proto/elys/incentive/incentive.proto b/proto/elys/incentive/incentive.proto index cbe6dfe79..830d96616 100644 --- a/proto/elys/incentive/incentive.proto +++ b/proto/elys/incentive/incentive.proto @@ -16,13 +16,13 @@ message IncentiveInfo { // distribution duration - block number per year string total_blocks_per_year = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - // we set block numbers in 24 hrs - string allocation_epoch_in_blocks = 4 + // we set block count in 24 hrs + string epoch_num_blocks = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; // maximum eden allocation per day that won't exceed 30% apr string max_eden_per_allocation = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - // number of block intervals that distribute rewards. + // number of block intervals that distribute rewards, set from params.distribution_interval string distribution_epoch_in_blocks = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; // current epoch in block number diff --git a/proto/elys/incentive/params.proto b/proto/elys/incentive/params.proto index 08f1f5548..6ff5d7303 100644 --- a/proto/elys/incentive/params.proto +++ b/proto/elys/incentive/params.proto @@ -11,54 +11,46 @@ option go_package = "github.com/elys-network/elys/x/incentive/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - repeated IncentiveInfo lp_incentives = 1 [(gogoproto.nullable) = false]; - repeated IncentiveInfo stake_incentives = 2 [(gogoproto.nullable) = false]; - - string community_tax = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; + IncentiveInfo lp_incentives = 1; + IncentiveInfo stake_incentives = 2; - bool withdraw_addr_enabled = 4; - // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. - string reward_portion_for_lps = 5 [ + // Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol`. + string reward_portion_for_lps = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. - string reward_portion_for_stakers = 6 [ + // Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol`. + string reward_portion_for_stakers = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Pool information - // poolId, reward wallet, mulitplier, dex rewards given - repeated PoolInfo pool_infos = 7 [(gogoproto.nullable) = false]; + // poolId, reward wallet, **multiplier**, dex rewards given + repeated PoolInfo pool_infos = 5 [(gogoproto.nullable) = false]; - int64 elys_stake_tracking_rate = 8; + // Number of blocks to update elys staked amount for delegators + int64 elys_stake_snap_interval = 6; // Tracking dex rewards given to stakers - DexRewardsTracker dex_rewards_stakers = 9 [(gogoproto.nullable) = false]; + DexRewardsTracker dex_rewards_stakers = 7 [(gogoproto.nullable) = false]; // Tracking dex rewards given to LPs - DexRewardsTracker dex_rewards_lps = 10 [(gogoproto.nullable) = false]; + DexRewardsTracker dex_rewards_lps = 8 [(gogoproto.nullable) = false]; - // Maximum eden reward apr for stakers - string max_eden_reward_apr_stakers = 11 [ + // Maximum eden reward apr for stakers - [0 - 0.3] + string max_eden_reward_apr_stakers = 9 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // Maximum eden reward apr for lps - string max_eden_reward_apr_lps = 12 [ + // Maximum eden reward apr for lps - [0 - 0.3] + string max_eden_reward_apr_lps = 10 [ (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 = 13; - - // Distribution epochs for LPs in blocks - int64 distribution_epoch_for_lps_in_blocks = 14; + // Distribution interval in blocks - number of blocks on distribution epoch + int64 distribution_interval = 11; } diff --git a/proto/elys/incentive/pool.proto b/proto/elys/incentive/pool.proto index 2d42f542e..31a1dd8ca 100644 --- a/proto/elys/incentive/pool.proto +++ b/proto/elys/incentive/pool.proto @@ -17,8 +17,7 @@ message PoolInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - - // Block number since creation + // Block number since the creation of PoolInfo string num_blocks = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -33,12 +32,12 @@ message PoolInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // Eden APR + // Eden APR, updated at every distribution string eden_apr = 7 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // Dex APR + // Dex APR, updated at every distribution string dex_apr = 8 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false diff --git a/proto/elys/incentive/query.proto b/proto/elys/incentive/query.proto index 9ad5305bf..f1ed0b2fd 100644 --- a/proto/elys/incentive/query.proto +++ b/proto/elys/incentive/query.proto @@ -18,13 +18,11 @@ service Query { // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/elys-network/elys/incentive/params"; - } // Queries a list of CommunityPool items. rpc CommunityPool (QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) { option (google.api.http).get = "/elys-network/elys/incentive/community_pool"; - } // Calculate APR @@ -37,7 +35,6 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false]; } @@ -45,7 +42,6 @@ message QueryParamsResponse { message QueryCommunityPoolRequest {} message QueryCommunityPoolResponse { - // pool defines community pool's coins. repeated cosmos.base.v1beta1.DecCoin pool = 1 [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; } diff --git a/proto/elys/incentive/tx.proto b/proto/elys/incentive/tx.proto index d3835105b..419a50802 100644 --- a/proto/elys/incentive/tx.proto +++ b/proto/elys/incentive/tx.proto @@ -47,30 +47,24 @@ message MsgWithdrawValidatorCommissionResponse {} message MsgUpdateIncentiveParams { string authority = 1; - string communityTax = 2 [ + string rewardPortionForLps = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool withdrawAddrEnabled = 3; - string rewardPortionForLps = 4 [ + string rewardPortionForStakers = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string rewardPortionForStakers = 5 [ + int64 elysStakeSnapInterval = 4; + string maxEdenRewardAprStakers = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - int64 elysStakeTrackingRate = 6; - string maxEdenRewardAprStakers = 7 [ + string maxEdenRewardAprLps = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string maxEdenRewardAprLps = 8 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - int64 distributionEpochForStakers = 9; - int64 distributionEpochForLps = 10; + int64 distributionInterval = 7; } message MsgUpdateIncentiveParamsResponse {} diff --git a/scripts/examples/transferhook/mars.yml b/scripts/examples/transferhook/mars.yml index 00ce3cbbf..d58f9aa01 100644 --- a/scripts/examples/transferhook/mars.yml +++ b/scripts/examples/transferhook/mars.yml @@ -237,21 +237,19 @@ genesis: incentive: params: lp_incentives: - - amount: "10000000" - epoch_identifier: week - start_time: "2023-04-20T12:34:56.789Z" - num_epochs: "50" - current_epoch: "0" - eden_boost_apr: "100" + amount: "10000000" + epoch_identifier: week + start_time: "2023-04-20T12:34:56.789Z" + num_epochs: "50" + current_epoch: "0" + eden_boost_apr: "100" stake_incentives: - - amount: "10000000" - epoch_identifier: week - start_time: "2023-04-20T12:34:56.789Z" - num_epochs: "50" - current_epoch: "0" - eden_boost_apr: "100" - community_tax: "0.02" - withdraw_addr_enabled: true + amount: "10000000" + epoch_identifier: week + start_time: "2023-04-20T12:34:56.789Z" + num_epochs: "50" + current_epoch: "0" + eden_boost_apr: "100" reward_portion_for_lps: "0.65" pool_infos: [] fee_pool: diff --git a/testutil/keeper/incentive.go b/testutil/keeper/incentive.go index 0577ab835..32e042a96 100644 --- a/testutil/keeper/incentive.go +++ b/testutil/keeper/incentive.go @@ -12,7 +12,6 @@ import ( 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" "github.com/stretchr/testify/require" @@ -32,17 +31,10 @@ func IncentiveKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { cdc := codec.NewProtoCodec(registry) govAddress := sdk.AccAddress(address.Module("gov")) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "IncentiveParams", - ) k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - paramsSubspace, nil, nil, nil, diff --git a/x/incentive/client/cli/tx_update_incentive_params.go b/x/incentive/client/cli/tx_update_incentive_params.go index d190ec228..949d3ad71 100644 --- a/x/incentive/client/cli/tx_update_incentive_params.go +++ b/x/incentive/client/cli/tx_update_incentive_params.go @@ -17,19 +17,16 @@ import ( func CmdUpdateIncentiveParams() *cobra.Command { cmd := &cobra.Command{ - Use: "update-incentive-params [community-tax] [withdraw-addr-enabled] [reward-portion-for-lps] [reward-portion-for-stakers] [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 update-incentive-params [community-tax] [withdraw-addr-enabled] [reward-portion-for-lps] [reward-portion-for-stakers] [elys-stake-tracking-rate] [max-eden-reward-apr-stakers] [max-eden-reward-apr-lps] [distribution-epoch-for-stakers] [distribution-epoch-for-lps]", - Args: cobra.ExactArgs(9), + Use: "update-incentive-params [reward-portion-for-lps] [reward-portion-for-stakers] [elys-stake-tracking-rate] [max-eden-reward-apr-stakers] [max-eden-reward-apr-lps] [distribution-interval]", + Short: "Broadcast message update-incentive-params update-incentive-params [reward-portion-for-lps] [reward-portion-for-stakers] [elys-stake-tracking-rate] [max-eden-reward-apr-stakers] [max-eden-reward-apr-lps] [distribution-interval]", + Args: cobra.ExactArgs(6), RunE: func(cmd *cobra.Command, args []string) (err error) { - argCommunityTax := args[0] - argWithdrawAddrEnabled := args[1] - argRewardPortionForLps := args[2] - argRewardPortionForStakers := args[3] - argElysStakeTrackingRate := args[4] - argMaxEdenRewardAprStakers := args[5] - argMaxEdenRewardAprLps := args[6] - argDistributionEpochForStakers := args[7] - argDistributionEpochForLps := args[8] + argRewardPortionForLps := args[0] + argRewardPortionForStakers := args[1] + argElysStakeSnapInterval := args[2] + argMaxEdenRewardAprStakers := args[3] + argMaxEdenRewardAprLps := args[4] + argDistributionInterval := args[5] clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -56,24 +53,15 @@ func CmdUpdateIncentiveParams() *cobra.Command { 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) rewardPortionForStakers := sdk.MustNewDecFromStr(argRewardPortionForStakers) - elysStakeTrackingRate, err := strconv.ParseInt(argElysStakeTrackingRate, 10, 64) + elysStakeSnapInterval, err := strconv.ParseInt(argElysStakeSnapInterval, 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) + distributionInterval, err := strconv.ParseInt(argDistributionInterval, 10, 64) if err != nil { return err } @@ -81,15 +69,12 @@ func CmdUpdateIncentiveParams() *cobra.Command { govAddress := sdk.AccAddress(address.Module("gov")) msg := types.NewMsgUpdateIncentiveParams( govAddress.String(), - communityTax, - withdarwAddrEnabled, rewardPortionForLps, rewardPortionForStakers, - elysStakeTrackingRate, + elysStakeSnapInterval, maxEdenRewardAprStakers, maxEdenRewardLps, - distributionEpochForStaker, - distributionEpochForLps, + distributionInterval, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/incentive/client/cli/tx_update_incentive_params_test.go b/x/incentive/client/cli/tx_update_incentive_params_test.go index 7eeb1d1b7..4c4f8fc99 100644 --- a/x/incentive/client/cli/tx_update_incentive_params_test.go +++ b/x/incentive/client/cli/tx_update_incentive_params_test.go @@ -25,17 +25,14 @@ func TestGovUpdateIncentiveParams(t *testing.T) { // 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] + // [reward-portion-for-lps] [elys-stake-snap-interval] [max-eden-reward-apr-stakers] [max-eden-reward-par-lps] [distribution-interval] args := []string{ - "0.00", - "true", "0.60", "0.30", "10", "0.30", "0.30", "10", - "10", "--title=test", "--summary=test", "--metadata=test", diff --git a/x/incentive/keeper/abci.go b/x/incentive/keeper/abci.go index 22aa2bc8e..06b70ef4e 100644 --- a/x/incentive/keeper/abci.go +++ b/x/incentive/keeper/abci.go @@ -27,7 +27,7 @@ func (k Keeper) EndBlocker(ctx sdk.Context) { func (k Keeper) ProcessElysStakedTracking(ctx sdk.Context) { params := k.GetParams(ctx) // Update Elys staked amount every n blocks - if params.ElysStakeTrackingRate == 0 || ctx.BlockHeight()%params.ElysStakeTrackingRate != 0 { + if params.ElysStakeSnapInterval == 0 || ctx.BlockHeight()%params.ElysStakeSnapInterval != 0 { return } @@ -68,7 +68,7 @@ func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context) { stakerEpoch, stakeIncentive := k.IsStakerRewardsDistributionEpoch(ctx) if stakerEpoch { - err := k.UpdateStakersRewardsUnclaimed(ctx, stakeIncentive) + err := k.UpdateStakersRewardsUnclaimed(ctx, *stakeIncentive) if err != nil { ctx.Logger().Error("Failed to update staker rewards unclaimed", "error", err) } @@ -76,7 +76,7 @@ func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context) { lpsEpoch, lpIncentive := k.IsLPRewardsDistributionEpoch(ctx) if lpsEpoch { - err := k.UpdateLPRewardsUnclaimed(ctx, lpIncentive) + err := k.UpdateLPRewardsUnclaimed(ctx, *lpIncentive) if err != nil { ctx.Logger().Error("Failed to update lp rewards unclaimed", "error", err) } @@ -84,6 +84,7 @@ func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context) { } func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { + // Non-linear inflation per year happens and this includes yearly inflation data listTimeBasedInflations := k.tokenomicsKeeper.GetAllTimeBasedInflation(ctx) if len(listTimeBasedInflations) < 1 { return false @@ -92,11 +93,12 @@ func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { params := k.GetParams(ctx) // Ensure distribution epoch is not zero to avoid division by zero - if params.DistributionEpochForLpsInBlocks == 0 || params.DistributionEpochForStakersInBlocks == 0 { + if params.DistributionInterval == 0 { return false } for _, inflation := range listTimeBasedInflations { + // Finding only current inflation data - and skip rest if inflation.StartBlockHeight > uint64(ctx.BlockHeight()) || inflation.EndBlockHeight < uint64(ctx.BlockHeight()) { continue } @@ -105,14 +107,16 @@ func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { // ------------- LP Incentive parameter ------------- // ptypes.DaysPerYear is guaranteed to be positive as it is defined as a constant - allocationEpochInblocks := totalBlocksPerYear.Quo(sdk.NewInt(ptypes.DaysPerYear)) - totalDistributionEpochPerYear := totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionEpochForLpsInBlocks)) + EpochNumBlocks := totalBlocksPerYear.Quo(sdk.NewInt(ptypes.DaysPerYear)) + totalDistributionEpochPerYear := totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionInterval)) // If totalDistributionEpochPerYear is zero, we skip this inflation to avoid division by zero if totalBlocksPerYear == sdk.ZeroInt() { continue } currentEpochInBlocks := sdk.NewInt(ctx.BlockHeight() - int64(inflation.StartBlockHeight)).Mul(totalDistributionEpochPerYear).Quo(totalBlocksPerYear) - maxEdenPerAllocation := sdk.NewInt(int64(inflation.Inflation.LmRewards)).Mul(allocationEpochInblocks).Quo(totalBlocksPerYear) + + // PerAllocation means per day - since allocation's once per day + maxEdenPerAllocation := sdk.NewInt(int64(inflation.Inflation.LmRewards)).Mul(EpochNumBlocks).Quo(totalBlocksPerYear) incentiveInfo := types.IncentiveInfo{ // reward amount in eden for 1 year EdenAmountPerYear: sdk.NewInt(int64(inflation.Inflation.LmRewards)), @@ -121,38 +125,38 @@ func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { // distribution duration - block number per year TotalBlocksPerYear: totalBlocksPerYear, // we set block numbers in 24 hrs - AllocationEpochInBlocks: allocationEpochInblocks, + EpochNumBlocks: EpochNumBlocks, // 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), + DistributionEpochInBlocks: sdk.NewInt(params.DistributionInterval), // current epoch in block number CurrentEpochInBlocks: currentEpochInBlocks, // eden boost apr (0-1) range EdenBoostApr: sdk.NewDec(1), } - if len(params.LpIncentives) == 0 { - params.LpIncentives = append(params.LpIncentives, incentiveInfo) + if params.LpIncentives == nil { + params.LpIncentives = &incentiveInfo } else { // If any of block number related parameter changed, we re-calculate the current epoch - if params.LpIncentives[0].DistributionStartBlock != incentiveInfo.DistributionStartBlock || - params.LpIncentives[0].TotalBlocksPerYear != incentiveInfo.TotalBlocksPerYear || - params.LpIncentives[0].DistributionEpochInBlocks != incentiveInfo.DistributionEpochInBlocks { - params.LpIncentives[0].CurrentEpochInBlocks = currentEpochInBlocks + if params.LpIncentives.DistributionStartBlock != incentiveInfo.DistributionStartBlock || + params.LpIncentives.TotalBlocksPerYear != incentiveInfo.TotalBlocksPerYear || + params.LpIncentives.DistributionEpochInBlocks != incentiveInfo.DistributionEpochInBlocks { + params.LpIncentives.CurrentEpochInBlocks = currentEpochInBlocks } - params.LpIncentives[0].EdenAmountPerYear = incentiveInfo.EdenAmountPerYear - params.LpIncentives[0].DistributionStartBlock = incentiveInfo.DistributionStartBlock - params.LpIncentives[0].TotalBlocksPerYear = incentiveInfo.TotalBlocksPerYear - params.LpIncentives[0].AllocationEpochInBlocks = incentiveInfo.AllocationEpochInBlocks - params.LpIncentives[0].DistributionEpochInBlocks = incentiveInfo.DistributionEpochInBlocks - params.LpIncentives[0].EdenBoostApr = incentiveInfo.EdenBoostApr + params.LpIncentives.EdenAmountPerYear = incentiveInfo.EdenAmountPerYear + params.LpIncentives.DistributionStartBlock = incentiveInfo.DistributionStartBlock + params.LpIncentives.TotalBlocksPerYear = incentiveInfo.TotalBlocksPerYear + params.LpIncentives.EpochNumBlocks = incentiveInfo.EpochNumBlocks + params.LpIncentives.DistributionEpochInBlocks = incentiveInfo.DistributionEpochInBlocks + params.LpIncentives.EdenBoostApr = incentiveInfo.EdenBoostApr } // ------------- Stakers parameter ------------- - totalDistributionEpochPerYear = totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionEpochForStakersInBlocks)) + totalDistributionEpochPerYear = totalBlocksPerYear.Quo(sdk.NewInt(params.DistributionInterval)) currentEpochInBlocks = sdk.NewInt(ctx.BlockHeight() - int64(inflation.StartBlockHeight)).Mul(totalDistributionEpochPerYear).Quo(totalBlocksPerYear) - maxEdenPerAllocation = sdk.NewInt(int64(inflation.Inflation.IcsStakingRewards)).Mul(allocationEpochInblocks).Quo(totalBlocksPerYear) + maxEdenPerAllocation = sdk.NewInt(int64(inflation.Inflation.IcsStakingRewards)).Mul(EpochNumBlocks).Quo(totalBlocksPerYear) incentiveInfo = types.IncentiveInfo{ // reward amount in eden for 1 year EdenAmountPerYear: sdk.NewInt(int64(inflation.Inflation.IcsStakingRewards)), @@ -161,32 +165,32 @@ func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { // distribution duration - block number per year TotalBlocksPerYear: totalBlocksPerYear, // we set block numbers in 24 hrs - AllocationEpochInBlocks: allocationEpochInblocks, + EpochNumBlocks: EpochNumBlocks, // 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), + DistributionEpochInBlocks: sdk.NewInt(params.DistributionInterval), // current epoch in block number CurrentEpochInBlocks: currentEpochInBlocks, // eden boost apr (0-1) range EdenBoostApr: sdk.NewDec(1), } - if len(params.StakeIncentives) == 0 { - params.StakeIncentives = append(params.StakeIncentives, incentiveInfo) + if params.StakeIncentives == nil { + params.StakeIncentives = &incentiveInfo } else { // If any of block number related parameter changed, we re-calculate the current epoch - if params.StakeIncentives[0].DistributionStartBlock != incentiveInfo.DistributionStartBlock || - params.StakeIncentives[0].TotalBlocksPerYear != incentiveInfo.TotalBlocksPerYear || - params.StakeIncentives[0].DistributionEpochInBlocks != incentiveInfo.DistributionEpochInBlocks { - params.StakeIncentives[0].CurrentEpochInBlocks = currentEpochInBlocks + if params.StakeIncentives.DistributionStartBlock != incentiveInfo.DistributionStartBlock || + params.StakeIncentives.TotalBlocksPerYear != incentiveInfo.TotalBlocksPerYear || + params.StakeIncentives.DistributionEpochInBlocks != incentiveInfo.DistributionEpochInBlocks { + params.StakeIncentives.CurrentEpochInBlocks = currentEpochInBlocks } - params.StakeIncentives[0].EdenAmountPerYear = incentiveInfo.EdenAmountPerYear - params.StakeIncentives[0].DistributionStartBlock = incentiveInfo.DistributionStartBlock - params.StakeIncentives[0].TotalBlocksPerYear = incentiveInfo.TotalBlocksPerYear - params.StakeIncentives[0].AllocationEpochInBlocks = incentiveInfo.AllocationEpochInBlocks - params.StakeIncentives[0].DistributionEpochInBlocks = incentiveInfo.DistributionEpochInBlocks - params.StakeIncentives[0].EdenBoostApr = incentiveInfo.EdenBoostApr + params.StakeIncentives.EdenAmountPerYear = incentiveInfo.EdenAmountPerYear + params.StakeIncentives.DistributionStartBlock = incentiveInfo.DistributionStartBlock + params.StakeIncentives.TotalBlocksPerYear = incentiveInfo.TotalBlocksPerYear + params.StakeIncentives.EpochNumBlocks = incentiveInfo.EpochNumBlocks + params.StakeIncentives.DistributionEpochInBlocks = incentiveInfo.DistributionEpochInBlocks + params.StakeIncentives.EdenBoostApr = incentiveInfo.EdenBoostApr } break } @@ -195,88 +199,76 @@ func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool { return true } -func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.IncentiveInfo) { +func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, *types.IncentiveInfo) { // Fetch incentive params params := k.GetParams(ctx) if ctx.BlockHeight() < 1 { - return false, types.IncentiveInfo{} + return false, nil } // If we don't have enough params - if len(params.StakeIncentives) < 1 { - return false, types.IncentiveInfo{} + if params.StakeIncentives == nil { + return false, nil } // Incentive params initialize - stakeIncentive := params.StakeIncentives[0] + stakeIncentive := params.StakeIncentives if ctx.BlockHeight()%stakeIncentive.DistributionEpochInBlocks.Int64() != 0 { - return false, types.IncentiveInfo{} + return false, nil } curBlockHeight := sdk.NewInt(ctx.BlockHeight()) if stakeIncentive.DistributionStartBlock.GT(curBlockHeight) { - return false, types.IncentiveInfo{} + return false, nil } // Increase current epoch of Stake incentive param stakeIncentive.CurrentEpochInBlocks = stakeIncentive.CurrentEpochInBlocks.Add(stakeIncentive.DistributionEpochInBlocks) 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 = nil + k.SetParams(ctx, params) + return false, nil } - params.StakeIncentives[0].CurrentEpochInBlocks = stakeIncentive.CurrentEpochInBlocks + params.StakeIncentives.CurrentEpochInBlocks = stakeIncentive.CurrentEpochInBlocks k.SetParams(ctx, params) // return found, stake incentive params return true, stakeIncentive } -func (k Keeper) IsLPRewardsDistributionEpoch(ctx sdk.Context) (bool, types.IncentiveInfo) { +func (k Keeper) IsLPRewardsDistributionEpoch(ctx sdk.Context) (bool, *types.IncentiveInfo) { // Fetch incentive params params := k.GetParams(ctx) if ctx.BlockHeight() < 1 { - return false, types.IncentiveInfo{} + return false, nil } // If we don't have enough params - if len(params.LpIncentives) < 1 { - return false, types.IncentiveInfo{} + if params.LpIncentives == nil { + return false, nil } // Incentive params initialize - lpIncentive := params.LpIncentives[0] + lpIncentive := params.LpIncentives if ctx.BlockHeight()%lpIncentive.DistributionEpochInBlocks.Int64() != 0 { - return false, types.IncentiveInfo{} + return false, nil } curBlockHeight := sdk.NewInt(ctx.BlockHeight()) if lpIncentive.DistributionStartBlock.GT(curBlockHeight) { - return false, types.IncentiveInfo{} + return false, nil } // Increase current epoch of Stake incentive param lpIncentive.CurrentEpochInBlocks = lpIncentive.CurrentEpochInBlocks.Add(lpIncentive.DistributionEpochInBlocks) 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 = nil + k.SetParams(ctx, params) + return false, nil } - params.LpIncentives[0].CurrentEpochInBlocks = lpIncentive.CurrentEpochInBlocks + params.LpIncentives.CurrentEpochInBlocks = lpIncentive.CurrentEpochInBlocks k.SetParams(ctx, params) // return found, lp incentive params diff --git a/x/incentive/keeper/abci_test.go b/x/incentive/keeper/abci_test.go index fd8bb4aa0..729e1c388 100644 --- a/x/incentive/keeper/abci_test.go +++ b/x/incentive/keeper/abci_test.go @@ -91,11 +91,11 @@ func TestABCI_EndBlocker(t *testing.T) { // 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.NotNil(t, params.StakeIncentives) + require.NotNil(t, params.LpIncentives) - 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))) + require.Equal(t, params.StakeIncentives.EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.IcsStakingRewards))) + require.Equal(t, params.LpIncentives.EdenAmountPerYear, sdk.NewInt(int64(listTimeBasdInflations[0].Inflation.LmRewards))) // After the first year ctx = ctx.WithBlockHeight(6307210) @@ -104,13 +104,13 @@ func TestABCI_EndBlocker(t *testing.T) { stakerEpoch, stakeIncentive := ik.IsStakerRewardsDistributionEpoch(ctx) params = ik.GetParams(ctx) require.Equal(t, stakerEpoch, false) - require.Equal(t, len(params.StakeIncentives), 0) + require.Nil(t, params.StakeIncentives) // 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) + require.Nil(t, params.LpIncentives) // After reading tokenomics again paramSet = ik.ProcessUpdateIncentiveParams(ctx) diff --git a/x/incentive/keeper/apr.go b/x/incentive/keeper/apr.go index c4e586c29..2de9f55d4 100644 --- a/x/incentive/keeper/apr.go +++ b/x/incentive/keeper/apr.go @@ -18,7 +18,7 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk defer k.SetParams(ctx, params) // If we don't have enough params - if len(params.StakeIncentives) < 1 || len(params.LpIncentives) < 1 { + if params.StakeIncentives == nil || params.LpIncentives == nil { return sdk.ZeroInt(), errorsmod.Wrap(types.ErrNoInflationaryParams, "no inflationary params available") } @@ -28,8 +28,8 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk } baseCurrency := entry.Denom - lpIncentive := params.LpIncentives[0] - stkIncentive := params.StakeIncentives[0] + lpIncentive := params.LpIncentives + stkIncentive := params.StakeIncentives if lpIncentive.TotalBlocksPerYear.IsZero() || stkIncentive.TotalBlocksPerYear.IsZero() { return sdk.ZeroInt(), errorsmod.Wrap(types.ErrNoInflationaryParams, "invalid inflationary params") @@ -48,16 +48,16 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk // Calculate stable stake pool share. poolShare := k.CalculatePoolShareForStableStakeLPs(ctx, totalProxyTVL, baseCurrency) - // Eden amount for LP in 24hrs = AllocationEpochInBlocks is the number of block for 24 hrs - edenAmountPerDay := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.AllocationEpochInBlocks).Quo(lpIncentive.TotalBlocksPerYear) + // Eden amount for LP in 24hrs = EpochNumBlocks is the number of block for 24 hrs + epochEdenAmount := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.EpochNumBlocks).Quo(lpIncentive.TotalBlocksPerYear) - maxEdenAmountPerLps := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) + epochLpsMaxEdenAmount := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.EpochNumBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerDay = sdk.MinInt(edenAmountPerDay, maxEdenAmountPerLps.TruncateInt()) + epochEdenAmount = sdk.MinInt(epochEdenAmount, epochLpsMaxEdenAmount.TruncateInt()) // Eden amount for stable stake LP in 24hrs - edenAmountPerStableStakePerDay := sdk.NewDecFromInt(edenAmountPerDay).Mul(poolShare) + epochStableStakeEdenAmount := sdk.NewDecFromInt(epochEdenAmount).Mul(poolShare) // Calc Eden price in usdc // We put Elys as denom as Eden won't be avaialble in amm pool and has the same value as Elys @@ -66,7 +66,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. + apr := epochStableStakeEdenAmount. MulInt(sdk.NewInt(ptypes.DaysPerYear)). MulInt(edenPrice). MulInt(sdk.NewInt(100)). @@ -86,22 +86,22 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk } // Calculate - edenAmountPerEpochStakersPerDay := stkIncentive.EdenAmountPerYear. - Mul(stkIncentive.AllocationEpochInBlocks). + epochStakersEdenAmount := stkIncentive.EdenAmountPerYear. + Mul(stkIncentive.EpochNumBlocks). 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. + epochStakersMaxEdenAmount := params.MaxEdenRewardAprStakers. MulInt(totalStakedSnapshot). - MulInt(stkIncentive.AllocationEpochInBlocks). + MulInt(stkIncentive.EpochNumBlocks). QuoInt(stkIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakers.TruncateInt()) + epochStakersEdenAmount = sdk.MinInt(epochStakersEdenAmount, epochStakersMaxEdenAmount.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 := edenAmountPerEpochStakersPerDay. + apr := epochStakersEdenAmount. Mul(sdk.NewInt(ptypes.DaysPerYear)). Mul(sdk.NewInt(100)). Quo(totalStakedSnapshot) @@ -116,8 +116,8 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk } else { // Elys staking, Eden committed, EdenB committed. params := k.GetParams(ctx) - amt := params.DexRewardsStakers.Amount - if amt.IsZero() { + amount := params.DexRewardsStakers.Amount + if amount.IsZero() { return sdk.ZeroInt(), nil } @@ -126,10 +126,6 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk return sdk.ZeroInt(), nil } - // DexReward amount per day = amount distributed / duration(in seconds) * total seconds per day. - // AllocationEpochInBlocks is the number of the block per day - amtDexRewardPerDay := amt.MulInt(stkIncentive.AllocationEpochInBlocks).QuoInt(params.DexRewardsStakers.NumBlocks) - // Calc Eden price in usdc // We put Elys as denom as Eden won't be avaialble in amm pool and has the same value as Elys edenPrice := k.EstimatePrice(ctx, sdk.NewCoin(ptypes.Elys, sdk.NewInt(1000000)), baseCurrency) @@ -146,9 +142,13 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk return sdk.ZeroInt(), nil } + // DexReward amount per day = amount distributed / duration(in seconds) * total seconds per day. + // EpochNumBlocks is the number of the block per day + dailyDexRewardAmount := amount.MulInt(stkIncentive.EpochNumBlocks).QuoInt(params.DexRewardsStakers.NumBlocks) + // 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. + apr := dailyDexRewardAmount. MulInt(sdk.NewInt(ptypes.DaysPerYear)). MulInt(sdk.NewInt(100)). MulInt(sdk.NewInt(1000000)). diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index fc23241f6..fe8847036 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -7,7 +7,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" errorsmod "cosmossdk.io/errors" ammtypes "github.com/elys-network/elys/x/amm/types" @@ -23,7 +22,6 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramstore paramtypes.Subspace cmk types.CommitmentKeeper stk types.StakingKeeper tci *types.TotalCommitmentInfo @@ -46,7 +44,6 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, ck types.CommitmentKeeper, sk types.StakingKeeper, ak types.AccountKeeper, @@ -61,16 +58,10 @@ func NewKeeper( dexRevCollectorName string, authority string, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, cmk: ck, stk: sk, tci: &types.TotalCommitmentInfo{}, @@ -119,36 +110,34 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // But won't sum dex revenue for LPs and gas fees for LPs as the LP revenue will be rewared by pool. dexRevenueForStakersPerDistribution = dexRevenueForStakersPerDistribution.Add(gasFeesForStakers...) - // Fund community pool based on the communtiy tax - dexRevenueRemainedForStakersPerDistribution := k.UpdateCommunityPool(ctx, dexRevenueForStakersPerDistribution) - // USDC amount in sdk.Dec type dexRevenueLPsAmtPerDistribution := dexRevenueForLpsPerDistribution.AmountOf(baseCurrency) - dexRevenueStakersAmtPerDistribution := dexRevenueRemainedForStakersPerDistribution.AmountOf(baseCurrency) + dexRevenueStakersAmtPerDistribution := dexRevenueForStakersPerDistribution.AmountOf(baseCurrency) gasFeesLPsAmtPerDistribution := gasFeesForLps.AmountOf(baseCurrency) edenBoostAPR := stakeIncentive.EdenBoostApr // Calculate eden amount per epoch params := k.GetParams(ctx) - // Ensure stakeIncentive.TotalBlocksPerYear or stakeIncentive.AllocationEpochInBlocks are not zero to avoid division by zero - if stakeIncentive.TotalBlocksPerYear.IsZero() || stakeIncentive.AllocationEpochInBlocks.IsZero() { + // Ensure stakeIncentive.TotalBlocksPerYear or stakeIncentive.EpochNumBlocks are not zero to avoid division by zero + if stakeIncentive.TotalBlocksPerYear.IsZero() || stakeIncentive.EpochNumBlocks.IsZero() { return errorsmod.Wrap(types.ErrNoInflationaryParams, "invalid inflationary params") } // Calculate - edenAmountPerEpochStakersPerDay := stakeIncentive.EdenAmountPerYear.Mul(stakeIncentive.AllocationEpochInBlocks).Quo(stakeIncentive.TotalBlocksPerYear) + epochStakersEdenAmount := stakeIncentive.EdenAmountPerYear.Mul(stakeIncentive.EpochNumBlocks).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) - maxEdenAmountPerStakersPerDay := params.MaxEdenRewardAprStakers.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.AllocationEpochInBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) + epochStakersMaxEdenAmount := params.MaxEdenRewardAprStakers.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.EpochNumBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakersPerDay.TruncateInt()) + epochStakersEdenAmount = sdk.MinInt(epochStakersEdenAmount, epochStakersMaxEdenAmount.TruncateInt()) // Calculate eden amount per distribution epoch - edenAmountPerEpochStakersPerDistribution := edenAmountPerEpochStakersPerDay.Mul(stakeIncentive.DistributionEpochInBlocks).Quo(stakeIncentive.AllocationEpochInBlocks) + edenAmountPerEpochStakersPerDistribution := epochStakersEdenAmount.Mul(stakeIncentive.DistributionEpochInBlocks).Quo(stakeIncentive.EpochNumBlocks) + // TODO: check this code block // Track the DEX rewards distribution for stakers // Add dexRevenue amount that was tracked by Lp tracker dexRevenueStakersAmtPerDistribution = dexRevenueStakersAmtPerDistribution.Add(params.DexRewardsStakers.AmountCollectedByOtherTracker) @@ -337,12 +326,9 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // But won't sum dex revenue for LPs and gas fees for LPs as the LP revenue will be rewared by pool. dexRevenueForStakersPerDistribution = dexRevenueForStakersPerDistribution.Add(gasFeesForStakersPerDistribution...) - // Fund community pool based on the communtiy tax - dexRevenueRemainedForStakersPerDistribution := k.UpdateCommunityPool(ctx, dexRevenueForStakersPerDistribution) - // USDC amount in sdk.Dec type dexRevenueLPsAmtPerDistribution := dexRevenueForLpsPerDistribution.AmountOf(baseCurrency) - dexRevenueStakersAmtPerDistribution := dexRevenueRemainedForStakersPerDistribution.AmountOf(baseCurrency) + dexRevenueStakersAmtPerDistribution := dexRevenueForStakersPerDistribution.AmountOf(baseCurrency) gasFeesLPsAmtPerDistribution := gasFeesForLpsPerDistribution.AmountOf(baseCurrency) // Proxy TVL @@ -352,26 +338,26 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // Proxy TVL = 20*0.3+30*0.5+40*1.0 totalProxyTVL := k.CalculateProxyTVL(ctx, baseCurrency) - // Ensure lpIncentive.TotalBlocksPerYear or lpIncentive.AllocationEpochInBlocks are not zero to avoid division by zero - if lpIncentive.TotalBlocksPerYear.IsZero() || lpIncentive.AllocationEpochInBlocks.IsZero() { + // Ensure lpIncentive.TotalBlocksPerYear or lpIncentive.EpochNumBlocks are not zero to avoid division by zero + if lpIncentive.TotalBlocksPerYear.IsZero() || lpIncentive.EpochNumBlocks.IsZero() { return errorsmod.Wrap(types.ErrNoInflationaryParams, "invalid inflationary params") } // Calculate eden amount per epoch - edenAmountPerEpochLPsPerDay := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.AllocationEpochInBlocks).Quo(lpIncentive.TotalBlocksPerYear) + epochLpsEdenAmount := lpIncentive.EdenAmountPerYear.Mul(lpIncentive.EpochNumBlocks).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) - maxEdenAmountPerLpsPerDay := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) + epochLpsMaxEdenAmount := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.EpochNumBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochLPsPerDay = sdk.MinInt(edenAmountPerEpochLPsPerDay, maxEdenAmountPerLpsPerDay.TruncateInt()) + epochLpsEdenAmount = sdk.MinInt(epochLpsEdenAmount, epochLpsMaxEdenAmount.TruncateInt()) // Calculate Eden amount per distribution epoch - edenAmountPerEpochLPsPerDistribution := edenAmountPerEpochLPsPerDay.Mul(lpIncentive.DistributionEpochInBlocks).Quo(lpIncentive.AllocationEpochInBlocks) + edenAmountPerEpochLPsPerDistribution := epochLpsEdenAmount.Mul(lpIncentive.DistributionEpochInBlocks).Quo(lpIncentive.EpochNumBlocks) // Add dexRevenue amount that was tracked by Lp tracker dexRevenueLPsAmtPerDistribution = dexRevenueLPsAmtPerDistribution.Add(params.DexRewardsLps.AmountCollectedByOtherTracker) @@ -597,12 +583,20 @@ func (k Keeper) UpdateAmmPoolAPR(ctx sdk.Context, lpIncentive types.IncentiveInf } // Dex reward Apr per pool = total accumulated usdc rewards for 7 day * 52/ tvl of pool - totalLMDexRewardsAllocatedPerWeek := poolInfo.DexRewardAmountGiven.MulInt(lpIncentive.AllocationEpochInBlocks).MulInt(sdk.NewInt(ptypes.DaysPerWeek)).QuoInt(poolInfo.NumBlocks) - poolInfo.DexApr = totalLMDexRewardsAllocatedPerWeek.MulInt(sdk.NewInt(ptypes.WeeksPerYear)).Quo(tvl) + weeklyDexRewardsTotal := poolInfo.DexRewardAmountGiven. + MulInt(lpIncentive.EpochNumBlocks). + MulInt(sdk.NewInt(ptypes.DaysPerWeek)). + QuoInt(poolInfo.NumBlocks) + poolInfo.DexApr = weeklyDexRewardsTotal. + MulInt(sdk.NewInt(ptypes.WeeksPerYear)). + Quo(tvl) // Eden reward Apr per pool = (total LM Eden reward allocated per day*((tvl of pool * multiplier)/total proxy TVL) ) * 365 / TVL of pool - totalLMEdenRewardsAllocatedPerDay := poolInfo.EdenRewardAmountGiven.Mul(lpIncentive.AllocationEpochInBlocks).Quo(poolInfo.NumBlocks) - poolInfo.EdenApr = sdk.NewDecFromInt(totalLMEdenRewardsAllocatedPerDay).Mul(poolShare).MulInt(sdk.NewInt(ptypes.DaysPerYear)).Quo(tvl) + dailyEdenRewardsTotal := poolInfo.EdenRewardAmountGiven.Mul(lpIncentive.EpochNumBlocks).Quo(poolInfo.NumBlocks) + poolInfo.EdenApr = sdk.NewDecFromInt(dailyEdenRewardsTotal). + Mul(poolShare). + MulInt(sdk.NewInt(ptypes.DaysPerYear)). + Quo(tvl) // Update Pool Info k.SetPoolInfo(ctx, poolId, poolInfo) diff --git a/x/incentive/keeper/keeper_apr_per_pool_test.go b/x/incentive/keeper/keeper_apr_per_pool_test.go index 7be11891e..3a1911c8f 100644 --- a/x/incentive/keeper/keeper_apr_per_pool_test.go +++ b/x/incentive/keeper/keeper_apr_per_pool_test.go @@ -79,7 +79,7 @@ func TestAPRCalculationPerPool(t *testing.T) { // distribution duration - block number per year TotalBlocksPerYear: sdk.NewInt(10000), // we set block numbers in 24 hrs - AllocationEpochInBlocks: sdk.NewInt(100), + EpochNumBlocks: sdk.NewInt(100), // maximum eden allocation per day that won't exceed 30% apr MaxEdenPerAllocation: sdk.NewInt(100), // number of block intervals that distribute rewards. @@ -109,7 +109,7 @@ func TestAPRCalculationPerPool(t *testing.T) { require.NoError(t, err) // 1 week later. - ctx = ctx.WithBlockHeight(lpIncentive.AllocationEpochInBlocks.Mul(sdk.NewInt(ptypes.DaysPerWeek)).Int64()) + ctx = ctx.WithBlockHeight(lpIncentive.EpochNumBlocks.Mul(sdk.NewInt(ptypes.DaysPerWeek)).Int64()) poolInfo.NumBlocks = sdk.NewInt(ctx.BlockHeight()) ik.SetPoolInfo(ctx, poolId, poolInfo) diff --git a/x/incentive/keeper/keeper_community.go b/x/incentive/keeper/keeper_community.go deleted file mode 100644 index 6ad2a537c..000000000 --- a/x/incentive/keeper/keeper_community.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import sdk "github.com/cosmos/cosmos-sdk/types" - -// Fund community pool based on community tax -func (k Keeper) UpdateCommunityPool(ctx sdk.Context, amt sdk.DecCoins) sdk.DecCoins { - // calculate fraction allocated to validators - communityTax := k.GetCommunityTax(ctx) - communityRevenus := amt.MulDecTruncate(communityTax) - - // allocate community funding - feePool := k.GetFeePool(ctx) - feePool.CommunityPool = feePool.CommunityPool.Add(communityRevenus...) - k.SetFeePool(ctx, feePool) - - return amt.Sub(communityRevenus) -} diff --git a/x/incentive/keeper/keeper_stakers.go b/x/incentive/keeper/keeper_stakers.go index db884370a..f84fe1354 100644 --- a/x/incentive/keeper/keeper_stakers.go +++ b/x/incentive/keeper/keeper_stakers.go @@ -16,14 +16,6 @@ func (k Keeper) CalculateRewardsForStakersByElysStaked(ctx sdk.Context, delegate // Calculate newly creating eden amount by its share newEdenAllocated := stakeShare.MulInt(edenAmountPerDistribution) - // -----------------Fund community Eden token---------------------- - // ---------------------------------------------------------------- - edenCoin := sdk.NewDecCoinFromDec(ptypes.Eden, newEdenAllocated) - newEdenCoinRemained := k.UpdateCommunityPool(ctx, sdk.DecCoins{edenCoin}) - - // Get remained Eden amount - newEdenAllocated = newEdenCoinRemained.AmountOf(ptypes.Eden) - // --------------------DEX rewards calculation -------------------- // ---------------------------------------------------------------- // Calculate dex rewards @@ -45,14 +37,6 @@ func (k Keeper) CalculateRewardsForStakersByCommitted(ctx sdk.Context, amt sdk.I // Calculate newly creating eden amount by its share newEdenAllocated := stakeShare.MulInt(edenAmountPerEpoch) - // -----------------Fund community Eden token---------------------- - // ---------------------------------------------------------------- - edenCoin := sdk.NewDecCoinFromDec(ptypes.Eden, newEdenAllocated) - newEdenCoinRemained := k.UpdateCommunityPool(ctx, sdk.DecCoins{edenCoin}) - - // Get remained Eden amount - newEdenAllocated = newEdenCoinRemained.AmountOf(ptypes.Eden) - // --------------------DEX rewards calculation -------------------- // ---------------------------------------------------------------- // Calculate dex rewards diff --git a/x/incentive/keeper/keeper_stakers_test.go b/x/incentive/keeper/keeper_stakers_test.go index e1188f7d9..8141aed99 100644 --- a/x/incentive/keeper/keeper_stakers_test.go +++ b/x/incentive/keeper/keeper_stakers_test.go @@ -98,6 +98,6 @@ func TestCalculateRewardsForStakers(t *testing.T) { totalEdenGiven = totalEdenGiven.Add(newUnclaimedEdenTokens) totalRewardsGiven = totalRewardsGiven.Add(dexRewards) - require.Equal(t, totalEdenGiven, sdk.NewInt(291)) + require.Equal(t, totalEdenGiven, sdk.NewInt(297)) require.Equal(t, totalRewardsGiven, sdk.NewInt(297)) } diff --git a/x/incentive/keeper/msg_server_update_incentive_params.go b/x/incentive/keeper/msg_server_update_incentive_params.go index 87ece3071..1f661441f 100644 --- a/x/incentive/keeper/msg_server_update_incentive_params.go +++ b/x/incentive/keeper/msg_server_update_incentive_params.go @@ -17,14 +17,11 @@ func (k msgServer) UpdateIncentiveParams(goCtx context.Context, msg *types.MsgUp } params := k.GetParams(ctx) - params.CommunityTax = msg.CommunityTax - params.WithdrawAddrEnabled = msg.WithdrawAddrEnabled params.RewardPortionForLps = msg.RewardPortionForLps - params.ElysStakeTrackingRate = msg.ElysStakeTrackingRate + params.ElysStakeSnapInterval = msg.ElysStakeSnapInterval params.MaxEdenRewardAprLps = msg.MaxEdenRewardAprLps params.MaxEdenRewardAprStakers = msg.MaxEdenRewardAprStakers - params.DistributionEpochForLpsInBlocks = msg.DistributionEpochForLps - params.DistributionEpochForStakersInBlocks = msg.DistributionEpochForStakers + params.DistributionInterval = msg.DistributionInterval k.SetParams(ctx, params) diff --git a/x/incentive/keeper/params.go b/x/incentive/keeper/params.go index 0a17a95fd..d67f01776 100644 --- a/x/incentive/keeper/params.go +++ b/x/incentive/keeper/params.go @@ -10,40 +10,33 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - var params types.Params - k.paramstore.GetParamSet(ctx, ¶ms) - return params -} +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} + b := store.Get([]byte(types.ParamsKey)) + if b == nil { + return + } -// GetCommunityTax returns the current distribution community tax. -func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) { - k.paramstore.Get(ctx, types.ParamStoreKeyCommunityTax, &percent) - return percent + k.cdc.MustUnmarshal(b, ¶ms) + return } -// GetWithdrawAddrEnabled returns the current distribution withdraw address -// enabled parameter. -func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool) { - k.paramstore.Get(ctx, types.ParamStoreKeyWithdrawAddrEnabled, &enabled) - return enabled +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(¶ms) + store.Set([]byte(types.ParamsKey), b) } // GetDEXRewardPortionForLPs returns the dex revenue percent for Lps func (k Keeper) GetDEXRewardPortionForLPs(ctx sdk.Context) (percent sdk.Dec) { - k.paramstore.Get(ctx, types.ParamStoreKeyRewardPortionForLps, &percent) - return percent + return k.GetParams(ctx).RewardPortionForLps } // GetDEXRewardPortionForStakers returns the dex revenue percent for Stakers func (k Keeper) GetDEXRewardPortionForStakers(ctx sdk.Context) (percent sdk.Dec) { - k.paramstore.Get(ctx, types.ParamStoreKeyRewardPortionForStakers, &percent) - return percent + return k.GetParams(ctx).RewardPortionForStakers } // GetPoolInfo diff --git a/x/incentive/migrations/v9_migration.go b/x/incentive/migrations/v9_migration.go new file mode 100644 index 000000000..5ad49d4de --- /dev/null +++ b/x/incentive/migrations/v9_migration.go @@ -0,0 +1,42 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/incentive/types" +) + +func (m Migrator) V9Migration(ctx sdk.Context) error { + m.keeper.SetParams(ctx, types.Params{ + LpIncentives: nil, + StakeIncentives: nil, + RewardPortionForLps: sdk.NewDecWithPrec(60, 2), + RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), + PoolInfos: []types.PoolInfo{ + { + DexApr: sdk.ZeroDec(), + EdenApr: sdk.ZeroDec(), + EdenRewardAmountGiven: sdk.ZeroInt(), + DexRewardAmountGiven: sdk.ZeroDec(), + Multiplier: sdk.NewDec(1), + NumBlocks: sdk.NewInt(1), + PoolId: 32767, + RewardWallet: "elys12dxadvd5def5gfy6jwmmt3gqs2pt5k9xupx8ja", + }, + }, + ElysStakeSnapInterval: 10, + DexRewardsStakers: types.DexRewardsTracker{ + NumBlocks: sdk.NewInt(1011431), + Amount: sdk.NewDec(708624172), + AmountCollectedByOtherTracker: sdk.ZeroDec(), + }, + DexRewardsLps: types.DexRewardsTracker{ + NumBlocks: sdk.NewInt(1011431), + Amount: sdk.NewDec(1446171780), + AmountCollectedByOtherTracker: sdk.ZeroDec(), + }, + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), // 30% + MaxEdenRewardAprLps: sdk.NewDecWithPrec(5, 1), // 50% + DistributionInterval: 10, + }) + return nil +} diff --git a/x/incentive/module.go b/x/incentive/module.go index ab7125a2f..bac636cd4 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, 7, m.V8Migration) + err := cfg.RegisterMigration(types.ModuleName, 8, m.V9Migration) 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 8 } +func (AppModule) ConsensusVersion() uint64 { return 9 } // 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/spec/02_state.md b/x/incentive/spec/02_state.md index be0521719..a8c00baa2 100644 --- a/x/incentive/spec/02_state.md +++ b/x/incentive/spec/02_state.md @@ -10,14 +10,9 @@ order: 2 message Params { option (gogoproto.goproto_stringer) = false; - repeated IncentiveInfo lp_incentives = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"lp_incentives\""]; - repeated IncentiveInfo stake_incentives = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"stake_incentives\""]; - string community_tax = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - bool withdraw_addr_enabled = 4; - string reward_portion_for_lps = 5 [ + IncentiveInfo lp_incentives = 1; + IncentiveInfo stake_incentives = 2; + string reward_portion_for_lps = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; diff --git a/x/incentive/spec/README.md b/x/incentive/spec/README.md index 68210fb4e..4f815a373 100644 --- a/x/incentive/spec/README.md +++ b/x/incentive/spec/README.md @@ -4,6 +4,11 @@ The Incentive module is designed to reward the ecosystem participants including liquidity providers (LPs), Elys stakers, and Eden committers. +Reward is distributed per epoch, `distribution` epoch, which is counted in number of blocks (`distribution_interval`). + +There's Eden allocation epoch per day, based on tokenomics. +The source of rewards are from `Eden + Dex revenue (USDC) + Gas fees (XX,YY -> USDC)` + ## Contents 1. **[Concepts](01_concepts.md)** diff --git a/x/incentive/types/dex_rewards_traker.pb.go b/x/incentive/types/dex_rewards_traker.pb.go index 4abb38b05..33f3c2361 100644 --- a/x/incentive/types/dex_rewards_traker.pb.go +++ b/x/incentive/types/dex_rewards_traker.pb.go @@ -24,10 +24,13 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// DexRewardsTracker +// DexRewardsTracker is used for tracking rewards for stakers & lps - all amount here is in USDC type DexRewardsTracker struct { - NumBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=num_blocks,json=numBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"num_blocks"` - Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` + // Number of blocks since start of epoch (distribution epoch) + NumBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=num_blocks,json=numBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"num_blocks"` + // Accumulated amount at distribution epoch - recalculated at every distribution epoch + Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` + // Accumulated rewards tracked by other (when it's for staking, from lp, if it's for lp, from staking) AmountCollectedByOtherTracker github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=amount_collected_by_other_tracker,json=amountCollectedByOtherTracker,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount_collected_by_other_tracker"` } diff --git a/x/incentive/types/elys_staked.pb.go b/x/incentive/types/elys_staked.pb.go index cbaa038dd..7dcbe31bd 100644 --- a/x/incentive/types/elys_staked.pb.go +++ b/x/incentive/types/elys_staked.pb.go @@ -24,7 +24,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Elys staked +// Elys staked amount is tracked because EdenBoost has to be burnt when unstake ELYS event happens, +// and there's no way to track staked amount change from staking hook and this struct is added. type ElysStaked struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` diff --git a/x/incentive/types/incentive.pb.go b/x/incentive/types/incentive.pb.go index 94416994c..703afcabd 100644 --- a/x/incentive/types/incentive.pb.go +++ b/x/incentive/types/incentive.pb.go @@ -33,11 +33,11 @@ type IncentiveInfo struct { DistributionStartBlock github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=distribution_start_block,json=distributionStartBlock,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"distribution_start_block"` // distribution duration - block number per year TotalBlocksPerYear github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=total_blocks_per_year,json=totalBlocksPerYear,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_blocks_per_year"` - // we set block numbers in 24 hrs - AllocationEpochInBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=allocation_epoch_in_blocks,json=allocationEpochInBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"allocation_epoch_in_blocks"` + // we set block count in 24 hrs + EpochNumBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=epoch_num_blocks,json=epochNumBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"epoch_num_blocks"` // maximum eden allocation per day that won't exceed 30% apr MaxEdenPerAllocation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=max_eden_per_allocation,json=maxEdenPerAllocation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"max_eden_per_allocation"` - // number of block intervals that distribute rewards. + // number of block intervals that distribute rewards, this is set from params.distribution_interval DistributionEpochInBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=distribution_epoch_in_blocks,json=distributionEpochInBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"distribution_epoch_in_blocks"` // current epoch in block number CurrentEpochInBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=current_epoch_in_blocks,json=currentEpochInBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"current_epoch_in_blocks"` @@ -85,34 +85,34 @@ func init() { func init() { proto.RegisterFile("elys/incentive/incentive.proto", fileDescriptor_ed0e67c7f36f3313) } var fileDescriptor_ed0e67c7f36f3313 = []byte{ - // 426 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0xd3, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0x06, 0xf0, 0x86, 0x3f, 0x05, 0x2c, 0x98, 0x44, 0x54, 0x58, 0xa8, 0x50, 0x8a, 0x38, 0x20, - 0x2e, 0x4b, 0x0e, 0x7c, 0x82, 0x56, 0x4c, 0xa2, 0xb7, 0x69, 0x70, 0x81, 0x8b, 0xe5, 0xb8, 0xef, - 0x52, 0xab, 0x89, 0xdf, 0xc8, 0x7e, 0x03, 0xed, 0xb7, 0xe0, 0x1b, 0x71, 0xdd, 0x71, 0x47, 0xc4, - 0x61, 0x42, 0xed, 0x17, 0x41, 0x76, 0xba, 0x25, 0x63, 0xa7, 0xe5, 0x54, 0xbb, 0xb6, 0x7e, 0x8f, - 0x9e, 0x58, 0x2f, 0x8b, 0xa1, 0xd8, 0xd8, 0x54, 0x69, 0x09, 0x9a, 0xd4, 0x77, 0x68, 0x57, 0x49, - 0x65, 0x90, 0x30, 0x3c, 0x70, 0xe7, 0xc9, 0xf5, 0xbf, 0xe3, 0x51, 0x8e, 0x39, 0xfa, 0xa3, 0xd4, - 0xad, 0x9a, 0x5b, 0xe3, 0x49, 0x8e, 0x98, 0x17, 0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5, 0xfa, - 0x78, 0x01, 0xfa, 0x04, 0xcc, 0xf4, 0xda, 0x0a, 0x91, 0xbd, 0xbe, 0xf1, 0x40, 0xff, 0xb7, 0x1a, - 0xf6, 0xca, 0x7a, 0xd5, 0x35, 0x6f, 0xf5, 0x92, 0xb5, 0x31, 0xa0, 0xe9, 0x56, 0xd6, 0xa3, 0x7e, - 0xbd, 0xf6, 0xdc, 0xcd, 0x98, 0x2f, 0xec, 0xc0, 0x7f, 0xba, 0x0c, 0xd1, 0x12, 0x17, 0x95, 0x89, - 0x1e, 0xdf, 0x59, 0xff, 0x08, 0xf2, 0xf4, 0xa9, 0x53, 0x66, 0x0e, 0x99, 0x56, 0x66, 0xf6, 0xe9, - 0x7c, 0x1b, 0x07, 0x17, 0xdb, 0x38, 0xf8, 0xbb, 0x8d, 0x83, 0x9f, 0xbb, 0x78, 0x70, 0xb1, 0x8b, - 0x07, 0xbf, 0x77, 0xf1, 0xe0, 0x5b, 0xd2, 0xf1, 0xdc, 0xb4, 0x1e, 0x69, 0xa0, 0x1f, 0x68, 0x56, - 0x7e, 0x93, 0xae, 0x3b, 0xc3, 0xed, 0xed, 0x6c, 0xe8, 0x47, 0xf2, 0xc3, 0xbf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x62, 0xa6, 0xae, 0x62, 0xfb, 0x03, 0x00, 0x00, + // 431 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0xd3, 0x4f, 0x8e, 0xd3, 0x30, + 0x14, 0x06, 0xf0, 0x86, 0x3f, 0x05, 0x2c, 0xa8, 0x20, 0x2a, 0x10, 0x46, 0x28, 0x45, 0x2c, 0x10, + 0x9b, 0x49, 0x16, 0x9c, 0xa0, 0x15, 0x23, 0xd1, 0x0d, 0x1a, 0x0d, 0x2c, 0x80, 0x8d, 0xe5, 0xa4, + 0x6f, 0x52, 0xab, 0xb1, 0x5f, 0x64, 0xbf,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xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x58, 0xbd, 0xc7, 0xe8, 0x03, 0x00, 0x00, } func (m *IncentiveInfo) Marshal() (dAtA []byte, err error) { @@ -176,9 +176,9 @@ func (m *IncentiveInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a { - size := m.AllocationEpochInBlocks.Size() + size := m.EpochNumBlocks.Size() i -= size - if _, err := m.AllocationEpochInBlocks.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.EpochNumBlocks.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintIncentive(dAtA, i, uint64(size)) @@ -241,7 +241,7 @@ func (m *IncentiveInfo) Size() (n int) { n += 1 + l + sovIncentive(uint64(l)) l = m.TotalBlocksPerYear.Size() n += 1 + l + sovIncentive(uint64(l)) - l = m.AllocationEpochInBlocks.Size() + l = m.EpochNumBlocks.Size() n += 1 + l + sovIncentive(uint64(l)) l = m.MaxEdenPerAllocation.Size() n += 1 + l + sovIncentive(uint64(l)) @@ -393,7 +393,7 @@ func (m *IncentiveInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationEpochInBlocks", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EpochNumBlocks", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -421,7 +421,7 @@ func (m *IncentiveInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.AllocationEpochInBlocks.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.EpochNumBlocks.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/incentive/types/keys.go b/x/incentive/types/keys.go index 98563525b..566359c29 100644 --- a/x/incentive/types/keys.go +++ b/x/incentive/types/keys.go @@ -14,6 +14,9 @@ const ( MemStoreKey = "mem_incentive" ElysStakedKeyPrefix = "ElysStaked/value/" + + // ParamsKey is the prefix to retrieve all Params + ParamsKey = "Params/value/" ) func KeyPrefix(p string) []byte { @@ -23,9 +26,7 @@ func KeyPrefix(p string) []byte { var FeePoolKey = []byte{0x00} // key for global distribution state // ElysStakedKey returns the store key to retrieve a ElysStaked from the address fields -func ElysStakedKey( - address string, -) []byte { +func ElysStakedKey(address string) []byte { var key []byte addressBytes := []byte(address) diff --git a/x/incentive/types/message_update_incentive_params.go b/x/incentive/types/message_update_incentive_params.go index 564254f46..969188748 100644 --- a/x/incentive/types/message_update_incentive_params.go +++ b/x/incentive/types/message_update_incentive_params.go @@ -12,18 +12,15 @@ const TypeMsgUpdateIncentiveParams = "update_incentive_params" var _ sdk.Msg = &MsgUpdateIncentiveParams{} -func NewMsgUpdateIncentiveParams(creator string, communityTax sdk.Dec, withdrawAddrEnabled bool, rewardPortionForLps sdk.Dec, rewardPortionForStakers sdk.Dec, elysStakeTrackingRate int64, maxEdenRewardAprStakers sdk.Dec, maxEdenRewardParLps sdk.Dec, distributionEpochForStakers int64, distributionEpochForLps int64) *MsgUpdateIncentiveParams { +func NewMsgUpdateIncentiveParams(creator string, rewardPortionForLps sdk.Dec, rewardPortionForStakers sdk.Dec, elysStakeSnapInterval int64, maxEdenRewardAprStakers sdk.Dec, maxEdenRewardParLps sdk.Dec, distributionInterval int64) *MsgUpdateIncentiveParams { return &MsgUpdateIncentiveParams{ - Authority: creator, - CommunityTax: communityTax, - WithdrawAddrEnabled: withdrawAddrEnabled, - RewardPortionForLps: rewardPortionForLps, - RewardPortionForStakers: rewardPortionForStakers, - ElysStakeTrackingRate: elysStakeTrackingRate, - MaxEdenRewardAprStakers: maxEdenRewardAprStakers, - MaxEdenRewardAprLps: maxEdenRewardParLps, - DistributionEpochForStakers: distributionEpochForStakers, - DistributionEpochForLps: distributionEpochForLps, + Authority: creator, + RewardPortionForLps: rewardPortionForLps, + RewardPortionForStakers: rewardPortionForStakers, + ElysStakeSnapInterval: elysStakeSnapInterval, + MaxEdenRewardAprStakers: maxEdenRewardAprStakers, + MaxEdenRewardAprLps: maxEdenRewardParLps, + DistributionInterval: distributionInterval, } } @@ -68,13 +65,10 @@ func (msg *MsgUpdateIncentiveParams) ValidateBasic() error { if msg.MaxEdenRewardAprLps.LT(sdk.ZeroDec()) { return errorsmod.Wrapf(sdkerrors.ErrNotSupported, "invalid max eden rewards apr for stakers (%s)", errors.New("Invalid Rewards APR")) } - if msg.DistributionEpochForStakers < 1 { + if msg.DistributionInterval < 1 { return errorsmod.Wrapf(sdkerrors.ErrNotSupported, "invalid distribution epoch (%s)", errors.New("Invalid epoch")) } - if msg.DistributionEpochForLps < 1 { - return errorsmod.Wrapf(sdkerrors.ErrNotSupported, "invalid distribution epoch (%s)", errors.New("Invalid epoch")) - } - if msg.ElysStakeTrackingRate < 1 { + if msg.ElysStakeSnapInterval < 1 { return errorsmod.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 index c99513683..188b42842 100644 --- a/x/incentive/types/message_update_incentive_params_test.go +++ b/x/incentive/types/message_update_incentive_params_test.go @@ -18,27 +18,25 @@ func TestMsgUpdateIncentiveParams_ValidateBasic(t *testing.T) { { name: "invalid address", msg: MsgUpdateIncentiveParams{ - Authority: "invalid_address", - RewardPortionForLps: sdk.NewDecWithPrec(60, 2), - RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), - MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), - MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), - DistributionEpochForStakers: 10, - DistributionEpochForLps: 10, - ElysStakeTrackingRate: 10, + Authority: "invalid_address", + RewardPortionForLps: sdk.NewDecWithPrec(60, 2), + RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), + DistributionInterval: 10, + ElysStakeSnapInterval: 10, }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgUpdateIncentiveParams{ - Authority: sample.AccAddress(), - RewardPortionForLps: sdk.NewDecWithPrec(60, 2), - RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), - MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), - MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), - DistributionEpochForStakers: 10, - DistributionEpochForLps: 10, - ElysStakeTrackingRate: 10, + Authority: sample.AccAddress(), + RewardPortionForLps: sdk.NewDecWithPrec(60, 2), + RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), + MaxEdenRewardAprStakers: sdk.NewDecWithPrec(3, 1), + MaxEdenRewardAprLps: sdk.NewDecWithPrec(3, 1), + DistributionInterval: 10, + ElysStakeSnapInterval: 10, }, }, } diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 49c178815..fed1997f8 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -5,77 +5,43 @@ import ( fmt "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// Parameter keys -var ( - ParamStoreKeyCommunityTax = []byte("communitytax") - ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") - ParamStoreKeyRewardPortionForLps = []byte("rewardportionforlps") - ParamStoreKeyRewardPortionForStakers = []byte("rewardportionforstakers") - 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 -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance func NewParams( - lpIncentives []IncentiveInfo, - stkIncentives []IncentiveInfo, - communityTax sdk.Dec, - withdrawAddrEnabled bool, + lpIncentives *IncentiveInfo, + stkIncentives *IncentiveInfo, rewardPortionForLps sdk.Dec, rewardPortionForStakers sdk.Dec, poolInfos []PoolInfo, - elysStakeTrackingRate int64, + elysStakeSnapInterval int64, dexRewardsStakers DexRewardsTracker, dexRewardsLps DexRewardsTracker, maxEdenRewardAprStakers sdk.Dec, maxEdenRewardAprLps sdk.Dec, - distributionEpochForStakersInBlocks int64, - distributionEpochForLPsInBlocks int64, + distributionInterval int64, ) Params { return Params{ - LpIncentives: lpIncentives, - StakeIncentives: stkIncentives, - CommunityTax: communityTax, - WithdrawAddrEnabled: withdrawAddrEnabled, - RewardPortionForLps: rewardPortionForLps, - RewardPortionForStakers: rewardPortionForStakers, - PoolInfos: poolInfos, - ElysStakeTrackingRate: elysStakeTrackingRate, - DexRewardsStakers: dexRewardsStakers, - DexRewardsLps: dexRewardsLps, - MaxEdenRewardAprStakers: maxEdenRewardAprStakers, - MaxEdenRewardAprLps: maxEdenRewardAprLps, - DistributionEpochForStakersInBlocks: distributionEpochForStakersInBlocks, - DistributionEpochForLpsInBlocks: distributionEpochForLPsInBlocks, + LpIncentives: lpIncentives, + StakeIncentives: stkIncentives, + RewardPortionForLps: rewardPortionForLps, + RewardPortionForStakers: rewardPortionForStakers, + PoolInfos: poolInfos, + ElysStakeSnapInterval: elysStakeSnapInterval, + DexRewardsStakers: dexRewardsStakers, + DexRewardsLps: dexRewardsLps, + MaxEdenRewardAprStakers: maxEdenRewardAprStakers, + MaxEdenRewardAprLps: maxEdenRewardAprLps, + DistributionInterval: distributionInterval, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams( - []IncentiveInfo(nil), - []IncentiveInfo(nil), - sdk.NewDecWithPrec(2, 2), // 2% - true, + nil, + nil, sdk.NewDecWithPrec(60, 2), sdk.NewDecWithPrec(30, 2), []PoolInfo(nil), @@ -93,44 +59,11 @@ func DefaultParams() Params { sdk.NewDecWithPrec(3, 1), sdk.NewDecWithPrec(5, 1), 10, - 10, ) } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(ParamStoreKeyCommunityTax, &p.CommunityTax, validateCommunityTax), - paramtypes.NewParamSetPair(ParamStoreKeyWithdrawAddrEnabled, &p.WithdrawAddrEnabled, validateWithdrawAddrEnabled), - paramtypes.NewParamSetPair(ParamStoreKeyRewardPortionForLps, &p.RewardPortionForLps, validateRewardPortionForLps), - paramtypes.NewParamSetPair(ParamStoreKeyRewardPortionForStakers, &p.RewardPortionForStakers, validateRewardPortionForStakers), - paramtypes.NewParamSetPair(ParamStoreKeyLPIncentives, &p.LpIncentives, validateLPIncentives), - paramtypes.NewParamSetPair(ParamStoreKeyStkIncentives, &p.StakeIncentives, validateStakeIncentives), - paramtypes.NewParamSetPair(ParamStoreKeyPoolInfos, &p.PoolInfos, validatePoolInfos), - paramtypes.NewParamSetPair(ParamStoreKeyElysStakeTrackingRate, &p.ElysStakeTrackingRate, validateElysStakeTrakcingRate), - paramtypes.NewParamSetPair(ParamStoreKeyDexRewardsStakers, &p.DexRewardsStakers, validateDexRewardsStakers), - paramtypes.NewParamSetPair(ParamStoreKeyDexRewardsLps, &p.DexRewardsLps, validateDexRewardsLps), - paramtypes.NewParamSetPair(ParamStoreKeyMaxEdenRewardAprForStakers, &p.MaxEdenRewardAprStakers, validateEdenRewardApr), - paramtypes.NewParamSetPair(ParamStoreKeyMaxEdenRewardAprForLPs, &p.MaxEdenRewardAprLps, validateEdenRewardApr), - paramtypes.NewParamSetPair(ParamStoreKeyDistributionEpochLPs, &p.DistributionEpochForLpsInBlocks, validateDistributionEpochLps), - paramtypes.NewParamSetPair(ParamStoreKeyDistributionEpochStakers, &p.DistributionEpochForStakersInBlocks, validateDistributionEpochStakers), - } -} - // Validate validates the set of params func (p Params) Validate() error { - if err := p.ValidateBasic(); err != nil { - return err - } - - if err := validateCommunityTax(p.CommunityTax); err != nil { - return err - } - - if err := validateWithdrawAddrEnabled(p.WithdrawAddrEnabled); err != nil { - return err - } - if err := validateRewardPortionForLps(p.RewardPortionForLps); err != nil { return err } @@ -151,7 +84,7 @@ func (p Params) Validate() error { return err } - if err := validateElysStakeTrakcingRate(p.ElysStakeTrackingRate); err != nil { + if err := validateElysStakeSnapInterval(p.ElysStakeSnapInterval); err != nil { return err } @@ -163,11 +96,7 @@ func (p Params) Validate() error { return err } - if err := validateDistributionEpochLps(p.DistributionEpochForLpsInBlocks); err != nil { - return err - } - - if err := validateDistributionEpochStakers(p.DistributionEpochForStakersInBlocks); err != nil { + if err := validateDistributionInterval(p.DistributionInterval); err != nil { return err } @@ -184,45 +113,6 @@ func (p Params) String() string { return string(out) } -// ValidateBasic performs basic validation on distribution parameters. -func (p Params) ValidateBasic() error { - if p.CommunityTax.IsNegative() || p.CommunityTax.GT(sdk.OneDec()) { - return fmt.Errorf( - "community tax should be non-negative and less than one: %s", p.CommunityTax, - ) - } - - return nil -} - -func validateCommunityTax(i interface{}) error { - v, ok := i.(sdk.Dec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNil() { - return fmt.Errorf("community tax must be not nil") - } - if v.IsNegative() { - return fmt.Errorf("community tax must be positive: %s", v) - } - if v.GT(sdk.OneDec()) { - return fmt.Errorf("community tax too large: %s", v) - } - - return nil -} - -func validateWithdrawAddrEnabled(i interface{}) error { - _, ok := i.(bool) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - func validateRewardPortionForLps(i interface{}) error { v, ok := i.(sdk.Dec) if !ok { @@ -262,84 +152,80 @@ func validateRewardPortionForStakers(i interface{}) error { } func validateLPIncentives(i interface{}) error { - v, ok := i.([]IncentiveInfo) + vv, ok := i.(*IncentiveInfo) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if v == nil { + if vv == nil { return nil } - for _, vv := range v { - if vv.EdenAmountPerYear.LTE(sdk.ZeroInt()) { - return fmt.Errorf("invalid eden amount per year: %v", vv) - } + if vv.EdenAmountPerYear.LTE(sdk.ZeroInt()) { + return fmt.Errorf("invalid eden amount per year: %v", vv) + } - if vv.TotalBlocksPerYear.LT(sdk.NewInt(1)) { - return fmt.Errorf("invalid total blocks per year: %v", vv) - } + if vv.TotalBlocksPerYear.LT(sdk.NewInt(1)) { + return fmt.Errorf("invalid total blocks per year: %v", vv) + } - if vv.AllocationEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid allocation epoch in blocks: %v", vv) - } + if vv.EpochNumBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid number of blocks in epoch: %v", vv) + } - if vv.DistributionEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid distribution epoch in blocks: %v", vv) - } + if vv.DistributionEpochInBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid distribution epoch in blocks: %v", vv) + } - if vv.CurrentEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid current epoch: %v", vv) - } + if vv.CurrentEpochInBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid current epoch: %v", vv) + } - if vv.DistributionStartBlock.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid distribution epoch: %v", vv) - } + if vv.DistributionStartBlock.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid distribution epoch: %v", vv) + } - if vv.EdenBoostApr.GT(sdk.NewDec(1)) || vv.EdenBoostApr.LT(sdk.ZeroDec()) { - return fmt.Errorf("invalid eden boot apr: %v", vv) - } + if vv.EdenBoostApr.GT(sdk.NewDec(1)) || vv.EdenBoostApr.LT(sdk.ZeroDec()) { + return fmt.Errorf("invalid eden boot apr: %v", vv) } return nil } func validateStakeIncentives(i interface{}) error { - v, ok := i.([]IncentiveInfo) + vv, ok := i.(*IncentiveInfo) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if v == nil { + if vv == nil { return nil } - for _, vv := range v { - if vv.EdenAmountPerYear.LTE(sdk.ZeroInt()) { - return fmt.Errorf("invalid eden amount per year: %v", vv) - } + if vv.EdenAmountPerYear.LTE(sdk.ZeroInt()) { + return fmt.Errorf("invalid eden amount per year: %v", vv) + } - if vv.TotalBlocksPerYear.LT(sdk.NewInt(1)) { - return fmt.Errorf("invalid total blocks per year: %v", vv) - } + if vv.TotalBlocksPerYear.LT(sdk.NewInt(1)) { + return fmt.Errorf("invalid total blocks per year: %v", vv) + } - if vv.AllocationEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid allocation epoch in blocks: %v", vv) - } + if vv.EpochNumBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid number of blocks in epoch: %v", vv) + } - if vv.DistributionEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid distribution epoch in blocks: %v", vv) - } + if vv.DistributionEpochInBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid distribution epoch in blocks: %v", vv) + } - if vv.CurrentEpochInBlocks.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid current epoch: %v", vv) - } + if vv.CurrentEpochInBlocks.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid current epoch: %v", vv) + } - if vv.DistributionStartBlock.LT(sdk.NewInt(0)) { - return fmt.Errorf("invalid distribution epoch: %v", vv) - } + if vv.DistributionStartBlock.LT(sdk.NewInt(0)) { + return fmt.Errorf("invalid distribution epoch: %v", vv) + } - if vv.EdenBoostApr.GT(sdk.NewDec(1)) || vv.EdenBoostApr.LT(sdk.ZeroDec()) { - return fmt.Errorf("invalid eden boot apr: %v", vv) - } + if vv.EdenBoostApr.GT(sdk.NewDec(1)) || vv.EdenBoostApr.LT(sdk.ZeroDec()) { + return fmt.Errorf("invalid eden boot apr: %v", vv) } return nil @@ -354,7 +240,7 @@ func validatePoolInfos(i interface{}) error { return nil } -func validateElysStakeTrakcingRate(i interface{}) error { +func validateElysStakeSnapInterval(i interface{}) error { _, ok := i.(int64) if !ok { return fmt.Errorf("invalid parameter type: %T", i) @@ -394,20 +280,7 @@ 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 { +func validateDistributionInterval(i interface{}) error { v, ok := i.(int64) if !ok { return fmt.Errorf("invalid parameter type: %T", i) diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index 216c35b39..e6d6a4e31 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -26,30 +26,27 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - LpIncentives []IncentiveInfo `protobuf:"bytes,1,rep,name=lp_incentives,json=lpIncentives,proto3" json:"lp_incentives"` - StakeIncentives []IncentiveInfo `protobuf:"bytes,2,rep,name=stake_incentives,json=stakeIncentives,proto3" json:"stake_incentives"` - CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=community_tax,json=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_tax"` - WithdrawAddrEnabled bool `protobuf:"varint,4,opt,name=withdraw_addr_enabled,json=withdrawAddrEnabled,proto3" json:"withdraw_addr_enabled,omitempty"` - // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. - RewardPortionForLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reward_portion_for_lps,json=rewardPortionForLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_lps"` - // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. - RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=reward_portion_for_stakers,json=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_stakers"` + LpIncentives *IncentiveInfo `protobuf:"bytes,1,opt,name=lp_incentives,json=lpIncentives,proto3" json:"lp_incentives,omitempty"` + StakeIncentives *IncentiveInfo `protobuf:"bytes,2,opt,name=stake_incentives,json=stakeIncentives,proto3" json:"stake_incentives,omitempty"` + // Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol`. + RewardPortionForLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=reward_portion_for_lps,json=rewardPortionForLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_lps"` + // Dex revenue percent for lps, `100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol`. + RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=reward_portion_for_stakers,json=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_stakers"` // Pool information - // poolId, reward wallet, mulitplier, dex rewards given - PoolInfos []PoolInfo `protobuf:"bytes,7,rep,name=pool_infos,json=poolInfos,proto3" json:"pool_infos"` - ElysStakeTrackingRate int64 `protobuf:"varint,8,opt,name=elys_stake_tracking_rate,json=elysStakeTrackingRate,proto3" json:"elys_stake_tracking_rate,omitempty"` + // poolId, reward wallet, **multiplier**, dex rewards given + PoolInfos []PoolInfo `protobuf:"bytes,5,rep,name=pool_infos,json=poolInfos,proto3" json:"pool_infos"` + // Number of blocks to update elys staked amount for delegators + ElysStakeSnapInterval int64 `protobuf:"varint,6,opt,name=elys_stake_snap_interval,json=elysStakeSnapInterval,proto3" json:"elys_stake_snap_interval,omitempty"` // Tracking dex rewards given to stakers - DexRewardsStakers DexRewardsTracker `protobuf:"bytes,9,opt,name=dex_rewards_stakers,json=dexRewardsStakers,proto3" json:"dex_rewards_stakers"` + DexRewardsStakers DexRewardsTracker `protobuf:"bytes,7,opt,name=dex_rewards_stakers,json=dexRewardsStakers,proto3" json:"dex_rewards_stakers"` // Tracking dex rewards given to LPs - DexRewardsLps DexRewardsTracker `protobuf:"bytes,10,opt,name=dex_rewards_lps,json=dexRewardsLps,proto3" json:"dex_rewards_lps"` - // Maximum eden reward apr for stakers - MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,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,12,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,13,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,14,opt,name=distribution_epoch_for_lps_in_blocks,json=distributionEpochForLpsInBlocks,proto3" json:"distribution_epoch_for_lps_in_blocks,omitempty"` + DexRewardsLps DexRewardsTracker `protobuf:"bytes,8,opt,name=dex_rewards_lps,json=dexRewardsLps,proto3" json:"dex_rewards_lps"` + // Maximum eden reward apr for stakers - [0 - 0.3] + MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,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 - [0 - 0.3] + MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,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 interval in blocks - number of blocks on distribution epoch + DistributionInterval int64 `protobuf:"varint,11,opt,name=distribution_interval,json=distributionInterval,proto3" json:"distribution_interval,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -84,27 +81,20 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetLpIncentives() []IncentiveInfo { +func (m *Params) GetLpIncentives() *IncentiveInfo { if m != nil { return m.LpIncentives } return nil } -func (m *Params) GetStakeIncentives() []IncentiveInfo { +func (m *Params) GetStakeIncentives() *IncentiveInfo { if m != nil { return m.StakeIncentives } return nil } -func (m *Params) GetWithdrawAddrEnabled() bool { - if m != nil { - return m.WithdrawAddrEnabled - } - return false -} - func (m *Params) GetPoolInfos() []PoolInfo { if m != nil { return m.PoolInfos @@ -112,9 +102,9 @@ func (m *Params) GetPoolInfos() []PoolInfo { return nil } -func (m *Params) GetElysStakeTrackingRate() int64 { +func (m *Params) GetElysStakeSnapInterval() int64 { if m != nil { - return m.ElysStakeTrackingRate + return m.ElysStakeSnapInterval } return 0 } @@ -133,16 +123,9 @@ 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 { +func (m *Params) GetDistributionInterval() int64 { if m != nil { - return m.DistributionEpochForLpsInBlocks + return m.DistributionInterval } return 0 } @@ -154,46 +137,40 @@ func init() { func init() { proto.RegisterFile("elys/incentive/params.proto", fileDescriptor_3bca0267cb466fec) } var fileDescriptor_3bca0267cb466fec = []byte{ - // 622 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x4f, 0xd4, 0x4e, - 0x18, 0xc7, 0xb7, 0x3f, 0xf8, 0x21, 0x3b, 0xb0, 0xa0, 0x45, 0xa4, 0x42, 0xec, 0xae, 0x7f, 0xa2, - 0xbd, 0xd0, 0x26, 0x78, 0x30, 0x31, 0xf1, 0xc0, 0x06, 0x0c, 0x24, 0xa8, 0xa4, 0x60, 0x4c, 0xbc, - 0x4c, 0x66, 0x3b, 0xc3, 0xd2, 0xb4, 0x9d, 0x99, 0xcc, 0x0c, 0x6e, 0x79, 0x17, 0x1e, 0xbd, 0xe9, - 0xcb, 0xe1, 0xc8, 0xd1, 0x78, 0x20, 0x06, 0xde, 0x88, 0x99, 0x69, 0xb7, 0xd4, 0x06, 0x13, 0xdd, - 0xd3, 0x4e, 0xf7, 0xfb, 0xf4, 0xf3, 0x7d, 0xe6, 0xf9, 0x3e, 0x29, 0x58, 0x23, 0xe9, 0xa9, 0x0c, - 0x62, 0x1a, 0x11, 0xaa, 0xe2, 0x4f, 0x24, 0xe0, 0x48, 0xa0, 0x4c, 0xfa, 0x5c, 0x30, 0xc5, 0xec, - 0x05, 0x2d, 0xfa, 0x95, 0xb8, 0x7a, 0x77, 0xc8, 0x86, 0xcc, 0x48, 0x81, 0x3e, 0x15, 0x55, 0xab, - 0x6e, 0x03, 0x51, 0x9d, 0x4a, 0xfd, 0x7e, 0xd3, 0x82, 0xb1, 0xb4, 0x94, 0x9e, 0x35, 0x24, 0x4c, - 0x72, 0x28, 0xc8, 0x08, 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x4c, 0xec, 0x71, 0x69, 0x27, - 0x60, 0xf5, 0x06, 0x13, 0x33, 0x13, 0x21, 0x9d, 0x99, 0x89, 0x8c, 0x56, 0x9a, 0x46, 0x07, 0x05, - 0xce, 0x7e, 0x05, 0x80, 0x5e, 0x1b, 0x18, 0xd3, 0x23, 0x26, 0x9d, 0x5b, 0x26, 0x24, 0xa7, 0x19, - 0xd2, 0x3e, 0x63, 0x69, 0x2d, 0x9f, 0x36, 0x2f, 0x9f, 0xa5, 0xfd, 0x02, 0x38, 0xba, 0xb6, 0xe8, - 0x4e, 0x6f, 0x56, 0x94, 0xc4, 0x74, 0x08, 0x05, 0x52, 0xc4, 0x99, 0xed, 0x59, 0xde, 0x54, 0xb8, - 0xac, 0x75, 0xe3, 0x76, 0x58, 0xaa, 0x21, 0x52, 0xc4, 0xfe, 0x00, 0x96, 0xea, 0x3b, 0x39, 0xbe, - 0x5d, 0xbb, 0x67, 0x79, 0x73, 0x1b, 0x0f, 0x9b, 0x0d, 0x6c, 0x91, 0x3c, 0x2c, 0x2a, 0x0d, 0x84, - 0x88, 0xb2, 0x93, 0x3b, 0xb8, 0x12, 0xc6, 0x17, 0x7a, 0x07, 0x16, 0xeb, 0x60, 0x9d, 0x0d, 0xf8, - 0x37, 0x68, 0xe7, 0x1a, 0xaa, 0xe3, 0x48, 0xc1, 0x5a, 0x86, 0x72, 0x48, 0x30, 0xa1, 0x25, 0x15, - 0x22, 0x7e, 0x9d, 0xc7, 0xdc, 0x64, 0x79, 0x64, 0x28, 0xdf, 0xc6, 0x84, 0x16, 0x3e, 0x9b, 0xbc, - 0xca, 0x03, 0x83, 0x95, 0x9b, 0xdc, 0xf4, 0x35, 0xe6, 0x27, 0x5b, 0xb1, 0xa6, 0x93, 0xbe, 0xd3, - 0x7b, 0xe0, 0xe1, 0x58, 0x2a, 0x11, 0x0f, 0x4e, 0xcc, 0x82, 0x11, 0xce, 0xa2, 0xe3, 0xfa, 0x9a, - 0xc1, 0x98, 0xc2, 0x41, 0xca, 0xa2, 0x44, 0x3a, 0x1d, 0x13, 0xe3, 0xe3, 0x7a, 0xfd, 0xb6, 0x2e, - 0xbf, 0x5e, 0xa2, 0x5d, 0xda, 0x37, 0xa5, 0xf6, 0x1b, 0xf0, 0xe4, 0x0f, 0xd8, 0x94, 0xd7, 0x91, - 0x0b, 0x06, 0xd9, 0xbd, 0x09, 0xb9, 0xc7, 0x2b, 0xdc, 0xcb, 0xe9, 0x2f, 0xdf, 0xba, 0xad, 0xfe, - 0xce, 0xd9, 0xa5, 0x6b, 0x9d, 0x5f, 0xba, 0xd6, 0xcf, 0x4b, 0xd7, 0xfa, 0x7c, 0xe5, 0xb6, 0xce, - 0xaf, 0xdc, 0xd6, 0xf7, 0x2b, 0xb7, 0xf5, 0xd1, 0xaf, 0x8d, 0x40, 0x67, 0xbb, 0x4e, 0x89, 0x1a, - 0x31, 0x91, 0x98, 0x87, 0x20, 0xaf, 0x7d, 0xfe, 0xcc, 0x38, 0x06, 0x33, 0xe6, 0x93, 0xf7, 0xfc, - 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x67, 0x7b, 0xad, 0x9b, 0x05, 0x00, 0x00, + // 526 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x4d, 0x68, 0xe9, 0xa8, 0xcb, 0x18, 0x64, 0x1b, 0x0b, 0x9d, 0x48, 0x0b, 0x07, 0xe8, 0x65, + 0x89, 0xb4, 0x1d, 0x90, 0x90, 0x38, 0x50, 0x0d, 0xb4, 0x4a, 0x48, 0x54, 0x19, 0x12, 0x12, 0x17, + 0xcb, 0x4d, 0xdc, 0x12, 0x25, 0xb1, 0x2d, 0xdb, 0xdb, 0xb2, 0x7f, 0xc1, 0x11, 0x6e, 0xfc, 0x9c, + 0x1d, 0x77, 0x44, 0x1c, 0x26, 0xd4, 0xfe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0xec, 0xc9, + 0x73, 0x86, 0x85, 0x7b, 0x88, 0x03, 0x7f, 0x33, 0x67, 0x1b, 0xe7, 0x64, 0xef, 0x29, 0xff, 0xc0, + 0x84, 0x15, 0x83, 0xee, 0x0d, 0x22, 0xda, 0x0a, 0x17, 0x76, 0x73, 0x25, 0xa1, 0x9d, 0xba, 0xd0, + 0x71, 0x4e, 0x67, 0xbd, 0x01, 0x40, 0x25, 0x04, 0x23, 0x32, 0xa5, 0xc2, 0xbe, 0xdb, 0x6f, 0x0c, + 0x3a, 0xfb, 0x76, 0x7d, 0x2a, 0x63, 0x4a, 0x13, 0x35, 0x90, 0x61, 0x53, 0xc9, 0xfa, 0x6d, 0x56, + 0xec, 0x85, 0xf5, 0x0a, 0xd8, 0xaa, 0x36, 0x77, 0x07, 0x05, 0x41, 0x2a, 0x2b, 0x89, 0xf9, 0x29, + 0x4a, 0xec, 0x56, 0xdf, 0x1c, 0x34, 0xfc, 0x6d, 0x85, 0x6b, 0xb5, 0x63, 0x82, 0xd8, 0xa8, 0x00, + 0xad, 0xcf, 0x60, 0xb3, 0x1a, 0xff, 0xb2, 0xbb, 0x35, 0x1d, 0xcb, 0xb3, 0xba, 0x81, 0x43, 0x9c, + 0xf9, 0x79, 0xe5, 0x27, 0x8e, 0x82, 0x18, 0xf3, 0xc2, 0xc9, 0xa3, 0xb0, 0x04, 0x96, 0x0d, 0x7d, + 0x04, 0x1b, 0x55, 0x62, 0x95, 0xcd, 0xbd, 0xdb, 0x91, 0xae, 0x5f, 0x93, 0xaa, 0x38, 0x12, 0xb0, + 0x9b, 0xa2, 0x0c, 0xe2, 0x10, 0x93, 0x82, 0x15, 0x22, 0x76, 0x9d, 0x47, 0x7b, 0xb5, 0x3c, 0x52, + 0x94, 0xbd, 0x0b, 0x31, 0xc9, 0x75, 0xde, 0xb2, 0x32, 0x8f, 0x10, 0xec, 0xdc, 0xa4, 0xa6, 0xda, + 0x00, 0xab, 0x5d, 0xb1, 0xba, 0x92, 0xea, 0xe9, 0x00, 0x6c, 0x87, 0x91, 0x90, 0x3c, 0x9a, 0x9c, + 0xe8, 0x0b, 0x56, 0x66, 0xd6, 0xd1, 0x99, 0x6d, 0x55, 0xc1, 0x65, 0x64, 0xaf, 0x9b, 0xdf, 0x7f, + 0xf6, 0x8c, 0xe1, 0xd1, 0xc5, 0xdc, 0x31, 0x2f, 0xe7, 0x8e, 0xf9, 0x67, 0xee, 0x98, 0xdf, 0x16, + 0x8e, 0x71, 0xb9, 0x70, 0x8c, 0x5f, 0x0b, 0xc7, 0xf8, 0xe2, 0x56, 0x1c, 0xa9, 0x51, 0xef, 0x11, + 0x2c, 0xcf, 0x28, 0x8f, 0xf5, 0xc6, 0xcb, 0x2a, 0x0f, 0x5f, 0xbb, 0x9b, 0xb4, 0xf4, 0x63, 0x3f, + 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x54, 0xb8, 0x55, 0x93, 0x95, 0x04, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -216,15 +193,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.DistributionEpochForLpsInBlocks != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForLpsInBlocks)) + if m.DistributionInterval != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DistributionInterval)) i-- - dAtA[i] = 0x70 - } - if m.DistributionEpochForStakersInBlocks != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForStakersInBlocks)) - i-- - dAtA[i] = 0x68 + dAtA[i] = 0x58 } { size := m.MaxEdenRewardAprLps.Size() @@ -235,7 +207,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x62 + dAtA[i] = 0x52 { size := m.MaxEdenRewardAprStakers.Size() i -= size @@ -245,7 +217,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x4a { size, err := m.DexRewardsLps.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -255,7 +227,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x42 { size, err := m.DexRewardsStakers.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -265,11 +237,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a - if m.ElysStakeTrackingRate != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.ElysStakeTrackingRate)) + dAtA[i] = 0x3a + if m.ElysStakeSnapInterval != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ElysStakeSnapInterval)) i-- - dAtA[i] = 0x40 + dAtA[i] = 0x30 } if len(m.PoolInfos) > 0 { for iNdEx := len(m.PoolInfos) - 1; iNdEx >= 0; iNdEx-- { @@ -282,7 +254,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x2a } } { @@ -294,7 +266,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x22 { size := m.RewardPortionForLps.Size() i -= size @@ -304,54 +276,30 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - if m.WithdrawAddrEnabled { - i-- - if m.WithdrawAddrEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - { - size := m.CommunityTax.Size() - i -= size - if _, err := m.CommunityTax.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x1a - if len(m.StakeIncentives) > 0 { - for iNdEx := len(m.StakeIncentives) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.StakeIncentives[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) + if m.StakeIncentives != nil { + { + size, err := m.StakeIncentives.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if len(m.LpIncentives) > 0 { - for iNdEx := len(m.LpIncentives) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LpIncentives[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) + if m.LpIncentives != nil { + { + size, err := m.LpIncentives.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -373,22 +321,13 @@ func (m *Params) Size() (n int) { } var l int _ = l - if len(m.LpIncentives) > 0 { - for _, e := range m.LpIncentives { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } + if m.LpIncentives != nil { + l = m.LpIncentives.Size() + n += 1 + l + sovParams(uint64(l)) } - if len(m.StakeIncentives) > 0 { - for _, e := range m.StakeIncentives { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - l = m.CommunityTax.Size() - n += 1 + l + sovParams(uint64(l)) - if m.WithdrawAddrEnabled { - n += 2 + if m.StakeIncentives != nil { + l = m.StakeIncentives.Size() + n += 1 + l + sovParams(uint64(l)) } l = m.RewardPortionForLps.Size() n += 1 + l + sovParams(uint64(l)) @@ -400,8 +339,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } - if m.ElysStakeTrackingRate != 0 { - n += 1 + sovParams(uint64(m.ElysStakeTrackingRate)) + if m.ElysStakeSnapInterval != 0 { + n += 1 + sovParams(uint64(m.ElysStakeSnapInterval)) } l = m.DexRewardsStakers.Size() n += 1 + l + sovParams(uint64(l)) @@ -411,11 +350,8 @@ func (m *Params) Size() (n int) { 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)) + if m.DistributionInterval != 0 { + n += 1 + sovParams(uint64(m.DistributionInterval)) } return n } @@ -484,8 +420,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LpIncentives = append(m.LpIncentives, IncentiveInfo{}) - if err := m.LpIncentives[len(m.LpIncentives)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.LpIncentives == nil { + m.LpIncentives = &IncentiveInfo{} + } + if err := m.LpIncentives.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -518,66 +456,14 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakeIncentives = append(m.StakeIncentives, IncentiveInfo{}) - if err := m.StakeIncentives[len(m.StakeIncentives)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - 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 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 m.StakeIncentives == nil { + m.StakeIncentives = &IncentiveInfo{} } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CommunityTax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StakeIncentives.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - 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 ErrIntOverflowParams - } - 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 5: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardPortionForLps", wireType) } @@ -611,7 +497,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardPortionForStakers", wireType) } @@ -645,7 +531,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PoolInfos", wireType) } @@ -679,11 +565,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeTrackingRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeSnapInterval", wireType) } - m.ElysStakeTrackingRate = 0 + m.ElysStakeSnapInterval = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -693,12 +579,12 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ElysStakeTrackingRate |= int64(b&0x7F) << shift + m.ElysStakeSnapInterval |= int64(b&0x7F) << shift if b < 0x80 { break } } - case 9: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DexRewardsStakers", wireType) } @@ -731,7 +617,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DexRewardsLps", wireType) } @@ -764,7 +650,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprStakers", wireType) } @@ -798,7 +684,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 12: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprLps", wireType) } @@ -832,30 +718,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 13: - 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 14: + case 11: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForLpsInBlocks", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DistributionInterval", wireType) } - m.DistributionEpochForLpsInBlocks = 0 + m.DistributionInterval = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -865,7 +732,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DistributionEpochForLpsInBlocks |= int64(b&0x7F) << shift + m.DistributionInterval |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index e32133d2c..e45d1fae1 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -19,9 +19,6 @@ func Test_validateParams(t *testing.T) { params.RewardPortionForLps = sdk.NewDecWithPrec(12, 1) require.Error(t, params.Validate()) - params.CommunityTax = sdk.NewDecWithPrec(1, 0) - require.Error(t, params.Validate()) - lpIncentive := types.IncentiveInfo{ // reward amount in eden for 1 year EdenAmountPerYear: sdk.NewInt(10000000000000), @@ -30,7 +27,7 @@ func Test_validateParams(t *testing.T) { // distribution duration - block number per year TotalBlocksPerYear: sdk.NewInt(10512000), // we set block numbers in 24 hrs - AllocationEpochInBlocks: sdk.NewInt(28800), + EpochNumBlocks: sdk.NewInt(28800), // maximum eden allocation per day that won't exceed 30% apr MaxEdenPerAllocation: sdk.NewInt(27397238400), // number of block intervals that distribute rewards. @@ -41,6 +38,6 @@ func Test_validateParams(t *testing.T) { EdenBoostApr: sdk.NewDec(1), } - params.LpIncentives = append(params.LpIncentives, lpIncentive) + params.LpIncentives = &lpIncentive require.Error(t, params.Validate()) } diff --git a/x/incentive/types/pool.pb.go b/x/incentive/types/pool.pb.go index 6d273d4f5..f87360174 100644 --- a/x/incentive/types/pool.pb.go +++ b/x/incentive/types/pool.pb.go @@ -33,15 +33,15 @@ type PoolInfo struct { RewardWallet string `protobuf:"bytes,2,opt,name=reward_wallet,json=rewardWallet,proto3" json:"reward_wallet,omitempty"` // multiplier for lp rewards Multiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=multiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"multiplier"` - // Block number since creation + // Block number since the creation of PoolInfo NumBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=num_blocks,json=numBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"num_blocks"` // Total dex rewards given DexRewardAmountGiven github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=dex_reward_amount_given,json=dexRewardAmountGiven,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dex_reward_amount_given"` // Total eden rewards given EdenRewardAmountGiven github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=eden_reward_amount_given,json=edenRewardAmountGiven,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eden_reward_amount_given"` - // Eden APR + // Eden APR, updated at every distribution EdenApr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=eden_apr,json=edenApr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"eden_apr"` - // Dex APR + // Dex APR, updated at every distribution DexApr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=dex_apr,json=dexApr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dex_apr"` } diff --git a/x/incentive/types/query.pb.gw.go b/x/incentive/types/query.pb.gw.go index 1c5937357..b5a443e54 100644 --- a/x/incentive/types/query.pb.gw.go +++ b/x/incentive/types/query.pb.gw.go @@ -21,7 +21,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -32,7 +31,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -155,14 +153,12 @@ func local_request_Query_Apr_0(ctx context.Context, marshaler runtime.Marshaler, // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -170,7 +166,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -184,8 +179,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_CommunityPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -193,7 +186,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_CommunityPool_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -207,8 +199,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Apr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -216,7 +206,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Apr_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 17cd3d768..49fd6e838 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -189,16 +189,13 @@ 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"` - RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rewardPortionForStakers"` - ElysStakeTrackingRate int64 `protobuf:"varint,6,opt,name=elysStakeTrackingRate,proto3" json:"elysStakeTrackingRate,omitempty"` - MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprStakers"` - MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprLps"` - DistributionEpochForStakers int64 `protobuf:"varint,9,opt,name=distributionEpochForStakers,proto3" json:"distributionEpochForStakers,omitempty"` - DistributionEpochForLps int64 `protobuf:"varint,10,opt,name=distributionEpochForLps,proto3" json:"distributionEpochForLps,omitempty"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + RewardPortionForLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=rewardPortionForLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rewardPortionForLps"` + RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rewardPortionForStakers"` + ElysStakeSnapInterval int64 `protobuf:"varint,4,opt,name=elysStakeSnapInterval,proto3" json:"elysStakeSnapInterval,omitempty"` + MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprStakers"` + MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maxEdenRewardAprLps"` + DistributionInterval int64 `protobuf:"varint,7,opt,name=distributionInterval,proto3" json:"distributionInterval,omitempty"` } func (m *MsgUpdateIncentiveParams) Reset() { *m = MsgUpdateIncentiveParams{} } @@ -241,30 +238,16 @@ func (m *MsgUpdateIncentiveParams) GetAuthority() string { return "" } -func (m *MsgUpdateIncentiveParams) GetWithdrawAddrEnabled() bool { +func (m *MsgUpdateIncentiveParams) GetElysStakeSnapInterval() int64 { if m != nil { - return m.WithdrawAddrEnabled - } - return false -} - -func (m *MsgUpdateIncentiveParams) GetElysStakeTrackingRate() int64 { - if m != nil { - return m.ElysStakeTrackingRate + return m.ElysStakeSnapInterval } return 0 } -func (m *MsgUpdateIncentiveParams) GetDistributionEpochForStakers() int64 { +func (m *MsgUpdateIncentiveParams) GetDistributionInterval() int64 { if m != nil { - return m.DistributionEpochForStakers - } - return 0 -} - -func (m *MsgUpdateIncentiveParams) GetDistributionEpochForLps() int64 { - if m != nil { - return m.DistributionEpochForLps + return m.DistributionInterval } return 0 } @@ -537,65 +520,61 @@ func init() { func init() { proto.RegisterFile("elys/incentive/tx.proto", fileDescriptor_59dc3bedfb1cce84) } var fileDescriptor_59dc3bedfb1cce84 = []byte{ - // 921 bytes of a gzipped FileDescriptorProto + // 862 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xc6, 0xc1, 0x4d, 0x5e, 0x4b, 0xd2, 0x4e, 0x1a, 0xc5, 0x71, 0xa3, 0x8d, 0xe5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e, 0xf1, 0x29, 0x73, 0x48, 0xf2, 0x90, 0xc9, 0xbb, 0xea, 0x03, 0x4f, 0x61, 0xf5, 0xa2, - 0x0f, 0x48, 0xe1, 0x5e, 0xbb, 0x17, 0xac, 0x64, 0xc7, 0x0e, 0x84, 0x5b, 0xc8, 0xe6, 0x49, 0x95, - 0xb1, 0x95, 0xaf, 0xcd, 0xb6, 0x27, 0x55, 0xca, 0xf6, 0x39, 0x54, 0x70, 0x9f, 0x0f, 0x98, 0x8a, - 0x9e, 0xd6, 0xcd, 0xed, 0x75, 0x2b, 0x39, 0xab, 0x87, 0x80, 0x95, 0x0c, 0x01, 0x6b, 0x97, 0x53, - 0xb6, 0x33, 0xaf, 0x2b, 0xc1, 0x49, 0xcc, 0x73, 0x5d, 0xe9, 0xb7, 0x39, 0xd8, 0x68, 0x4b, 0x7f, - 0x17, 0x33, 0x97, 0x04, 0xcf, 0x58, 0x97, 0x33, 0x8f, 0x32, 0x7f, 0x2f, 0xce, 0xc2, 0x7b, 0xd7, - 0x4e, 0x73, 0x11, 0x97, 0xdf, 0x2a, 0x62, 0xf4, 0x11, 0x2c, 0xbb, 0x82, 0x44, 0x21, 0x75, 0x7a, - 0x84, 0xfa, 0xbd, 0x38, 0x67, 0x65, 0x67, 0x29, 0xdd, 0x7e, 0x1c, 0xed, 0xe6, 0x52, 0x33, 0x84, - 0xa5, 0x7d, 0xce, 0x83, 0xf6, 0x20, 0x50, 0x34, 0x0c, 0x28, 0x11, 0x68, 0x0d, 0x6e, 0x84, 0x9c, - 0x07, 0x1d, 0xea, 0x45, 0x19, 0x98, 0x77, 0x2a, 0x7a, 0xf9, 0xc4, 0x43, 0xdf, 0x02, 0xf4, 0x33, - 0xb3, 0x19, 0x9b, 0x6e, 0x8e, 0xa1, 0xf1, 0x8b, 0x91, 0x9b, 0x00, 0xa3, 0x22, 0xae, 0x9a, 0x00, - 0xdf, 0xc1, 0xed, 0x48, 0xe3, 0x05, 0x9b, 0xce, 0x73, 0xb9, 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9, 0xed, 0xfc, 0x13, + 0x1e, 0x1c, 0xec, 0x64, 0x3f, 0x69, 0xad, 0x0c, 0xc0, 0x4c, 0xcf, 0xea, 0xc7, 0x37, 0xf5, 0xbc, + 0x1a, 0x74, 0xb9, 0x26, 0x56, 0x07, 0x5d, 0xf2, 0x5c, 0x13, 0x74, 0xc5, 0xe5, 0x76, 0x9e, 0xbf, + 0xbe, 0xd0, 0x94, 0x37, 0x17, 0x9a, 0xf2, 0xef, 0x85, 0xa6, 0xfc, 0x7a, 0xa9, 0xe5, 0xde, 0x5c, + 0x6a, 0xb9, 0x7f, 0x2e, 0xb5, 0xdc, 0x0f, 0x7a, 0xaa, 0xb4, 0x25, 0xea, 0x3e, 0x41, 0x62, 0x4a, + 0xd9, 0x49, 0xb0, 0x30, 0x4e, 0xd3, 0xdf, 0x8d, 0xb2, 0xcc, 0x87, 0xa5, 0xe0, 0xe3, 0xed, 0x93, + 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x63, 0x68, 0x92, 0xa9, 0x56, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -932,15 +911,10 @@ func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.DistributionEpochForLps != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.DistributionEpochForLps)) - i-- - dAtA[i] = 0x50 - } - if m.DistributionEpochForStakers != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.DistributionEpochForStakers)) + if m.DistributionInterval != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DistributionInterval)) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x38 } { size := m.MaxEdenRewardAprLps.Size() @@ -951,7 +925,7 @@ func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x32 { size := m.MaxEdenRewardAprStakers.Size() i -= size @@ -961,11 +935,11 @@ func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a - if m.ElysStakeTrackingRate != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ElysStakeTrackingRate)) + dAtA[i] = 0x2a + if m.ElysStakeSnapInterval != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ElysStakeSnapInterval)) i-- - dAtA[i] = 0x30 + dAtA[i] = 0x20 } { size := m.RewardPortionForStakers.Size() @@ -976,7 +950,7 @@ func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x1a { size := m.RewardPortionForLps.Size() i -= size @@ -986,26 +960,6 @@ func (m *MsgUpdateIncentiveParams) MarshalToSizedBuffer(dAtA []byte) (int, error 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) @@ -1323,27 +1277,19 @@ func (m *MsgUpdateIncentiveParams) Size() (n int) { 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)) l = m.RewardPortionForStakers.Size() n += 1 + l + sovTx(uint64(l)) - if m.ElysStakeTrackingRate != 0 { - n += 1 + sovTx(uint64(m.ElysStakeTrackingRate)) + if m.ElysStakeSnapInterval != 0 { + n += 1 + sovTx(uint64(m.ElysStakeSnapInterval)) } 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)) + if m.DistributionInterval != 0 { + n += 1 + sovTx(uint64(m.DistributionInterval)) } return n } @@ -1827,60 +1773,6 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { 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) } @@ -1914,7 +1806,7 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardPortionForStakers", wireType) } @@ -1948,11 +1840,11 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeTrackingRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeSnapInterval", wireType) } - m.ElysStakeTrackingRate = 0 + m.ElysStakeSnapInterval = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1962,12 +1854,12 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ElysStakeTrackingRate |= int64(b&0x7F) << shift + m.ElysStakeSnapInterval |= int64(b&0x7F) << shift if b < 0x80 { break } } - case 7: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprStakers", wireType) } @@ -2001,7 +1893,7 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprLps", wireType) } @@ -2035,30 +1927,11 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: - 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 10: + case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForLps", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DistributionInterval", wireType) } - m.DistributionEpochForLps = 0 + m.DistributionInterval = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2068,7 +1941,7 @@ func (m *MsgUpdateIncentiveParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DistributionEpochForLps |= int64(b&0x7F) << shift + m.DistributionInterval |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/parameter/types/keys.go b/x/parameter/types/keys.go index 77e3b500e..63a5e6c40 100644 --- a/x/parameter/types/keys.go +++ b/x/parameter/types/keys.go @@ -41,9 +41,6 @@ const ( // 31540000s per year SecondsPerYear = 31540000 - // One day seconds - SecondsPerDay = 86400 - // Days per year DaysPerYear = 365 diff --git a/x/parameter/types/params.go b/x/parameter/types/params.go index ed92a18d1..891297d1d 100644 --- a/x/parameter/types/params.go +++ b/x/parameter/types/params.go @@ -2,25 +2,9 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// Parameter keys -var ( - KeyMinCommissionRate = []byte("MinCommissionRate") - KeyMaxVotingPower = []byte("MaxVotingPower") - KeyMinSelfDelegation = []byte("MinSelfDelegation") - KeyBrokerAddress = []byte("BrokerAddress") -) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance func NewParams(minCommissionRate sdk.Dec, maxVotingPower sdk.Dec, minSelfDelegation sdk.Int, brokerAddress string) Params { return Params{ @@ -41,16 +25,6 @@ func DefaultParams() Params { ) } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyMinCommissionRate, &p.MinCommissionRate, validateMinCommissionRate), - paramtypes.NewParamSetPair(KeyMaxVotingPower, &p.MaxVotingPower, validateMaxVotingPower), - paramtypes.NewParamSetPair(KeyMinSelfDelegation, &p.MinSelfDelegation, validateMinSelfDelegation), - paramtypes.NewParamSetPair(KeyBrokerAddress, &p.BrokerAddress, validateBrokerAddress), - } -} - // Validate validates the set of params func (p Params) Validate() error { if err := validateMinCommissionRate(p.MinCommissionRate); err != nil {