From 32c6bf80be92da3ff7ea08bc91793a8e1c866769 Mon Sep 17 00:00:00 2001 From: Marri Harish Date: Fri, 13 Oct 2023 19:28:02 +0530 Subject: [PATCH] feat: add group module (#100) --- app/keepers/keepers.go | 13 +++++++++++++ app/keepers/keys.go | 2 ++ app/modules.go | 16 ++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index fdfda755..8edaf36f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -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" @@ -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 @@ -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], diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 93d5f3a5..97fffee8 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -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" @@ -51,6 +52,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { crisistypes.StoreKey, feegrant.StoreKey, globalfeetypes.StoreKey, + group.StoreKey, authzkeeper.StoreKey, alloctypes.StoreKey, onfttypes.StoreKey, diff --git a/app/modules.go b/app/modules.go index 015f7a42..934bbe9e 100644 --- a/app/modules.go +++ b/app/modules.go @@ -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" @@ -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" @@ -95,6 +100,7 @@ var ( mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic(getGovProposalHandlers()), + groupmodule.AppModuleBasic{}, params.AppModuleBasic{}, consensus.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -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, @@ -278,6 +291,7 @@ func orderBeginBlockers() []string { crisistypes.ModuleName, feegrant.ModuleName, globalfee.ModuleName, + group.ModuleName, onfttypes.ModuleName, marketplacetypes.ModuleName, streampaytypes.ModuleName, @@ -308,6 +322,7 @@ func orderEndBlockers() []string { ibcexported.ModuleName, feegrant.ModuleName, globalfee.ModuleName, + group.ModuleName, authz.ModuleName, alloctypes.ModuleName, onfttypes.ModuleName, @@ -346,6 +361,7 @@ func orderInitGenesis() []string { vestingtypes.ModuleName, feegrant.ModuleName, globalfee.ModuleName, + group.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName,