Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: keep the directory structure with the main branch code always #372

Merged
merged 7 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions modules/nft/handler.go

This file was deleted.

12 changes: 3 additions & 9 deletions modules/nft/genesis.go → modules/nft/keeper/genesis.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package nft
package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/irisnet/irismod/modules/nft/keeper"
"github.com/irisnet/irismod/modules/nft/types"
)

// InitGenesis stores the NFT genesis.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) {
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
if err := types.ValidateGenesis(data); err != nil {
panic(err.Error())
}
Expand All @@ -24,11 +23,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) {
}

// ExportGenesis returns a GenesisState for a given context and keeper.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
return types.NewGenesisState(k.GetCollections(ctx))
}

// DefaultGenesisState returns a default genesis state
func DefaultGenesisState() *types.GenesisState {
return types.NewGenesisState([]types.Collection{})
}
16 changes: 4 additions & 12 deletions modules/nft/module.go → modules/nft/module/module.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nft
package module

import (
"context"
Expand Down Expand Up @@ -44,7 +44,7 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {

// DefaultGenesis returns default genesis state as raw bytes for the NFT module.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(DefaultGenesisState())
return cdc.MustMarshalJSON(types.NewGenesisState([]types.Collection{}))
}

// ValidateGenesis performs genesis state validation for the NFT module.
Expand Down Expand Up @@ -130,27 +130,19 @@ func (am AppModule) InitGenesis(

cdc.MustUnmarshalJSON(data, &genesisState)

InitGenesis(ctx, am.keeper, genesisState)
am.keeper.InitGenesis(ctx, genesisState)
return []abci.ValidatorUpdate{}
}

// ExportGenesis returns the exported genesis state as raw bytes for the NFT module.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
gs := ExportGenesis(ctx, am.keeper)
gs := am.keeper.ExportGenesis(ctx)
return cdc.MustMarshalJSON(gs)
}

// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 1 }

// BeginBlock performs a no-op.
func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}

// EndBlock returns the end blocker for the NFT module. It returns no validator updates.
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}

// ____________________________________________________________________________

// AppModuleSimulation functions
Expand Down
2 changes: 1 addition & 1 deletion simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ import (
"github.com/irisnet/irismod/modules/mt"
mtkeeper "github.com/irisnet/irismod/modules/mt/keeper"
mttypes "github.com/irisnet/irismod/modules/mt/types"
"github.com/irisnet/irismod/modules/nft"
nftkeeper "github.com/irisnet/irismod/modules/nft/keeper"
nft "github.com/irisnet/irismod/modules/nft/module"
nfttypes "github.com/irisnet/irismod/modules/nft/types"
"github.com/irisnet/irismod/modules/oracle"
oracleKeeper "github.com/irisnet/irismod/modules/oracle/keeper"
Expand Down