Skip to content

Commit

Permalink
x/ibc-transfer: move ICS20 out from x/ibc (cosmos#6222)
Browse files Browse the repository at this point in the history
* x/transfer: move ICS20 out from x/ibc

* rename to ibc-transfer
  • Loading branch information
fedekunze authored May 15, 2020
1 parent 86a9750 commit 3dcdc58
Show file tree
Hide file tree
Showing 36 changed files with 461 additions and 161 deletions.
110 changes: 55 additions & 55 deletions crypto/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/ibc"
transfer "github.com/cosmos/cosmos-sdk/x/ibc-transfer"
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
transfer "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
Expand Down Expand Up @@ -74,13 +74,13 @@ var (

// module account permissions
maccPerms = map[string][]string{
auth.FeeCollectorName: nil,
distr.ModuleName: nil,
mint.ModuleName: {auth.Minter},
staking.BondedPoolName: {auth.Burner, auth.Staking},
staking.NotBondedPoolName: {auth.Burner, auth.Staking},
gov.ModuleName: {auth.Burner},
transfer.GetModuleAccountName(): {auth.Minter, auth.Burner},
auth.FeeCollectorName: nil,
distr.ModuleName: nil,
mint.ModuleName: {auth.Minter},
staking.BondedPoolName: {auth.Burner, auth.Staking},
staking.NotBondedPoolName: {auth.Burner, auth.Staking},
gov.ModuleName: {auth.Burner},
transfer.ModuleName: {auth.Minter, auth.Burner},
}

// module accounts that are allowed to receive tokens
Expand Down
2 changes: 1 addition & 1 deletion simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/evidence"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/ibc"
transfer "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer"
transfer "github.com/cosmos/cosmos-sdk/x/ibc-transfer"
"github.com/cosmos/cosmos-sdk/x/mint"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
Expand Down
21 changes: 10 additions & 11 deletions x/ibc/20-transfer/alias.go → x/ibc-transfer/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package transfer

// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/keeper
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc-transfer/types

import (
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
)

const (
Expand All @@ -30,13 +30,12 @@ const (

var (
// functions aliases
NewKeeper = keeper.NewKeeper
RegisterCodec = types.RegisterCodec
GetEscrowAddress = types.GetEscrowAddress
GetDenomPrefix = types.GetDenomPrefix
GetModuleAccountName = types.GetModuleAccountName
NewMsgTransfer = types.NewMsgTransfer
RegisterInterfaces = types.RegisterInterfaces
NewKeeper = keeper.NewKeeper
RegisterCodec = types.RegisterCodec
GetEscrowAddress = types.GetEscrowAddress
GetDenomPrefix = types.GetDenomPrefix
NewMsgTransfer = types.NewMsgTransfer
RegisterInterfaces = types.RegisterInterfaces

// variable aliases
ModuleCdc = types.ModuleCdc
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/client/utils"
)

// GetCmdQueryNextSequence defines the command to query a next receive sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
)

// IBC transfer flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/client/utils"
)

func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
)

func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions x/ibc/20-transfer/genesis.go → x/ibc-transfer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
)

// InitGenesis binds to portid from genesis state
Expand All @@ -25,7 +25,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, state types.GenesisState) {
// check if the module account exists
moduleAcc := keeper.GetTransferAccount(ctx)
if moduleAcc == nil {
panic(fmt.Sprintf("%s module account has not been set", types.GetModuleAccountName()))
panic(fmt.Sprintf("%s module account has not been set", ModuleName))
}
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
transfer "github.com/cosmos/cosmos-sdk/x/ibc-transfer"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
transfer "github.com/cosmos/cosmos-sdk/x/ibc/20-transfer"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)

Expand Down Expand Up @@ -46,7 +46,7 @@ func NewKeeper(
) Keeper {

// ensure ibc transfer module account is set
if addr := authKeeper.GetModuleAddress(types.GetModuleAccountName()); addr == nil {
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
panic("the IBC transfer module account has not been set")
}

Expand All @@ -68,7 +68,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {

// GetTransferAccount returns the ICS20 - transfers ModuleAccount
func (k Keeper) GetTransferAccount(ctx sdk.Context) authexported.ModuleAccountI {
return k.authKeeper.GetModuleAccount(ctx, types.GetModuleAccountName())
return k.authKeeper.GetModuleAccount(ctx, types.ModuleName)
}

// PacketExecuted defines a wrapper function for the channel Keeper's function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
"github.com/cosmos/cosmos-sdk/x/ibc/20-transfer/types"
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"

Expand Down Expand Up @@ -87,13 +87,12 @@ func (suite *KeeperTestSuite) queryProof(key []byte) (proof commitmenttypes.Merk
}

func (suite *KeeperTestSuite) TestGetTransferAccount() {
expectedMaccName := types.GetModuleAccountName()
expectedMaccAddr := sdk.AccAddress(crypto.AddressHash([]byte(expectedMaccName)))
expectedMaccAddr := sdk.AccAddress(crypto.AddressHash([]byte(types.ModuleName)))

macc := suite.chainA.App.TransferKeeper.GetTransferAccount(suite.chainA.GetContext())

suite.NotNil(macc)
suite.Equal(expectedMaccName, macc.GetName())
suite.Equal(types.ModuleName, macc.GetName())
suite.Equal(expectedMaccAddr, macc.GetAddress())
}

Expand Down
Loading

0 comments on commit 3dcdc58

Please sign in to comment.