-
Notifications
You must be signed in to change notification settings - Fork 13
/
keepers.go
531 lines (481 loc) · 19.1 KB
/
keepers.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
package keepers
import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctransfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
srvflags "github.com/evmos/ethermint/server/flags"
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
"github.com/spf13/cast"
fxtypes "github.com/functionx/fx-core/v3/types"
avalanchetypes "github.com/functionx/fx-core/v3/x/avalanche/types"
bsctypes "github.com/functionx/fx-core/v3/x/bsc/types"
"github.com/functionx/fx-core/v3/x/crosschain"
crosschainkeeper "github.com/functionx/fx-core/v3/x/crosschain/keeper"
crosschaintypes "github.com/functionx/fx-core/v3/x/crosschain/types"
"github.com/functionx/fx-core/v3/x/erc20"
erc20keeper "github.com/functionx/fx-core/v3/x/erc20/keeper"
erc20types "github.com/functionx/fx-core/v3/x/erc20/types"
ethtypes "github.com/functionx/fx-core/v3/x/eth/types"
fxevmkeeper "github.com/functionx/fx-core/v3/x/evm/keeper"
fxgovkeeper "github.com/functionx/fx-core/v3/x/gov/keeper"
gravitykeeper "github.com/functionx/fx-core/v3/x/gravity/keeper"
gravitytypes "github.com/functionx/fx-core/v3/x/gravity/types"
fxtransfer "github.com/functionx/fx-core/v3/x/ibc/applications/transfer"
fxtransferkeeper "github.com/functionx/fx-core/v3/x/ibc/applications/transfer/keeper"
"github.com/functionx/fx-core/v3/x/ibc/ibcrouter"
migratekeeper "github.com/functionx/fx-core/v3/x/migrate/keeper"
migratetypes "github.com/functionx/fx-core/v3/x/migrate/types"
polygontypes "github.com/functionx/fx-core/v3/x/polygon/types"
tronkeeper "github.com/functionx/fx-core/v3/x/tron/keeper"
trontypes "github.com/functionx/fx-core/v3/x/tron/types"
)
type CrossChainKeepers struct {
BscKeeper crosschainkeeper.Keeper
PolygonKeeper crosschainkeeper.Keeper
AvalancheKeeper crosschainkeeper.Keeper
EthKeeper crosschainkeeper.Keeper
TronKeeper tronkeeper.Keeper
}
type AppKeepers struct {
legacyAmino *codec.LegacyAmino
appCodec codec.Codec
// keys to access the substores
keys map[string]*sdk.KVStoreKey
tkeys map[string]*sdk.TransientStoreKey
memKeys map[string]*sdk.MemoryStoreKey
// keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper fxgovkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
// IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCKeeper *ibckeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
FxTransferKeeper fxtransferkeeper.Keeper
IBCTransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
GravityMigrator gravitykeeper.Migrator
CrosschainKeeper crosschainkeeper.RouterKeeper
CrossChainKeepers
EvmKeeper *fxevmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper
Erc20Keeper erc20keeper.Keeper
MigrateKeeper migratekeeper.Keeper
}
func NewAppKeeper(
appCodec codec.Codec,
bApp *baseapp.BaseApp,
legacyAmino *codec.LegacyAmino,
maccPerms map[string][]string,
blockedAddress map[string]bool,
skipUpgradeHeights map[int64]bool,
homePath string,
invCheckPeriod uint,
appOpts servertypes.AppOptions,
) *AppKeepers {
appKeepers := &AppKeepers{
legacyAmino: legacyAmino,
appCodec: appCodec,
}
// Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey
appKeepers.generateKeys()
appKeepers.ParamsKeeper = initParamsKeeper(
appCodec,
legacyAmino,
appKeepers.keys[paramstypes.StoreKey],
appKeepers.tkeys[paramstypes.TStoreKey],
)
// set the BaseApp's parameter store
bApp.SetParamStore(
appKeepers.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()),
)
// add capability keeper and ScopeToModule for ibc module
appKeepers.CapabilityKeeper = capabilitykeeper.NewKeeper(
appCodec,
appKeepers.keys[capabilitytypes.StoreKey],
appKeepers.memKeys[capabilitytypes.MemStoreKey],
)
// grant capabilities for the ibc and ibc-transfer modules
appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
appKeepers.CapabilityKeeper.Seal()
appKeepers.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec,
appKeepers.keys[authtypes.StoreKey],
appKeepers.GetSubspace(authtypes.ModuleName),
authtypes.ProtoBaseAccount,
maccPerms,
)
appKeepers.AuthzKeeper = authzkeeper.NewKeeper(
appKeepers.keys[authzkeeper.StoreKey],
appCodec,
bApp.MsgServiceRouter(),
)
appKeepers.FeeGrantKeeper = feegrantkeeper.NewKeeper(
appCodec,
appKeepers.keys[feegrant.StoreKey],
appKeepers.AccountKeeper,
)
appKeepers.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
appKeepers.keys[banktypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.GetSubspace(banktypes.ModuleName),
blockedAddress,
)
stakingKeeper := stakingkeeper.NewKeeper(
appCodec,
appKeepers.keys[stakingtypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.GetSubspace(stakingtypes.ModuleName),
)
appKeepers.MintKeeper = mintkeeper.NewKeeper(
appCodec,
appKeepers.keys[minttypes.StoreKey],
appKeepers.GetSubspace(minttypes.ModuleName),
&stakingKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
authtypes.FeeCollectorName,
)
appKeepers.DistrKeeper = distrkeeper.NewKeeper(
appCodec,
appKeepers.keys[distrtypes.StoreKey],
appKeepers.GetSubspace(distrtypes.ModuleName),
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
&stakingKeeper,
authtypes.FeeCollectorName,
blockedAddress,
)
appKeepers.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec,
appKeepers.keys[slashingtypes.StoreKey],
&stakingKeeper,
appKeepers.GetSubspace(slashingtypes.ModuleName),
)
appKeepers.CrisisKeeper = crisiskeeper.NewKeeper(
appKeepers.GetSubspace(crisistypes.ModuleName),
invCheckPeriod,
appKeepers.BankKeeper,
authtypes.FeeCollectorName,
)
appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper(
skipUpgradeHeights,
appKeepers.keys[upgradetypes.StoreKey],
appCodec,
homePath,
bApp,
)
appKeepers.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
appKeepers.keys[ibchost.StoreKey],
appKeepers.GetSubspace(ibchost.ModuleName),
stakingKeeper,
appKeepers.UpgradeKeeper,
appKeepers.ScopedIBCKeeper,
)
appKeepers.IBCTransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.ScopedTransferKeeper,
)
appKeepers.FxTransferKeeper = fxtransferkeeper.NewKeeper(
appKeepers.IBCTransferKeeper,
appCodec,
appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.ScopedTransferKeeper,
)
appKeepers.FeeMarketKeeper = feemarketkeeper.NewKeeper(
appCodec,
appKeepers.GetSubspace(feemarkettypes.ModuleName),
appKeepers.keys[feemarkettypes.StoreKey],
appKeepers.tkeys[feemarkettypes.TransientKey],
)
appKeepers.EvmKeeper = fxevmkeeper.NewKeeper(
evmkeeper.NewKeeper(
appCodec,
appKeepers.keys[evmtypes.StoreKey],
appKeepers.tkeys[evmtypes.TransientKey],
appKeepers.GetSubspace(evmtypes.ModuleName),
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
stakingKeeper,
appKeepers.FeeMarketKeeper,
cast.ToString(appOpts.Get(srvflags.EVMTracer)),
),
appKeepers.AccountKeeper,
)
erc20Keeper := erc20keeper.NewKeeper(
appKeepers.keys[erc20types.StoreKey],
appCodec,
appKeepers.GetSubspace(erc20types.ModuleName),
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.EvmKeeper,
appKeepers.IBCTransferKeeper,
)
appKeepers.GravityMigrator = gravitykeeper.NewMigrator(
appCodec,
legacyAmino,
appKeepers.keys[paramstypes.StoreKey],
appKeepers.keys[gravitytypes.StoreKey],
appKeepers.keys[ethtypes.StoreKey],
stakingKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
)
// init cross chain module
appKeepers.BscKeeper = crosschainkeeper.NewKeeper(
appCodec,
bsctypes.ModuleName,
appKeepers.keys[bsctypes.StoreKey],
appKeepers.GetSubspace(bsctypes.ModuleName),
stakingKeeper,
stakingkeeper.NewMsgServerImpl(stakingKeeper),
distrkeeper.NewMsgServerImpl(appKeepers.DistrKeeper),
appKeepers.BankKeeper,
appKeepers.IBCTransferKeeper,
erc20Keeper,
appKeepers.AccountKeeper,
)
appKeepers.PolygonKeeper = crosschainkeeper.NewKeeper(
appCodec,
polygontypes.ModuleName,
appKeepers.keys[polygontypes.StoreKey],
appKeepers.GetSubspace(polygontypes.ModuleName),
stakingKeeper,
stakingkeeper.NewMsgServerImpl(stakingKeeper),
distrkeeper.NewMsgServerImpl(appKeepers.DistrKeeper),
appKeepers.BankKeeper,
appKeepers.IBCTransferKeeper,
erc20Keeper,
appKeepers.AccountKeeper,
)
appKeepers.AvalancheKeeper = crosschainkeeper.NewKeeper(
appCodec,
avalanchetypes.ModuleName,
appKeepers.keys[avalanchetypes.StoreKey],
appKeepers.GetSubspace(avalanchetypes.ModuleName),
stakingKeeper,
stakingkeeper.NewMsgServerImpl(stakingKeeper),
distrkeeper.NewMsgServerImpl(appKeepers.DistrKeeper),
appKeepers.BankKeeper,
appKeepers.IBCTransferKeeper,
erc20Keeper,
appKeepers.AccountKeeper,
)
appKeepers.EthKeeper = crosschainkeeper.NewKeeper(
appCodec,
ethtypes.ModuleName,
appKeepers.keys[ethtypes.StoreKey],
appKeepers.GetSubspace(ethtypes.ModuleName),
stakingKeeper,
stakingkeeper.NewMsgServerImpl(stakingKeeper),
distrkeeper.NewMsgServerImpl(appKeepers.DistrKeeper),
appKeepers.BankKeeper,
appKeepers.IBCTransferKeeper,
erc20Keeper,
appKeepers.AccountKeeper,
)
appKeepers.TronKeeper = tronkeeper.NewKeeper(crosschainkeeper.NewKeeper(
appCodec,
trontypes.ModuleName,
appKeepers.keys[trontypes.StoreKey],
appKeepers.GetSubspace(trontypes.ModuleName),
stakingKeeper,
stakingkeeper.NewMsgServerImpl(stakingKeeper),
distrkeeper.NewMsgServerImpl(appKeepers.DistrKeeper),
appKeepers.BankKeeper,
appKeepers.IBCTransferKeeper,
erc20Keeper,
appKeepers.AccountKeeper,
))
// add cross-chain router
crosschainRouter := crosschainkeeper.NewRouter()
crosschainRouter.
AddRoute(bsctypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.BscKeeper)).
AddRoute(polygontypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.PolygonKeeper)).
AddRoute(avalanchetypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.AvalancheKeeper)).
AddRoute(ethtypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.EthKeeper)).
AddRoute(trontypes.ModuleName, tronkeeper.NewModuleHandler(appKeepers.TronKeeper))
appKeepers.CrosschainKeeper = crosschainkeeper.NewRouterKeeper(crosschainRouter)
// register the proposal types
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(appKeepers.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)).
AddRoute(crosschaintypes.RouterKey, crosschain.NewChainProposalHandler(appKeepers.CrosschainKeeper)).
AddRoute(erc20types.RouterKey, erc20.NewErc20ProposalHandler(erc20Keeper))
govKeeper := govkeeper.NewKeeper(
appCodec,
appKeepers.keys[govtypes.StoreKey],
appKeepers.GetSubspace(govtypes.ModuleName),
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
&stakingKeeper,
govRouter,
)
appKeepers.GovKeeper = fxgovkeeper.NewKeeper(
appKeepers.BankKeeper,
&stakingKeeper,
appKeepers.keys[govtypes.StoreKey],
govKeeper,
)
transferRouter := fxtypes.NewRouter().
AddRoute(gravitytypes.ModuleName, appKeepers.EthKeeper). // legacy router
AddRoute(ethtypes.ModuleName, appKeepers.EthKeeper).
AddRoute(bsctypes.ModuleName, appKeepers.BscKeeper).
AddRoute(polygontypes.ModuleName, appKeepers.PolygonKeeper).
AddRoute(trontypes.ModuleName, appKeepers.TronKeeper).
AddRoute(avalanchetypes.ModuleName, appKeepers.AvalancheKeeper)
appKeepers.Erc20Keeper = erc20Keeper.SetRouter(*transferRouter)
appKeepers.EvmKeeper.SetHooks(appKeepers.Erc20Keeper.EVMHooks())
ibcTransferRouter := transferRouter.
AddRoute(erc20types.ModuleName, appKeepers.Erc20Keeper)
appKeepers.FxTransferKeeper = appKeepers.FxTransferKeeper.SetRouter(*ibcTransferRouter)
appKeepers.FxTransferKeeper = appKeepers.FxTransferKeeper.SetRefundHook(appKeepers.Erc20Keeper)
appKeepers.FxTransferKeeper = appKeepers.FxTransferKeeper.SetErc20Keeper(appKeepers.Erc20Keeper)
ibcTransferModule := ibctransfer.NewIBCModule(appKeepers.IBCTransferKeeper)
transferIBCModule := fxtransfer.NewIBCMiddleware(appKeepers.FxTransferKeeper, ibcTransferModule)
ibcRouterMiddleware := ibcrouter.NewIBCMiddleware(transferIBCModule, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCTransferKeeper)
// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, ibcRouterMiddleware)
appKeepers.IBCKeeper.SetRouter(ibcRouter)
// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
appKeepers.StakingKeeper = *stakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(
appKeepers.DistrKeeper.Hooks(),
appKeepers.SlashingKeeper.Hooks(),
),
)
appKeepers.MigrateKeeper = migratekeeper.NewKeeper(
appCodec,
appKeepers.keys[migratetypes.StoreKey],
appKeepers.AccountKeeper,
)
appKeepers.MigrateKeeper = appKeepers.MigrateKeeper.SetMigrateI(
migratekeeper.NewBankMigrate(appKeepers.BankKeeper),
migratekeeper.NewDistrStakingMigrate(appKeepers.keys[distrtypes.StoreKey], appKeepers.keys[stakingtypes.StoreKey], appKeepers.StakingKeeper),
migratekeeper.NewGovMigrate(appKeepers.keys[govtypes.StoreKey], appKeepers.GovKeeper),
)
appKeepers.EvidenceKeeper = *evidencekeeper.NewKeeper(
appCodec,
appKeepers.keys[evidencetypes.StoreKey],
stakingKeeper,
appKeepers.SlashingKeeper,
)
return appKeepers
}
// GetSubspace returns a param subspace for a given module name.
func (appKeepers *AppKeepers) GetSubspace(moduleName string) paramstypes.Subspace {
subspace, _ := appKeepers.ParamsKeeper.GetSubspace(moduleName)
return subspace
}
// LegacyAmino NOTE: This is solely to be used for testing purposes as it may be desirable
// for modules to register their own custom testing types.
func (appKeepers *AppKeepers) LegacyAmino() *codec.LegacyAmino {
return appKeepers.legacyAmino
}
// AppCodec NOTE: This is solely to be used for testing purposes as it may be desirable
// for modules to register their own custom testing types.
func (appKeepers *AppKeepers) AppCodec() codec.Codec {
return appKeepers.appCodec
}
// initParamsKeeper init params keeper and its subspaces
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
paramsKeeper.Subspace(authtypes.ModuleName)
paramsKeeper.Subspace(banktypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName)
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace
paramsKeeper.Subspace(gravitytypes.ModuleName)
paramsKeeper.Subspace(bsctypes.ModuleName)
paramsKeeper.Subspace(polygontypes.ModuleName)
paramsKeeper.Subspace(avalanchetypes.ModuleName)
paramsKeeper.Subspace(ethtypes.ModuleName)
paramsKeeper.Subspace(trontypes.ModuleName)
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName)
paramsKeeper.Subspace(erc20types.ModuleName)
return paramsKeeper
}