0g-chain/internal/x/paychan/handler.go

35 lines
861 B
Go
Raw Normal View History

2018-07-08 22:09:07 +00:00
package paychan
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"reflect"
)
2018-07-09 18:46:51 +00:00
// Called when adding routes to a newly created app.
2018-07-08 22:09:07 +00:00
// NewHandler returns a handler for "paychan" type messages.
func NewHandler(k Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
switch msg := msg.(type) {
case MsgSend:
return handleMsgSend(ctx, k, msg)
case MsgIssue:
return handleMsgIssue(ctx, k, msg)
default:
errMsg := "Unrecognized paychan Msg type: " + reflect.TypeOf(msg).Name()
return sdk.ErrUnknownRequest(errMsg).Result()
}
}
}
// Handle CreateMsg.
func handleMsgCreate(ctx sdk.Context, k Keeper, msg MsgSend) sdk.Result {
// k.CreatePaychan(args...)
// handle erros
}
// Handle CloseMsg.
func handleMsgClose(ctx sdk.Context, k Keeper, msg MsgIssue) sdk.Result {
// k.ClosePaychan(args...)
// handle errors
}