laconicd/x/bond/module/depinject.go
prathamesh0 5ee988ccd8
Setup and integrate bond module into the chain (#2)
* Add common message types and update proto gen script

* Update proto gen script to generate pulsar proto code

* Upgrade direct deps

* Populate params and genesis files

* Setup keeper files

* Setup module files with depinject and autocli

* Add placeholder keeper methods

* Integrate bond module into the chain
2024-02-01 16:28:34 +05:30

49 lines
989 B
Go

package module
import (
"cosmossdk.io/core/appmodule"
"cosmossdk.io/depinject"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/bond/module/v1"
"git.vdb.to/cerc-io/laconic2d/x/bond/keeper"
)
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
func init() {
appmodule.Register(
&modulev1.Module{},
appmodule.Provide(ProvideModule),
)
}
type ModuleInputs struct {
depinject.In
Key *storetypes.KVStoreKey
Cdc codec.Codec
}
type ModuleOutputs struct {
depinject.Out
Keeper keeper.Keeper
Module appmodule.AppModule
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
k := keeper.NewKeeper(in.Cdc, in.Key)
m := NewAppModule(in.Cdc, k)
return ModuleOutputs{Module: m, Keeper: k}
}