Skip to content

Commit

Permalink
chore: module code style
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Feb 8, 2024
1 parent 8e3d439 commit 5e2afab
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions x/collection/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ import (
"github.com/Finschia/finschia-sdk/x/collection/keeper"
)

// ConsensusVersion defines the current x/collection module consensus version.
const ConsensusVersion = 2

var (
_ module.AppModuleBasic = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}

_ appmodule.AppModule = AppModule{}
)
Expand All @@ -44,6 +48,11 @@ func (AppModuleBasic) Name() string {
// RegisterLegacyAminoCodec registers the collection types on the LegacyAmino codec
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}

// RegisterInterfaces registers the collection module's interface types
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
collection.RegisterInterfaces(registry)
}

// DefaultGenesis returns default genesis state as raw bytes for the collection
// module.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
Expand Down Expand Up @@ -77,10 +86,6 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.NewTxCmd()
}

func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
collection.RegisterInterfaces(registry)
}

// ____________________________________________________________________________

// AppModule implements an application module for the collection module.
Expand All @@ -90,21 +95,18 @@ type AppModule struct {
keeper keeper.Keeper
}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
return AppModule{
keeper: keeper,
}
}

// RegisterInvariants does nothing, there are no invariants to enforce
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}

// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
Expand Down Expand Up @@ -137,7 +139,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

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

//
// App Wiring Setup
//

func init() {
appmodule.Register(&modulev1.Module{},
Expand Down

0 comments on commit 5e2afab

Please sign in to comment.