Skip to content

Commit

Permalink
feat: add group module
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 committed Oct 12, 2023
1 parent 2cadb6a commit b152c26
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import (
"github.com/OmniFlix/omniflixhub/v2/x/globalfee"
globalfeekeeper "github.com/OmniFlix/omniflixhub/v2/x/globalfee/keeper"

"github.com/cosmos/cosmos-sdk/x/group"
groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"

Expand Down Expand Up @@ -121,6 +123,7 @@ type AppKeepers struct {
AuthzKeeper authzkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
GlobalFeeKeeper globalfeekeeper.Keeper
GroupKeeper groupkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -324,6 +327,16 @@ func NewAppKeeper(
// register the governance hooks
),
)

groupConfig := group.DefaultConfig()
appKeepers.GroupKeeper = groupkeeper.NewKeeper(
keys[group.StoreKey],
appCodec,
bApp.MsgServiceRouter(),
appKeepers.AccountKeeper,
groupConfig,
)

// initialize ibc packet forwarding middleware router
appKeepers.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
appCodec, appKeepers.keys[packetforwardtypes.StoreKey],
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/group"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
Expand Down Expand Up @@ -51,6 +52,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
crisistypes.StoreKey,
feegrant.StoreKey,
globalfeetypes.StoreKey,
group.StoreKey,
authzkeeper.StoreKey,
alloctypes.StoreKey,
onfttypes.StoreKey,
Expand Down
16 changes: 16 additions & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/group"

"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand Down Expand Up @@ -40,6 +41,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

// "github.com/cosmos/cosmos-sdk/x/group"
// groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"

"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"

Expand Down Expand Up @@ -95,6 +100,7 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(getGovProposalHandlers()),
groupmodule.AppModuleBasic{},
params.AppModuleBasic{},
consensus.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down Expand Up @@ -161,6 +167,13 @@ func appModules(
app.BankKeeper,
app.GetSubspace(govtypes.ModuleName),
),
groupmodule.NewAppModule(
appCodec,
app.GroupKeeper,
app.AccountKeeper,
app.BankKeeper,
app.interfaceRegistry,
),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
slashing.NewAppModule(
appCodec,
Expand Down Expand Up @@ -278,6 +291,7 @@ func orderBeginBlockers() []string {
crisistypes.ModuleName,
feegrant.ModuleName,
globalfee.ModuleName,
group.ModuleName,
onfttypes.ModuleName,
marketplacetypes.ModuleName,
streampaytypes.ModuleName,
Expand Down Expand Up @@ -308,6 +322,7 @@ func orderEndBlockers() []string {
ibcexported.ModuleName,
feegrant.ModuleName,
globalfee.ModuleName,
group.ModuleName,
authz.ModuleName,
alloctypes.ModuleName,
onfttypes.ModuleName,
Expand Down Expand Up @@ -346,6 +361,7 @@ func orderInitGenesis() []string {
vestingtypes.ModuleName,
feegrant.ModuleName,
globalfee.ModuleName,
group.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
Expand Down

0 comments on commit b152c26

Please sign in to comment.