cosmos-sdk/examples/democoin/x/simplestake/handler.go
Dev Ojha 097dd8a164 tools: Add unparam linter (#1443)
* tools: Add unparam linter

unparam detects unused parameters in functions, and a parameter to
a function which only ever takes on one value. The latter is an
indication that more tests are required.

There are many nolints in this PR, as I believe that writing tests
to fix alot of these situations is out of scope for this PR / it
will be changed in future commits. There are some nolints for
when we have to comply to normal api's.

* crypto/keys no longer used by x/gov/client/rest/rest.go
2018-06-29 18:22:24 -04:00

34 lines
723 B
Go

package simplestake
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// 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.(type) {
case MsgBond:
return handleMsgBond()
case MsgUnbond:
return handleMsgUnbond()
default:
return sdk.ErrUnknownRequest("No match for message type.").Result()
}
}
}
func handleMsgBond() sdk.Result {
// Removed ValidatorSet from result because it does not get used.
// TODO: Implement correct bond/unbond handling
return sdk.Result{
Code: sdk.ABCICodeOK,
}
}
func handleMsgUnbond() sdk.Result {
return sdk.Result{
Code: sdk.ABCICodeOK,
}
}