69 lines
1.8 KiB
Go
69 lines
1.8 KiB
Go
package vesting
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"google.golang.org/grpc"
|
|
|
|
"cosmossdk.io/core/appmodule"
|
|
"cosmossdk.io/x/auth/keeper"
|
|
"cosmossdk.io/x/auth/vesting/client/cli"
|
|
"cosmossdk.io/x/auth/vesting/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
)
|
|
|
|
var (
|
|
_ module.AppModule = AppModule{}
|
|
_ module.HasName = AppModule{}
|
|
|
|
_ appmodule.AppModule = AppModule{}
|
|
)
|
|
|
|
// AppModule implementing the AppModule interface.
|
|
type AppModule struct {
|
|
accountKeeper keeper.AccountKeeper
|
|
bankKeeper types.BankKeeper
|
|
}
|
|
|
|
func NewAppModule(ak keeper.AccountKeeper, bk types.BankKeeper) AppModule {
|
|
return AppModule{
|
|
accountKeeper: ak,
|
|
bankKeeper: bk,
|
|
}
|
|
}
|
|
|
|
// IsAppModule implements the appmodule.AppModule interface.
|
|
func (am AppModule) IsAppModule() {}
|
|
|
|
// Name returns the module's name.
|
|
func (AppModule) Name() string {
|
|
return types.ModuleName
|
|
}
|
|
|
|
// RegisterCodec registers the module's types with the given codec.
|
|
func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
|
types.RegisterLegacyAminoCodec(cdc)
|
|
}
|
|
|
|
// RegisterInterfaces registers the module's interfaces and implementations with
|
|
// the given interface registry.
|
|
func (AppModule) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
|
types.RegisterInterfaces(registry)
|
|
}
|
|
|
|
// GetTxCmd returns the root tx command for the vesting module.
|
|
func (AppModule) GetTxCmd() *cobra.Command {
|
|
return cli.GetTxCmd()
|
|
}
|
|
|
|
// RegisterServices registers module services.
|
|
func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error {
|
|
types.RegisterMsgServer(registrar, NewMsgServerImpl(am.accountKeeper, am.bankKeeper))
|
|
return nil
|
|
}
|
|
|
|
// ConsensusVersion implements HasConsensusVersion.
|
|
func (AppModule) ConsensusVersion() uint64 { return 1 }
|