From 9d9001ab6217503c817e94dbb0fb995623034b92 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Thu, 29 Mar 2018 06:33:45 +0200 Subject: [PATCH] renamed staking to simplestake --- Gopkg.lock | 2 +- examples/basecoin/app/app.go | 12 ++++++------ examples/basecoin/cmd/basecli/main.go | 9 +++++---- x/{staking => simplestake}/commands/commands.go | 6 +++--- x/{staking => simplestake}/errors.go | 0 x/{staking => simplestake}/handler.go | 0 x/{staking => simplestake}/keeper.go | 2 ++ x/{staking => simplestake}/keeper_test.go | 0 x/{staking => simplestake}/msgs.go | 4 ++-- x/{staking => simplestake}/msgs_test.go | 0 x/{staking => simplestake}/types.go | 0 11 files changed, 19 insertions(+), 16 deletions(-) rename x/{staking => simplestake}/commands/commands.go (92%) rename x/{staking => simplestake}/errors.go (100%) rename x/{staking => simplestake}/handler.go (100%) rename x/{staking => simplestake}/keeper.go (98%) rename x/{staking => simplestake}/keeper_test.go (100%) rename x/{staking => simplestake}/msgs.go (97%) rename x/{staking => simplestake}/msgs_test.go (100%) rename x/{staking => simplestake}/types.go (100%) diff --git a/Gopkg.lock b/Gopkg.lock index 267acf32b..377390297 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -458,6 +458,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "cce90fda84a63ae5b41b40f0edc357eec4020d17fdd61585960ad537418749ea" + inputs-digest = "ed1f3f7f1728cd02945f90ca780e9bdc982573a36a5cc8d7e9f19fb40ba2ca19" solver-name = "gps-cdcl" solver-version = 1 diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 3178b2057..871e3c18e 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -15,7 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" - "github.com/cosmos/cosmos-sdk/x/staking" + simplestake "github.com/cosmos/cosmos-sdk/x/simplestake" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" "github.com/cosmos/cosmos-sdk/examples/basecoin/x/cool" @@ -47,7 +47,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { cdc: MakeCodec(), capKeyMainStore: sdk.NewKVStoreKey("main"), capKeyIBCStore: sdk.NewKVStoreKey("ibc"), - capKeyStakingStore: sdk.NewKVStoreKey("staking"), + capKeyStakingStore: sdk.NewKVStoreKey("stake"), } // define the accountMapper @@ -60,13 +60,13 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { coinKeeper := bank.NewCoinKeeper(app.accountMapper) coolKeeper := cool.NewKeeper(app.capKeyMainStore, coinKeeper) ibcMapper := ibc.NewIBCMapper(app.cdc, app.capKeyIBCStore) - stakeKeeper := staking.NewKeeper(app.capKeyStakingStore, coinKeeper) + stakeKeeper := simplestake.NewKeeper(app.capKeyStakingStore, coinKeeper) app.Router(). AddRoute("bank", bank.NewHandler(coinKeeper), nil). AddRoute("cool", cool.NewHandler(coolKeeper), coolKeeper.InitGenesis). AddRoute("sketchy", sketchy.NewHandler(), nil). AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper), nil). - AddRoute("staking", staking.NewHandler(stakeKeeper), nil) + AddRoute("simplestake", simplestake.NewHandler(stakeKeeper), nil) // initialize BaseApp app.SetTxDecoder(app.txDecoder) @@ -100,8 +100,8 @@ func MakeCodec() *wire.Codec { oldwire.ConcreteType{cool.SetTrendMsg{}, msgTypeSetTrend}, oldwire.ConcreteType{ibc.IBCTransferMsg{}, msgTypeIBCTransferMsg}, oldwire.ConcreteType{ibc.IBCReceiveMsg{}, msgTypeIBCReceiveMsg}, - oldwire.ConcreteType{staking.BondMsg{}, msgTypeBondMsg}, - oldwire.ConcreteType{staking.UnbondMsg{}, msgTypeUnbondMsg}, + oldwire.ConcreteType{simplestake.BondMsg{}, msgTypeBondMsg}, + oldwire.ConcreteType{simplestake.UnbondMsg{}, msgTypeUnbondMsg}, ) const accTypeApp = 0x1 diff --git a/examples/basecoin/cmd/basecli/main.go b/examples/basecoin/cmd/basecli/main.go index 6fabc612c..1c4b5833b 100644 --- a/examples/basecoin/cmd/basecli/main.go +++ b/examples/basecoin/cmd/basecli/main.go @@ -2,9 +2,10 @@ package main import ( "errors" - "github.com/spf13/cobra" "os" + "github.com/spf13/cobra" + "github.com/tendermint/tmlibs/cli" "github.com/cosmos/cosmos-sdk/client" @@ -18,7 +19,7 @@ import ( authcmd "github.com/cosmos/cosmos-sdk/x/auth/commands" bankcmd "github.com/cosmos/cosmos-sdk/x/bank/commands" ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/commands" - stakingcmd "github.com/cosmos/cosmos-sdk/x/staking/commands" + simplestakingcmd "github.com/cosmos/cosmos-sdk/x/simplestake/commands" "github.com/cosmos/cosmos-sdk/examples/basecoin/app" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" @@ -77,11 +78,11 @@ func main() { basecliCmd.AddCommand( client.PostCommands( ibccmd.IBCRelayCmd(cdc), - stakingcmd.BondTxCmd(cdc), + simplestakingcmd.BondTxCmd(cdc), )...) basecliCmd.AddCommand( client.PostCommands( - stakingcmd.UnbondTxCmd(cdc), + simplestakingcmd.UnbondTxCmd(cdc), )...) // add proxy, version and key info diff --git a/x/staking/commands/commands.go b/x/simplestake/commands/commands.go similarity index 92% rename from x/staking/commands/commands.go rename to x/simplestake/commands/commands.go index 79520ebef..0bb9b5649 100644 --- a/x/staking/commands/commands.go +++ b/x/simplestake/commands/commands.go @@ -13,7 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/builder" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/wire" - "github.com/cosmos/cosmos-sdk/x/staking" + simplestake "github.com/cosmos/cosmos-sdk/x/simplestake" ) const ( @@ -76,7 +76,7 @@ func (co commander) bondTxCmd(cmd *cobra.Command, args []string) error { var pubKeyEd crypto.PubKeyEd25519 copy(pubKeyEd[:], rawPubKey) - msg := staking.NewBondMsg(from, stake, pubKeyEd.Wrap()) + msg := simplestake.NewBondMsg(from, stake, pubKeyEd.Wrap()) return co.sendMsg(msg) } @@ -87,7 +87,7 @@ func (co commander) unbondTxCmd(cmd *cobra.Command, args []string) error { return err } - msg := staking.NewUnbondMsg(from) + msg := simplestake.NewUnbondMsg(from) return co.sendMsg(msg) } diff --git a/x/staking/errors.go b/x/simplestake/errors.go similarity index 100% rename from x/staking/errors.go rename to x/simplestake/errors.go diff --git a/x/staking/handler.go b/x/simplestake/handler.go similarity index 100% rename from x/staking/handler.go rename to x/simplestake/handler.go diff --git a/x/staking/keeper.go b/x/simplestake/keeper.go similarity index 98% rename from x/staking/keeper.go rename to x/simplestake/keeper.go index 615f94fae..d9fcf713c 100644 --- a/x/staking/keeper.go +++ b/x/simplestake/keeper.go @@ -10,6 +10,8 @@ import ( const stakingToken = "steak" +const moduleName = "simplestake" + type Keeper struct { ck bank.CoinKeeper diff --git a/x/staking/keeper_test.go b/x/simplestake/keeper_test.go similarity index 100% rename from x/staking/keeper_test.go rename to x/simplestake/keeper_test.go diff --git a/x/staking/msgs.go b/x/simplestake/msgs.go similarity index 97% rename from x/staking/msgs.go rename to x/simplestake/msgs.go index 9bbf425c7..23a5de25c 100644 --- a/x/staking/msgs.go +++ b/x/simplestake/msgs.go @@ -26,7 +26,7 @@ func NewBondMsg(addr sdk.Address, stake sdk.Coin, pubKey crypto.PubKey) BondMsg } func (msg BondMsg) Type() string { - return "staking" + return moduleName } func (msg BondMsg) ValidateBasic() sdk.Error { @@ -71,7 +71,7 @@ func NewUnbondMsg(addr sdk.Address) UnbondMsg { } func (msg UnbondMsg) Type() string { - return "staking" + return moduleName } func (msg UnbondMsg) ValidateBasic() sdk.Error { diff --git a/x/staking/msgs_test.go b/x/simplestake/msgs_test.go similarity index 100% rename from x/staking/msgs_test.go rename to x/simplestake/msgs_test.go diff --git a/x/staking/types.go b/x/simplestake/types.go similarity index 100% rename from x/staking/types.go rename to x/simplestake/types.go