From 13f953e16bff4d38dbec19341d5ebdc188cdc13b Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Thu, 18 Apr 2024 16:23:28 +0700 Subject: [PATCH] refactor: change name convention --- app/app.go | 16 ++++++++-------- app/keepers/keepers.go | 30 +++++++++++++++--------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/app.go b/app/app.go index 6a47b0f9..79a3acc4 100644 --- a/app/app.go +++ b/app/app.go @@ -102,8 +102,8 @@ import ( customstaking "github.com/notional-labs/composable/v6/custom/staking" "github.com/spf13/cast" - router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + pfm "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" custombankmodule "github.com/notional-labs/composable/v6/custom/bank" @@ -201,7 +201,7 @@ var ( tendermint.AppModuleBasic{}, mint.AppModuleBasic{}, wasm.AppModuleBasic{}, - router.AppModuleBasic{}, + pfm.AppModuleBasic{}, ica.AppModuleBasic{}, ibc_hooks.AppModuleBasic{}, transfermiddleware.AppModuleBasic{}, @@ -342,7 +342,7 @@ func NewComposableApp( // transferModule := transfer.NewAppModule(app.TransferKeeper) transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper, app.BankKeeper) - routerModule := router.NewAppModule(app.RouterKeeper, app.GetSubspace(routertypes.ModuleName)) + pfmModule := pfm.NewAppModule(app.PfmKeeper, app.GetSubspace(pfmtypes.ModuleName)) transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper) txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper) ratelimitModule := ratelimitmodule.NewAppModule(&app.RatelimitKeeper) @@ -389,7 +389,7 @@ func NewComposableApp( consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), wasm08.NewAppModule(app.Wasm08Keeper), - routerModule, + pfmModule, transfermiddlewareModule, txBoundaryModule, icaModule, @@ -421,7 +421,7 @@ func NewComposableApp( vestingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - routertypes.ModuleName, + pfmtypes.ModuleName, transfermiddlewaretypes.ModuleName, txBoundaryTypes.ModuleName, ratelimitmoduletypes.ModuleName, @@ -465,7 +465,7 @@ func NewComposableApp( group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - routertypes.ModuleName, + pfmtypes.ModuleName, transfermiddlewaretypes.ModuleName, txBoundaryTypes.ModuleName, ratelimitmoduletypes.ModuleName, @@ -505,7 +505,7 @@ func NewComposableApp( upgradetypes.ModuleName, ibctransfertypes.ModuleName, icqtypes.ModuleName, - routertypes.ModuleName, + pfmtypes.ModuleName, transfermiddlewaretypes.ModuleName, txBoundaryTypes.ModuleName, ratelimitmoduletypes.ModuleName, diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 5dc3b3ce..faf05ef9 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -78,9 +78,9 @@ import ( custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" - router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" - routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" - routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + pfm "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + pfmkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" + pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware" transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" @@ -165,7 +165,7 @@ type AppKeepers struct { // this line is used by starport scaffolding # stargate/app/keeperDeclaration TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper TxBoundaryKeepper txBoundaryKeeper.Keeper - RouterKeeper *routerkeeper.Keeper + PfmKeeper *pfmkeeper.Keeper RatelimitKeeper ratelimitmodulekeeper.Keeper StakingMiddlewareKeeper stakingmiddleware.Keeper IbcTransferMiddlewareKeeper ibctransfermiddleware.Keeper @@ -330,9 +330,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers( authorityAddress, ) - appKeepers.RouterKeeper = routerkeeper.NewKeeper( + appKeepers.PfmKeeper = pfmkeeper.NewKeeper( appCodec, - appKeepers.keys[routertypes.StoreKey], + appKeepers.keys[pfmtypes.StoreKey], appKeepers.TransferKeeper.Keeper, appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.DistrKeeper, @@ -354,7 +354,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( &appKeepers.IbcTransferMiddlewareKeeper, govModAddress, ) - appKeepers.RouterKeeper.SetTransferKeeper(appKeepers.TransferKeeper) + appKeepers.PfmKeeper.SetTransferKeeper(appKeepers.TransferKeeper) appKeepers.RatelimitKeeper = *ratelimitmodulekeeper.NewKeeper( appCodec, @@ -383,12 +383,12 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.TransferMiddlewareKeeper, ) - ibcMiddlewareStack := router.NewIBCMiddleware( + ibcMiddlewareStack := pfm.NewIBCMiddleware( transfermiddlewareStack, - appKeepers.RouterKeeper, + appKeepers.PfmKeeper, 0, - routerkeeper.DefaultForwardTransferPacketTimeoutTimestamp, - routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp, + pfmkeeper.DefaultForwardTransferPacketTimeoutTimestamp, + pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp, ) ratelimitMiddlewareStack := ratelimitmodule.NewIBCMiddleware(appKeepers.RatelimitKeeper, ibcMiddlewareStack) hooksTransferMiddleware := ibc_hooks.NewIBCMiddleware(ratelimitMiddlewareStack, &appKeepers.HooksICS4Wrapper) @@ -397,7 +397,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( evidenceKeeper := evidencekeeper.NewKeeper( appCodec, runtime.NewKVStoreService(appKeepers.keys[evidencetypes.StoreKey]), appKeepers.StakingKeeper, appKeepers.SlashingKeeper, appKeepers.AccountKeeper.AddressCodec(), runtime.ProvideCometInfoService(), ) - // If evidence needs to be handled for the app, set routes in router here and seal + // If evidence needs to be handled for the app, set routes in pfm here and seal appKeepers.EvidenceKeeper = *evidenceKeeper wasmDir := filepath.Join(homePath, "wasm") @@ -499,7 +499,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ibcRouter.AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper)) ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack) - // this line is used by starport scaffolding # ibc/app/router + // this line is used by starport scaffolding # ibc/app/pfm appKeepers.IBCKeeper.SetRouter(ibcRouter) } @@ -552,8 +552,8 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(stakingtypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable()) // TODO: - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) //nolint:staticcheck + paramsKeeper.Subspace(pfmtypes.ModuleName).WithKeyTable(pfmtypes.ParamKeyTable()) // TODO: + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) //nolint:staticcheck paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ratelimitmoduletypes.ModuleName)