@@ -110,9 +110,21 @@ import (
110110 ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
111111 "github.com/spf13/cast"
112112
113+ // srvflags "github.com/zeta-chain/node/server/flags"
114+
115+ evmante "github.com/zeta-chain/ethermint/app/ante"
116+ ethermint "github.com/zeta-chain/ethermint/types"
117+ "github.com/zeta-chain/ethermint/x/evm"
118+ evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper"
119+ evmtypes "github.com/zeta-chain/ethermint/x/evm/types"
120+ "github.com/zeta-chain/ethermint/x/feemarket"
121+ feemarketkeeper "github.com/zeta-chain/ethermint/x/feemarket/keeper"
122+ feemarkettypes "github.com/zeta-chain/ethermint/x/feemarket/types"
123+
113124 pushchainmodule "pushchain/x/pushchain"
114125 pushchainmodulekeeper "pushchain/x/pushchain/keeper"
115126 pushchainmoduletypes "pushchain/x/pushchain/types"
127+
116128 // this line is used by starport scaffolding # stargate/app/moduleImport
117129
118130 appparams "pushchain/app/params"
@@ -187,6 +199,7 @@ var (
187199 stakingtypes .NotBondedPoolName : {authtypes .Burner , authtypes .Staking },
188200 govtypes .ModuleName : {authtypes .Burner },
189201 ibctransfertypes .ModuleName : {authtypes .Minter , authtypes .Burner },
202+ evmtypes .ModuleName : {authtypes .Minter , authtypes .Burner },
190203 // this line is used by starport scaffolding # stargate/app/maccPerms
191204 }
192205)
@@ -203,6 +216,8 @@ func init() {
203216 }
204217
205218 DefaultNodeHome = filepath .Join (userHomeDir , "." + Name )
219+ // manually update the power reduction by replacing micro (u) -> atto (a) evmos
220+ sdk .DefaultPowerReduction = ethermint .PowerReduction
206221}
207222
208223// App extends an ABCI application, but with most of its parameters exported.
@@ -249,6 +264,10 @@ type App struct {
249264 ScopedTransferKeeper capabilitykeeper.ScopedKeeper
250265 ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
251266
267+ // evm keepers
268+ EvmKeeper * evmkeeper.Keeper
269+ FeeMarketKeeper feemarketkeeper.Keeper
270+
252271 PushchainKeeper pushchainmodulekeeper.Keeper
253272 // this line is used by starport scaffolding # stargate/app/keeperDeclaration
254273
@@ -296,10 +315,12 @@ func New(
296315 govtypes .StoreKey , paramstypes .StoreKey , ibcexported .StoreKey , upgradetypes .StoreKey ,
297316 feegrant .StoreKey , evidencetypes .StoreKey , ibctransfertypes .StoreKey , icahosttypes .StoreKey ,
298317 capabilitytypes .StoreKey , group .StoreKey , icacontrollertypes .StoreKey , consensusparamtypes .StoreKey ,
318+ evmtypes .StoreKey ,
319+ feemarkettypes .StoreKey ,
299320 pushchainmoduletypes .StoreKey ,
300321 // this line is used by starport scaffolding # stargate/app/storeKey
301322 )
302- tkeys := sdk .NewTransientStoreKeys (paramstypes .TStoreKey )
323+ tkeys := sdk .NewTransientStoreKeys (paramstypes .TStoreKey , evmtypes . TransientKey , feemarkettypes . TransientKey )
303324 memKeys := sdk .NewMemoryStoreKeys (capabilitytypes .MemStoreKey )
304325
305326 app := & App {
@@ -343,7 +364,7 @@ func New(
343364 app .AccountKeeper = authkeeper .NewAccountKeeper (
344365 appCodec ,
345366 keys [authtypes .StoreKey ],
346- authtypes . ProtoBaseAccount ,
367+ ethermint . ProtoAccount ,
347368 maccPerms ,
348369 sdk .Bech32PrefixAccAddr ,
349370 authtypes .NewModuleAddress (govtypes .ModuleName ).String (),
@@ -415,6 +436,43 @@ func New(
415436 authtypes .NewModuleAddress (govtypes .ModuleName ).String (),
416437 )
417438
439+ // Create Ethermint keepers
440+ tracer := "evm.tracer"
441+ feeSs := app .GetSubspace (feemarkettypes .ModuleName )
442+ app .FeeMarketKeeper = feemarketkeeper .NewKeeper (
443+ appCodec ,
444+ authtypes .NewModuleAddress (govtypes .ModuleName ),
445+ keys [feemarkettypes .StoreKey ],
446+ tkeys [feemarkettypes .TransientKey ],
447+ feeSs ,
448+ app .ConsensusParamsKeeper ,
449+ )
450+ evmSs := app .GetSubspace (evmtypes .ModuleName )
451+
452+ app .EvmKeeper = evmkeeper .NewKeeper (
453+ appCodec ,
454+ keys [evmtypes .StoreKey ],
455+ tkeys [evmtypes .TransientKey ],
456+ authtypes .NewModuleAddress (govtypes .ModuleName ),
457+ app .AccountKeeper ,
458+ app .BankKeeper ,
459+ app .StakingKeeper ,
460+ & app .FeeMarketKeeper ,
461+ tracer ,
462+ evmSs ,
463+ // precompiles.StatefulContracts(
464+ // &app.FungibleKeeper,
465+ // app.StakingKeeper,
466+ // app.BankKeeper,
467+ // app.DistrKeeper,
468+ // appCodec,
469+ // storetypes.TransientGasConfig(),
470+ // ),
471+ nil ,
472+ app .ConsensusParamsKeeper ,
473+ aggregateAllKeys (keys , tkeys , memKeys ),
474+ )
475+
418476 groupConfig := group .DefaultConfig ()
419477 /*
420478 Example of setting group params:
@@ -588,6 +646,8 @@ func New(
588646 params .NewAppModule (app .ParamsKeeper ),
589647 transferModule ,
590648 icaModule ,
649+ feemarket .NewAppModule (app .FeeMarketKeeper , feeSs ),
650+ evm .NewAppModule (app .EvmKeeper , app .AccountKeeper , evmSs ),
591651 pushchainModule ,
592652 // this line is used by starport scaffolding # stargate/app/appModule
593653
@@ -601,6 +661,7 @@ func New(
601661 app .mm .SetOrderBeginBlockers (
602662 // upgrades should be run first
603663 upgradetypes .ModuleName ,
664+ evmtypes .ModuleName ,
604665 capabilitytypes .ModuleName ,
605666 minttypes .ModuleName ,
606667 distrtypes .ModuleName ,
@@ -621,6 +682,7 @@ func New(
621682 paramstypes .ModuleName ,
622683 vestingtypes .ModuleName ,
623684 consensusparamtypes .ModuleName ,
685+ feemarkettypes .ModuleName ,
624686 pushchainmoduletypes .ModuleName ,
625687 // this line is used by starport scaffolding # stargate/app/beginBlockers
626688 )
@@ -647,6 +709,8 @@ func New(
647709 upgradetypes .ModuleName ,
648710 vestingtypes .ModuleName ,
649711 consensusparamtypes .ModuleName ,
712+ evmtypes .ModuleName ,
713+ feemarkettypes .ModuleName ,
650714 pushchainmoduletypes .ModuleName ,
651715 // this line is used by starport scaffolding # stargate/app/endBlockers
652716 )
@@ -713,11 +777,21 @@ func New(
713777 // initialize BaseApp
714778 anteHandler , err := ante .NewAnteHandler (
715779 ante.HandlerOptions {
716- AccountKeeper : app .AccountKeeper ,
717- BankKeeper : app .BankKeeper ,
780+ AccountKeeper : app .AccountKeeper ,
781+ BankKeeper : app .BankKeeper ,
782+ // EvmKeeper: app.EvmKeeper,
783+ // FeeMarketKeeper: app.FeeMarketKeeper,
718784 SignModeHandler : encodingConfig .TxConfig .SignModeHandler (),
719785 FeegrantKeeper : app .FeeGrantKeeper ,
720- SigGasConsumer : ante .DefaultSigVerificationGasConsumer ,
786+ SigGasConsumer : evmante .DefaultSigVerificationGasConsumer ,
787+ // DisabledAuthzMsgs: []string{
788+ // sdk.MsgTypeURL(
789+ // &evmtypes.MsgEthereumTx{},
790+ // ), // disable the Msg types that cannot be included on an authz.MsgExec msgs field
791+ // // sdk.MsgTypeURL(&vestingtypes.MsgCreateVestingAccount{}),
792+ // // sdk.MsgTypeURL(&vestingtypes.MsgCreatePermanentLockedAccount{}),
793+ // // sdk.MsgTypeURL(&vestingtypes.MsgCreatePeriodicVestingAccount{}),
794+ // },
721795 },
722796 )
723797 if err != nil {
@@ -903,6 +977,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
903977 paramsKeeper .Subspace (ibcexported .ModuleName )
904978 paramsKeeper .Subspace (icacontrollertypes .SubModuleName )
905979 paramsKeeper .Subspace (icahosttypes .SubModuleName )
980+ paramsKeeper .Subspace (evmtypes .ModuleName )
981+ paramsKeeper .Subspace (feemarkettypes .ModuleName )
906982 paramsKeeper .Subspace (pushchainmoduletypes .ModuleName )
907983 // this line is used by starport scaffolding # stargate/app/paramSubspace
908984
@@ -918,3 +994,26 @@ func (app *App) SimulationManager() *module.SimulationManager {
918994func (app * App ) ModuleManager () * module.Manager {
919995 return app .mm
920996}
997+
998+ // aggregateAllKeys aggregates all the keys in a single map.
999+ func aggregateAllKeys (
1000+ keys map [string ]* storetypes.KVStoreKey ,
1001+ tKeys map [string ]* storetypes.TransientStoreKey ,
1002+ memKeys map [string ]* storetypes.MemoryStoreKey ,
1003+ ) map [string ]storetypes.StoreKey {
1004+ allKeys := make (map [string ]storetypes.StoreKey , len (keys )+ len (tKeys )+ len (memKeys ))
1005+
1006+ for k , v := range keys {
1007+ allKeys [k ] = v
1008+ }
1009+
1010+ for k , v := range tKeys {
1011+ allKeys [k ] = v
1012+ }
1013+
1014+ for k , v := range memKeys {
1015+ allKeys [k ] = v
1016+ }
1017+
1018+ return allKeys
1019+ }
0 commit comments