Skip to content

Commit

Permalink
Merge pull request #756 from cybercongress/v4-nft-module
Browse files Browse the repository at this point in the history
Added NFT module
  • Loading branch information
cyborgshead authored Jul 24, 2024
2 parents 6bd72af + 77252dd commit 563c22c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 29 deletions.
7 changes: 7 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package keepers

import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/nft"
nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
tokenfactorykeeper "github.com/cybercongress/go-cyber/v4/x/tokenfactory/keeper"
tokenfactorytypes "github.com/cybercongress/go-cyber/v4/x/tokenfactory/types"
"path/filepath"
Expand Down Expand Up @@ -105,6 +107,7 @@ var maccPerms = map[string][]string{
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
nft.ModuleName: nil,
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
Expand Down Expand Up @@ -137,6 +140,7 @@ type AppKeepers struct {
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
NFTKeeper nftkeeper.Keeper
AuthzKeeper authzkeeper.Keeper

ConsensusParamsKeeper consensusparamkeeper.Keeper
Expand Down Expand Up @@ -422,6 +426,9 @@ func NewAppKeepers(
govtypes.DefaultConfig(),
govModAddress,
)

appKeepers.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, appKeepers.AccountKeeper, appKeepers.CyberbankKeeper.Proxy)

appKeepers.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register governance hooks
Expand Down
3 changes: 2 additions & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/feegrant"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand All @@ -41,7 +42,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey,
authzkeeper.StoreKey, feegrant.StoreKey,
authzkeeper.StoreKey, feegrant.StoreKey, nftkeeper.StoreKey,
consensusparamtypes.StoreKey, crisistypes.StoreKey,

ibcexported.StoreKey,
Expand Down
65 changes: 37 additions & 28 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/nft"
nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"
sdkparams "github.com/cosmos/cosmos-sdk/x/params"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/slashing"
Expand Down Expand Up @@ -93,6 +95,7 @@ var ModuleBasics = module.NewBasicManager(
authzmodule.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
vesting.AppModuleBasic{},
nftmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
ibcfee.AppModuleBasic{},
transfer.AppModuleBasic{},
Expand Down Expand Up @@ -140,6 +143,7 @@ func appModules(
ibc.NewAppModule(app.IBCKeeper),
sdkparams.NewAppModule(app.ParamsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.CyberbankKeeper.Proxy, app.interfaceRegistry),
nftmodule.NewAppModule(appCodec, app.AppKeepers.NFTKeeper, app.AppKeepers.AccountKeeper, app.CyberbankKeeper.Proxy, app.interfaceRegistry),
transfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
crisis.NewAppModule(app.AppKeepers.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
Expand Down Expand Up @@ -199,31 +203,33 @@ func orderBeginBlockers() []string {
// upgrades should be run first
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
stakingtypes.ModuleName,
liquiditytypes.ModuleName,
minttypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
evidencetypes.ModuleName,
dmntypes.ModuleName,
consensusparamtypes.ModuleName,
stakingtypes.ModuleName,
authtypes.ModuleName,
authz.ModuleName,
banktypes.ModuleName,
bandwidthtypes.ModuleName,
govtypes.ModuleName,
crisistypes.ModuleName,
cyberbanktypes.ModuleName,
feegrant.ModuleName,
genutiltypes.ModuleName,
govtypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
nft.ModuleName,
consensusparamtypes.ModuleName,
// additional modules
liquiditytypes.ModuleName,
dmntypes.ModuleName,
bandwidthtypes.ModuleName,
cyberbanktypes.ModuleName,
graphtypes.ModuleName,
gridtypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
paramstypes.ModuleName,
ranktypes.ModuleName,
resourcestypes.ModuleName,
vestingtypes.ModuleName,
ibcfeetypes.ModuleName,
tokenfactorytypes.ModuleName,
wasm.ModuleName,
Expand All @@ -235,33 +241,35 @@ func orderEndBlockers() []string {
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
liquiditytypes.ModuleName,
cyberbanktypes.ModuleName,
bandwidthtypes.ModuleName,
graphtypes.ModuleName,
ranktypes.ModuleName,
consensusparamtypes.ModuleName,
capabilitytypes.ModuleName,
authtypes.ModuleName,
authz.ModuleName,
banktypes.ModuleName,
capabilitytypes.ModuleName,
distrtypes.ModuleName,
dmntypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
genutiltypes.ModuleName,
gridtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
minttypes.ModuleName,
paramstypes.ModuleName,
resourcestypes.ModuleName,
slashingtypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
nft.ModuleName,
consensusparamtypes.ModuleName,
// additional modules
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
ibcfeetypes.ModuleName,
tokenfactorytypes.ModuleName,
graphtypes.ModuleName,
dmntypes.ModuleName,
gridtypes.ModuleName,
resourcestypes.ModuleName,
liquiditytypes.ModuleName,
wasm.ModuleName,
cyberbanktypes.ModuleName,
bandwidthtypes.ModuleName,
ranktypes.ModuleName,
}
}

Expand All @@ -283,6 +291,7 @@ func orderInitBlockers() []string {
upgradetypes.ModuleName,
vestingtypes.ModuleName,
feegrant.ModuleName,
nft.ModuleName,
consensusparamtypes.ModuleName,
// additional modules
ibctransfertypes.ModuleName,
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
"github.com/cosmos/cosmos-sdk/x/nft"
tokenfactorytypes "github.com/cybercongress/go-cyber/v4/x/tokenfactory/types"

resourcestypes "github.com/cybercongress/go-cyber/v4/x/resources/types"
Expand All @@ -22,6 +23,7 @@ var Upgrade = upgrades.Upgrade{
consensustypes.ModuleName,
resourcestypes.ModuleName,
tokenfactorytypes.ModuleName,
nft.ModuleName,
},
},
}

0 comments on commit 563c22c

Please sign in to comment.