mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 14:35:47 +00:00
chore(wip): update module definition in module.go
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
8a8f35e9ad
commit
1d89241599
@ -552,7 +552,7 @@ func New(
|
||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
homePath,
|
||||
)
|
||||
machineModule := machinemodule.NewAppModule(appCodec, app.MachineKeeper, app.AccountKeeper, app.BankKeeper)
|
||||
machineModule := machinemodule.NewAppModule(appCodec, app.MachineKeeper, app.AccountKeeper, app.BankKeeper, interfaceRegistry)
|
||||
|
||||
app.AssetKeeper = *assetmodulekeeper.NewKeeper(
|
||||
appCodec,
|
||||
|
||||
@ -11,10 +11,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/depinject"
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/planetmint/planetmint-go/x/machine/client/cli"
|
||||
@ -27,6 +32,12 @@ var (
|
||||
_ module.AppModuleBasic = AppModuleBasic{}
|
||||
)
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// AppModuleBasic
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -96,6 +107,7 @@ type AppModule struct {
|
||||
keeper keeper.Keeper
|
||||
accountKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
registry cdctypes.InterfaceRegistry
|
||||
}
|
||||
|
||||
func NewAppModule(
|
||||
@ -103,12 +115,14 @@ func NewAppModule(
|
||||
keeper keeper.Keeper,
|
||||
accountKeeper types.AccountKeeper,
|
||||
bankKeeper types.BankKeeper,
|
||||
registry cdctypes.InterfaceRegistry,
|
||||
) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: NewAppModuleBasic(cdc),
|
||||
keeper: keeper,
|
||||
accountKeeper: accountKeeper,
|
||||
bankKeeper: bankKeeper,
|
||||
registry: registry,
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,3 +174,47 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {
|
||||
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//
|
||||
// App Wiring Setup
|
||||
//
|
||||
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&types.Module{},
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
type MachineInputs struct {
|
||||
depinject.In
|
||||
Config *types.Module
|
||||
Key *store.KVStoreKey
|
||||
Cdc codec.Codec
|
||||
AccountKeeper types.AccountKeeper
|
||||
BankKeeper types.BankKeeper
|
||||
Registry cdctypes.InterfaceRegistry
|
||||
MsgServiceRouter *baseapp.MsgServiceRouter
|
||||
|
||||
storeKey store.StoreKey
|
||||
taIndexStoreKey store.StoreKey
|
||||
issuerPlanetmintIndexStoreKey store.StoreKey
|
||||
issuerLiquidIndexStoreKey store.StoreKey
|
||||
taStoreKey store.StoreKey
|
||||
addressIndexStoreKey store.StoreKey
|
||||
memKey store.StoreKey
|
||||
paramstore paramtypes.Subspace
|
||||
authority string
|
||||
rootDir string
|
||||
}
|
||||
type MachineOutputs struct {
|
||||
depinject.Out
|
||||
MachineKeeper keeper.Keeper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in MachineInputs) MachineOutputs {
|
||||
k := keeper.NewKeeper(in.Cdc, in.storeKey, in.taIndexStoreKey, in.issuerPlanetmintIndexStoreKey, in.issuerLiquidIndexStoreKey, in.taStoreKey, in.addressIndexStoreKey, in.memKey, in.paramstore, in.authority, in.rootDir)
|
||||
m := NewAppModule(in.Cdc, *k, in.AccountKeeper, in.BankKeeper, in.Registry)
|
||||
return MachineOutputs{MachineKeeper: *k, Module: m}
|
||||
}
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
package module
|
||||
|
||||
// import (
|
||||
// "cosmossdk.io/core/appmodule"
|
||||
// "cosmossdk.io/depinject"
|
||||
// "github.com/cosmos/cosmos-sdk/baseapp"
|
||||
// "github.com/cosmos/cosmos-sdk/x/group"
|
||||
// "github.com/gogo/protobuf/codec"
|
||||
// "github.com/planetmint/planetmint-go/x/machine/keeper"
|
||||
// modulev1 "github.com/planetmint/planetmint-go/x/machine/types"
|
||||
// )
|
||||
|
||||
// func init() {
|
||||
// appmodule.Register(
|
||||
// &modulev1.Module{},
|
||||
// appmodule.Provide(ProvideModule),
|
||||
// )
|
||||
// }
|
||||
|
||||
// type MachineInputs struct {
|
||||
// depinject.In
|
||||
// Config *modulev1.Module
|
||||
// Key *store.KVStoreKey
|
||||
// Cdc codec.Codec
|
||||
// AccountKeeper machine.AccountKeeper
|
||||
// BankKeeper machine.BankKeeper
|
||||
// Registry cdctypes.InterfaceRegistry
|
||||
// MsgServiceRouter *baseapp.MsgServiceRouter
|
||||
// }
|
||||
// type MachineOutputs struct {
|
||||
// depinject.Out
|
||||
// MachineKeeper keeper.Keeper
|
||||
// Module appmodule.AppModule
|
||||
// }
|
||||
|
||||
// func ProvideModule(in MachineInputs) MachineOutputs {
|
||||
// /*
|
||||
// Example of setting machine params:
|
||||
// in.Config.MaxMetadataLen = 1000
|
||||
// in.Config.MaxExecutionPeriod = "1209600s"
|
||||
// */
|
||||
// k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper, group.Config{MaxExecutionPeriod: in.Config.MaxExecutionPeriod.AsDuration(), MaxMetadataLen: in.Config.MaxMetadataLen})
|
||||
// m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.Registry)
|
||||
// return MachineOutputs{MachineKeeper: k, Module: m}
|
||||
// }
|
||||
@ -11,6 +11,7 @@ import (
|
||||
_ "github.com/cosmos/cosmos-sdk/x/params"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/staking"
|
||||
_ "github.com/planetmint/planetmint-go/x/machine"
|
||||
|
||||
"cosmossdk.io/core/appconfig"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user