Skip to content

Commit

Permalink
fix: 🐛 incentive store issue (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond authored May 4, 2023
1 parent 8451802 commit a688aef
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
49 changes: 25 additions & 24 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ import (
tokenomicsmodulekeeper "github.com/elys-network/elys/x/tokenomics/keeper"
tokenomicsmoduletypes "github.com/elys-network/elys/x/tokenomics/types"

// incentivemodule "github.com/elys-network/elys/x/incentive"
// incentivemodulekeeper "github.com/elys-network/elys/x/incentive/keeper"
// incentivemoduletypes "github.com/elys-network/elys/x/incentive/types"
incentivemodule "github.com/elys-network/elys/x/incentive"
incentivemodulekeeper "github.com/elys-network/elys/x/incentive/keeper"
incentivemoduletypes "github.com/elys-network/elys/x/incentive/types"

burnermodule "github.com/elys-network/elys/x/burner"
burnermodulekeeper "github.com/elys-network/elys/x/burner/keeper"
Expand Down Expand Up @@ -196,7 +196,7 @@ var (
oraclemodule.AppModuleBasic{},
commitmentmodule.AppModuleBasic{},
tokenomicsmodule.AppModuleBasic{},
// incentivemodule.AppModuleBasic{},
incentivemodule.AppModuleBasic{},
burnermodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)
Expand All @@ -212,6 +212,7 @@ var (
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
commitmentmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
incentivemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
burnermoduletypes.ModuleName: {authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
Expand Down Expand Up @@ -285,7 +286,7 @@ type ElysApp struct {

TokenomicsKeeper tokenomicsmodulekeeper.Keeper

// IncentiveKeeper incentivemodulekeeper.Keeper
IncentiveKeeper incentivemodulekeeper.Keeper

BurnerKeeper burnermodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration
Expand Down Expand Up @@ -338,7 +339,7 @@ func NewElysApp(
oracletypes.StoreKey,
commitmentmoduletypes.StoreKey,
tokenomicsmoduletypes.StoreKey,
// incentivemoduletypes.StoreKey,
incentivemoduletypes.StoreKey,
burnermoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
Expand Down Expand Up @@ -587,19 +588,19 @@ func NewElysApp(
app.AssetprofileKeeper,
)

// app.IncentiveKeeper = *incentivemodulekeeper.NewKeeper(
// appCodec,
// keys[incentivemoduletypes.StoreKey],
// keys[incentivemoduletypes.MemStoreKey],
// app.GetSubspace(incentivemoduletypes.ModuleName),
// commitmentKeeper,
// app.StakingKeeper,
// )
// incentiveModule := incentivemodule.NewAppModule(appCodec, app.IncentiveKeeper)
app.IncentiveKeeper = *incentivemodulekeeper.NewKeeper(
appCodec,
keys[incentivemoduletypes.StoreKey],
keys[incentivemoduletypes.MemStoreKey],
app.GetSubspace(incentivemoduletypes.ModuleName),
commitmentKeeper,
app.StakingKeeper,
)
incentiveModule := incentivemodule.NewAppModule(appCodec, app.IncentiveKeeper)

app.CommitmentKeeper = *commitmentKeeper.SetHooks(
commitmentmodulekeeper.NewMultiEpochHooks(
// app.IncentiveKeeper.CommitmentHooks(),
app.IncentiveKeeper.CommitmentHooks(),
),
)

Expand Down Expand Up @@ -662,7 +663,7 @@ func NewElysApp(
// insert staking hooks receivers here
app.DistrKeeper.Hooks(),
app.SlashingKeeper.Hooks(),
// app.IncentiveKeeper.StakingHooks(),
app.IncentiveKeeper.StakingHooks(),
),
)

Expand All @@ -677,7 +678,7 @@ func NewElysApp(
// insert epoch hooks receivers here
app.OracleKeeper.Hooks(),
app.CommitmentKeeper.Hooks(),
// app.IncentiveKeeper.Hooks(),
app.IncentiveKeeper.Hooks(),
app.BurnerKeeper.Hooks(),
),
)
Expand Down Expand Up @@ -722,7 +723,7 @@ func NewElysApp(
oracleModule,
commitmentModule,
tokenomicsModule,
// incentiveModule,
incentiveModule,
burnerModule,
// this line is used by starport scaffolding # stargate/app/appModule
)
Expand Down Expand Up @@ -760,7 +761,7 @@ func NewElysApp(
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// incentivemoduletypes.ModuleName,
incentivemoduletypes.ModuleName,
burnermoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)
Expand Down Expand Up @@ -793,7 +794,7 @@ func NewElysApp(
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// incentivemoduletypes.ModuleName,
incentivemoduletypes.ModuleName,
burnermoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)
Expand Down Expand Up @@ -830,7 +831,7 @@ func NewElysApp(
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// incentivemoduletypes.ModuleName,
incentivemoduletypes.ModuleName,
burnermoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)
Expand Down Expand Up @@ -867,7 +868,7 @@ func NewElysApp(
oracleModule,
commitmentModule,
tokenomicsModule,
// incentiveModule,
incentiveModule,
burnerModule,
// this line is used by starport scaffolding # stargate/app/appModule
)
Expand Down Expand Up @@ -1080,7 +1081,7 @@ 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(incentivemoduletypes.ModuleName)
paramsKeeper.Subspace(burnermoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

Expand Down
4 changes: 2 additions & 2 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
m "github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
incentivemoduletypes "github.com/elys-network/elys/x/incentive/types"
)

func SetupHandlers(app *ElysApp) {
Expand All @@ -30,8 +31,7 @@ func loadUpgradeStore(app *ElysApp) {

if shouldLoadUpgradeStore(app, upgradeInfo) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{"burner"},
Deleted: []string{"incentive"},
Added: []string{incentivemoduletypes.StoreKey},
}
// Use upgrade store loader for the initial loading of all stores when app starts,
// it checks if version == upgradeHeight and applies store upgrades before loading the stores,
Expand Down
2 changes: 1 addition & 1 deletion x/incentive/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const (
ModuleName = "incentive"

// StoreKey defines the primary module store key
StoreKey = ModuleName
StoreKey = ModuleName + "_store"

// RouterKey defines the module's message routing key
RouterKey = ModuleName
Expand Down

0 comments on commit a688aef

Please sign in to comment.