Skip to content

Commit

Permalink
Merge pull request #743 from cosmos/rename_simple_stake
Browse files Browse the repository at this point in the history
renamed staking to simplestake
  • Loading branch information
rigelrozanski authored Mar 29, 2018
2 parents 2e5943e + bc1d9e6 commit 072f8f1
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FEATURES
* [types] StdFee, and StdTx takes the StdFee
* [specs] Progression of MVPs for IBC
* [x/ibc] Initial shell of IBC functionality (no proofs)
* [x/staking] Simple staking module with bonding/unbonding
* [x/simplestake] Simple staking module with bonding/unbonding

IMPROVEMENTS

Expand Down
2 changes: 1 addition & 1 deletion Gopkg.lock

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

12 changes: 6 additions & 6 deletions examples/basecoin/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"github.com/cosmos/cosmos-sdk/x/simplestake"

"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
"github.com/cosmos/cosmos-sdk/examples/basecoin/x/cool"
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions examples/basecoin/cmd/basecli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"github.com/cosmos/cosmos-sdk/x/simplestake"
)

const (
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions x/staking/errors.go → x/simplestake/errors.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package staking
package simplestake

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
// Staking errors reserve 300 - 399.
// simplestake errors reserve 300 - 399.
CodeEmptyValidator sdk.CodeType = 300
CodeInvalidUnbond sdk.CodeType = 301
CodeEmptyStake sdk.CodeType = 302
Expand Down
4 changes: 2 additions & 2 deletions x/staking/handler.go → x/simplestake/handler.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package staking
package simplestake

import (
abci "github.com/tendermint/abci/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// NewHandler returns a handler for "bank" type messages.
// NewHandler returns a handler for "simplestake" type messages.
func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
switch msg := msg.(type) {
Expand Down
4 changes: 3 additions & 1 deletion x/staking/keeper.go → x/simplestake/keeper.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package staking
package simplestake

import (
crypto "github.com/tendermint/go-crypto"
Expand All @@ -10,6 +10,8 @@ import (

const stakingToken = "steak"

const moduleName = "simplestake"

type Keeper struct {
ck bank.CoinKeeper

Expand Down
2 changes: 1 addition & 1 deletion x/staking/keeper_test.go → x/simplestake/keeper_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package staking
package simplestake

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions x/staking/msgs.go → x/simplestake/msgs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package staking
package simplestake

import (
"encoding/json"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/staking/msgs_test.go → x/simplestake/msgs_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package staking
package simplestake

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types.go → x/simplestake/types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package staking
package simplestake

import crypto "github.com/tendermint/go-crypto"

Expand Down

0 comments on commit 072f8f1

Please sign in to comment.