/
module.go
77 lines (59 loc) · 2.1 KB
/
module.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package timerstore
import (
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/lavanet/lava/x/timerstore/client/cli"
timerstorekeeper "github.com/lavanet/lava/x/timerstore/keeper"
"github.com/lavanet/lava/x/timerstore/types"
"github.com/spf13/cobra"
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModule = AppModule{}
)
const (
ConsensusVersion = 1
)
// AppModuleBasic implements the module.AppModuleBasic interface for the downtime module.
type AppModuleBasic struct{}
func (a AppModuleBasic) Name() string {
return types.ModuleName
}
func (a AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {}
func (a AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {}
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {}
func (a AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
func (a AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd("")
}
// ---- AppModule
func NewAppModule(k *timerstorekeeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
k: k,
}
}
type AppModule struct {
AppModuleBasic
k *timerstorekeeper.Keeper
}
func (a AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
func (a AppModule) BeginBlock(context sdk.Context, _ abci.RequestBeginBlock) {
a.k.BeginBlock(context)
}
// EndBlock executes all ABCI EndBlock logic respective to the capability module. It
// returns no validator updates.
func (a AppModule) EndBlock(context sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
a.k.EndBlock(context)
return []abci.ValidatorUpdate{}
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterQueryServer(cfg.QueryServer(), am.k)
}