Skip to content

Commit

Permalink
Incentive refactor (#348)
Browse files Browse the repository at this point in the history
* incentive variables refactoring

* update for incentive module simplification

* Update comments for incentive module struct fields & update config.yml for elys_stake_snap_interval

* write incentive v9 migration script

* resolve unit test

* fix: missing module version increment

---------

Co-authored-by: Cosmic Vagabond <[email protected]>
  • Loading branch information
jelysn and cosmic-vagabond authored Jan 30, 2024
1 parent c1119b2 commit 7c374a8
Show file tree
Hide file tree
Showing 44 changed files with 902 additions and 1,363 deletions.
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ func NewElysApp(
appCodec,
keys[incentivemoduletypes.StoreKey],
keys[incentivemoduletypes.MemStoreKey],
app.GetSubspace(incentivemoduletypes.ModuleName),
commitmentKeeper,
app.StakingKeeper,
app.AccountKeeper,
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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() {
Expand Down
4 changes: 1 addition & 3 deletions architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 7c374a8

Please sign in to comment.