-
Notifications
You must be signed in to change notification settings - Fork 127
/
moudle.go
53 lines (43 loc) · 1.27 KB
/
moudle.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
package evm
import (
"github.com/cosmos/cosmos-sdk/types/module"
ethermint "github.com/evmos/ethermint/x/evm"
"github.com/evmos/ethermint/x/evm/keeper"
"github.com/evmos/ethermint/x/evm/types"
)
var (
_ module.AppModule = AppModule{}
)
// ____________________________________________________________________________
// AppModule implements an application module for the evm module.
type AppModule struct {
ethermint.AppModule
k *Keeper
ss types.Subspace
}
// NewAppModule creates a new AppModule object
func NewAppModule(
k *keeper.Keeper,
ak types.AccountKeeper,
bankKeeper types.BankKeeper,
ss types.Subspace,
) AppModule {
return AppModule{
AppModule: ethermint.NewAppModule(k, ak, ss),
k: &Keeper{k, bankKeeper},
ss: ss,
}
}
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.k)
types.RegisterQueryServer(cfg.QueryServer(), am.k.evmkeeper)
m := keeper.NewMigrator(*am.k.evmkeeper, am.ss)
if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil {
panic(err)
}
if err := cfg.RegisterMigration(types.ModuleName, 4, m.Migrate4to5); err != nil {
panic(err)
}
}