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

34 lines
830 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 := msg.(type) {
2018-04-18 21:49:24 -07:00
case MsgBond:
return handleMsgBond(ctx, k, msg)
case MsgUnbond:
return handleMsgUnbond(ctx, k, msg)
2018-03-27 10:42:09 -07:00
default:
return sdk.ErrUnknownRequest("No match for message type.").Result()
}
}
}
2018-04-18 21:49:24 -07:00
func handleMsgBond(ctx sdk.Context, k Keeper, msg MsgBond) sdk.Result {
// Removed ValidatorSet from result because it does not get used.
// TODO: Implement correct bond/unbond handling
return sdk.Result{
Code: sdk.ABCICodeOK,
}
}
2018-04-18 21:49:24 -07:00
func handleMsgUnbond(ctx sdk.Context, k Keeper, msg MsgUnbond) sdk.Result {
return sdk.Result{
Code: sdk.ABCICodeOK,
}
}