diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index bb3ef05ac..9ef48bfb5 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" "github.com/cosmos/cosmos-sdk/x/simplestake" + "github.com/cosmos/cosmos-sdk/x/stake" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" ) @@ -32,7 +33,7 @@ type BasecoinApp struct { capKeyMainStore *sdk.KVStoreKey capKeyAccountStore *sdk.KVStoreKey capKeyIBCStore *sdk.KVStoreKey - capKeyStakingStore *sdk.KVStoreKey + capKeyStakeStore *sdk.KVStoreKey // Manage getting and setting accounts accountMapper sdk.AccountMapper @@ -53,7 +54,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { capKeyMainStore: sdk.NewKVStoreKey("main"), capKeyAccountStore: sdk.NewKVStoreKey("acc"), capKeyIBCStore: sdk.NewKVStoreKey("ibc"), - capKeyStakingStore: sdk.NewKVStoreKey("stake"), + capKeyStakeStore: sdk.NewKVStoreKey("stake"), } // Define the accountMapper. @@ -70,7 +71,7 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp { app.Router(). AddRoute("bank", bank.NewHandler(coinKeeper)). AddRoute("ibc", ibc.NewHandler(ibcMapper, coinKeeper)). - AddRoute("simplestake", simplestake.NewHandler(stakeKeeper)) + AddRoute("stake", stake.NewHandler(stakeKeeper)) // Define the feeHandler. app.feeHandler = auth.BurnFeeHandler diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index bc1735dde..1f635f53f 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -143,7 +143,7 @@ func TestSortGenesis(t *testing.T) { // Note the order: the coins are unsorted! coinDenom1, coinDenom2 := "foocoin", "barcoin" - genState := fmt.Sprintf(`{ + str := `{ "accounts": [{ "address": "%s", "coins": [ @@ -157,7 +157,8 @@ func TestSortGenesis(t *testing.T) { } ] }] - }`, addr1.String(), coinDenom1, coinDenom2) + }` + genState := fmt.Sprintf(str, addr1.String(), coinDenom1, coinDenom2) // Initialize the chain vals := []abci.Validator{} diff --git a/examples/basecoin/cmd/basecli/main.go b/examples/basecoin/cmd/basecli/main.go index 6271adcec..bab24f91b 100644 --- a/examples/basecoin/cmd/basecli/main.go +++ b/examples/basecoin/cmd/basecli/main.go @@ -17,7 +17,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" - simplestakingcmd "github.com/cosmos/cosmos-sdk/x/simplestake/commands" + stakecmd "github.com/cosmos/cosmos-sdk/x/stake/commands" "github.com/cosmos/cosmos-sdk/examples/basecoin/app" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" @@ -52,23 +52,20 @@ func main() { rootCmd.AddCommand( client.GetCommands( authcmd.GetAccountCmd("main", cdc, types.GetAccountDecoder(cdc)), + stakecmd.GetCmdQueryCandidates("stake", cdc), + stakecmd.GetCmdQueryCandidate("stake", cdc), + stakecmd.GetCmdQueryDelegatorBond("stake", cdc), + stakecmd.GetCmdQueryDelegatorBonds("stake", cdc), )...) rootCmd.AddCommand( client.PostCommands( bankcmd.SendTxCmd(cdc), - )...) - rootCmd.AddCommand( - client.PostCommands( ibccmd.IBCTransferCmd(cdc), - )...) - rootCmd.AddCommand( - client.PostCommands( ibccmd.IBCRelayCmd(cdc), - simplestakingcmd.BondTxCmd(cdc), - )...) - rootCmd.AddCommand( - client.PostCommands( - simplestakingcmd.UnbondTxCmd(cdc), + stakecmd.GetCmdDeclareCandidacy(cdc), + stakecmd.GetCmdEditCandidacy(cdc), + stakecmd.GetCmdDelegate(cdc), + stakecmd.GetCmdUnbond(cdc), )...) // add proxy, version and key info diff --git a/x/stake/commands/query.go b/x/stake/commands/query.go index 8cbb877ce..38e16f333 100644 --- a/x/stake/commands/query.go +++ b/x/stake/commands/query.go @@ -38,7 +38,7 @@ func init() { } // create command to query for all candidates -func GetCmdQueryCandidates(cdc *wire.Codec, storeName string) *cobra.Command { +func GetCmdQueryCandidates(storeName string, cdc *wire.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "candidates", Short: "Query for the set of validator-candidates pubkeys", @@ -74,7 +74,7 @@ func GetCmdQueryCandidates(cdc *wire.Codec, storeName string) *cobra.Command { } // get the command to query a candidate -func GetCmdQueryCandidate(cdc *wire.Codec, storeName string) *cobra.Command { +func GetCmdQueryCandidate(storeName string, cdc *wire.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "candidate", Short: "Query a validator-candidate account", @@ -116,7 +116,7 @@ func GetCmdQueryCandidate(cdc *wire.Codec, storeName string) *cobra.Command { } // get the command to query a single delegator bond -func GetCmdQueryDelegatorBond(cdc *wire.Codec, storeName string) *cobra.Command { +func GetCmdQueryDelegatorBond(storeName string, cdc *wire.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "delegator-bond", Short: "Query a delegators bond based on address and candidate pubkey", @@ -165,7 +165,7 @@ func GetCmdQueryDelegatorBond(cdc *wire.Codec, storeName string) *cobra.Command } // get the command to query all the candidates bonded to a delegator -func GetCmdQueryDelegatorBonds(cdc *wire.Codec, storeName string) *cobra.Command { +func GetCmdQueryDelegatorBonds(storeName string, cdc *wire.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "delegator-candidates", Short: "Query all delegators candidates' pubkeys based on address", diff --git a/x/stake/commands/tx.go b/x/stake/commands/tx.go index 5cc9747b6..679e59b15 100644 --- a/x/stake/commands/tx.go +++ b/x/stake/commands/tx.go @@ -20,8 +20,8 @@ import ( // nolint const ( - FlagAddressDelegator = "addressD" - FlagAddressCandidate = "addressC" + FlagAddressDelegator = "address-delegator" + FlagAddressCandidate = "address-candidate" FlagPubKey = "pubkey" FlagAmount = "amount" FlagShares = "shares" diff --git a/x/stake/handler.go b/x/stake/handler.go index 5f80ecb37..e1f624f10 100644 --- a/x/stake/handler.go +++ b/x/stake/handler.go @@ -4,7 +4,6 @@ import ( "bytes" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" abci "github.com/tendermint/abci/types" ) @@ -18,7 +17,7 @@ const ( //_______________________________________________________________________ -func NewHandler(k Keeper, ck bank.CoinKeeper) sdk.Handler { +func NewHandler(k Keeper) sdk.Handler { return func(ctx sdk.Context, msg sdk.Msg) sdk.Result { // NOTE msg already has validate basic run switch msg := msg.(type) { diff --git a/x/stake/wire.go b/x/stake/wire.go index 4516f89f2..f444ce14e 100644 --- a/x/stake/wire.go +++ b/x/stake/wire.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/wire" ) -// XXX complete +// TODO complete when go-amino is ported func RegisterWire(cdc *wire.Codec) { // TODO include option to always include prefix bytes. //cdc.RegisterConcrete(SendMsg{}, "cosmos-sdk/SendMsg", nil)