diff --git a/simapp/app.go b/simapp/app.go index 0ecc4dbf4341..b501a7c9acf4 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -50,7 +50,7 @@ import ( ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types" ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/02-client" ibcclienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" - port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" + porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" ibchost "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/keeper" "github.com/cosmos/cosmos-sdk/x/mint" @@ -267,7 +267,7 @@ func NewSimApp( transferModule := transfer.NewAppModule(app.TransferKeeper) // Create static IBC router, add transfer route, then set and seal it - ibcRouter := port.NewRouter() + ibcRouter := porttypes.NewRouter() ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule) app.IBCKeeper.SetRouter(ibcRouter) diff --git a/x/ibc-transfer/module.go b/x/ibc-transfer/module.go index 62b1e64190f0..54291891958a 100644 --- a/x/ibc-transfer/module.go +++ b/x/ibc-transfer/module.go @@ -26,14 +26,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/ibc-transfer/simulation" "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" - port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ) var ( _ module.AppModule = AppModule{} - _ port.IBCModule = AppModule{} + _ porttypes.IBCModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} ) diff --git a/x/ibc/05-port/alias.go b/x/ibc/05-port/alias.go deleted file mode 100644 index 19800bbddb3a..000000000000 --- a/x/ibc/05-port/alias.go +++ /dev/null @@ -1,34 +0,0 @@ -package port - -// autogenerated code using github.com/rigelrozanski/multitool -// aliases generated for the following subdirectories: -// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper -// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/05-port/types - -import ( - "github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper" - "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" -) - -const ( - SubModuleName = types.SubModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - QuerierRoute = types.QuerierRoute -) - -var ( - // functions aliases - NewKeeper = keeper.NewKeeper - NewRouter = types.NewRouter - ErrPortExists = types.ErrPortExists - ErrPortNotFound = types.ErrPortNotFound - ErrInvalidPort = types.ErrInvalidPort - ErrInvalidRoute = types.ErrInvalidRoute -) - -type ( - Keeper = keeper.Keeper - Router = types.Router - IBCModule = types.IBCModule -) diff --git a/x/ibc/handler.go b/x/ibc/handler.go index d944b7a60c06..becb45419da6 100644 --- a/x/ibc/handler.go +++ b/x/ibc/handler.go @@ -9,7 +9,7 @@ import ( connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" - port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" + porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" "github.com/cosmos/cosmos-sdk/x/ibc/keeper" ) @@ -54,7 +54,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID, cap, msg.Channel.Counterparty, msg.Channel.Version) if err != nil { @@ -76,7 +76,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID, cap, msg.Channel.Counterparty, msg.Channel.Version, msg.CounterpartyVersion) if err != nil { @@ -94,7 +94,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanOpenAck(ctx, msg.PortID, msg.ChannelID, msg.CounterpartyVersion) @@ -112,7 +112,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanOpenConfirm(ctx, msg.PortID, msg.ChannelID) @@ -130,7 +130,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanCloseInit(ctx, msg.PortID, msg.ChannelID) @@ -148,7 +148,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } err = cbs.OnChanCloseConfirm(ctx, msg.PortID, msg.ChannelID) @@ -168,7 +168,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } // Perform application logic callback @@ -194,7 +194,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } // Perform application logic callback @@ -220,7 +220,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { // Retrieve callbacks from router cbs, ok := k.Router.GetRoute(module) if !ok { - return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module) + return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) } // Perform application logic callback diff --git a/x/ibc/keeper/keeper.go b/x/ibc/keeper/keeper.go index 7dceb228aec8..7bb6d017ddba 100644 --- a/x/ibc/keeper/keeper.go +++ b/x/ibc/keeper/keeper.go @@ -8,7 +8,8 @@ import ( clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" connectionkeeper "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper" channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper" - port "github.com/cosmos/cosmos-sdk/x/ibc/05-port" + portkeeper "github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper" + porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types" ) // Keeper defines each ICS keeper for IBC @@ -19,8 +20,8 @@ type Keeper struct { ClientKeeper clientkeeper.Keeper ConnectionKeeper connectionkeeper.Keeper ChannelKeeper channelkeeper.Keeper - PortKeeper port.Keeper - Router *port.Router + PortKeeper portkeeper.Keeper + Router *porttypes.Router } // NewKeeper creates a new ibc Keeper @@ -29,7 +30,7 @@ func NewKeeper( ) *Keeper { clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper) connectionKeeper := connectionkeeper.NewKeeper(aminoCdc, cdc, key, clientKeeper) - portKeeper := port.NewKeeper(scopedKeeper) + portKeeper := portkeeper.NewKeeper(scopedKeeper) channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper) return &Keeper{ @@ -49,7 +50,7 @@ func (k Keeper) Codecs() (codec.Marshaler, *codec.Codec) { // SetRouter sets the Router in IBC Keeper and seals it. The method panics if // there is an existing router that's already sealed. -func (k *Keeper) SetRouter(rtr *port.Router) { +func (k *Keeper) SetRouter(rtr *porttypes.Router) { if k.Router != nil && k.Router.Sealed() { panic("cannot reset a sealed router") }