cosmos-sdk/examples/democoin/x/simplestake/handler.go

34 lines
723 B
Go
Raw Normal View History

2018-03-28 21:40:06 -07:00
package simplestake
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
2018-03-28 21:40:06 -07:00
// NewHandler returns a handler for "simplestake" type messages.
2018-03-27 10:42:09 -07:00
func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
switch msg.(type) {
2018-04-18 21:49:24 -07:00
case MsgBond:
return handleMsgBond()
2018-04-18 21:49:24 -07:00
case MsgUnbond:
return handleMsgUnbond()
2018-03-27 10:42:09 -07:00
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,
}
}