7369264f0a
* Add proto files for onboarding module * Add general files for onboarding module * Add keeper files for onboarding module * Add module files for onboarding module * Update proto files * Add generated proto bindings * Use Keeper pointer in depinject * Fix lint errors
60 lines
1.4 KiB
Go
60 lines
1.4 KiB
Go
package module
|
|
|
|
import (
|
|
"cosmossdk.io/core/address"
|
|
"cosmossdk.io/core/appmodule"
|
|
"cosmossdk.io/core/store"
|
|
"cosmossdk.io/depinject"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
|
|
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/onboarding/module/v1"
|
|
"git.vdb.to/cerc-io/laconicd/x/onboarding/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
|
|
|
|
Cdc codec.Codec
|
|
StoreService store.KVStoreService
|
|
AddressCodec address.Codec
|
|
|
|
Config *modulev1.Module
|
|
}
|
|
|
|
type ModuleOutputs struct {
|
|
depinject.Out
|
|
|
|
Module appmodule.AppModule
|
|
Keeper *keeper.Keeper
|
|
}
|
|
|
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
|
// default to governance as authority if not provided
|
|
authority := authtypes.NewModuleAddress("gov")
|
|
if in.Config.Authority != "" {
|
|
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
|
|
}
|
|
|
|
k := keeper.NewKeeper(in.Cdc, in.AddressCodec, in.StoreService, authority.String())
|
|
m := NewAppModule(in.Cdc, k)
|
|
|
|
return ModuleOutputs{Module: m, Keeper: k}
|
|
}
|