gpu-compute-chain/x/colinearcore/handler.go

46 lines
1.5 KiB
Go
Raw Normal View History

package colinearcore
2022-08-25 16:51:14 -07:00
import (
"fmt"
2022-09-06 15:18:09 -07:00
"colinear/x/colinearcore/keeper"
"colinear/x/colinearcore/types"
2022-08-25 16:51:14 -07:00
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// NewHandler ...
func NewHandler(k keeper.Keeper) sdk.Handler {
2022-08-27 14:19:03 -07:00
msgServer := keeper.NewMsgServerImpl(k)
2022-08-25 16:51:14 -07:00
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
ctx = ctx.WithEventManager(sdk.NewEventManager())
switch msg := msg.(type) {
2022-08-27 14:19:03 -07:00
case *types.MsgNewAuction:
res, err := msgServer.NewAuction(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
2022-08-28 10:57:06 -07:00
case *types.MsgNewBid:
res, err := msgServer.NewBid(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
2022-09-07 13:25:57 -07:00
case *types.MsgLockFunds:
res, err := msgServer.LockFunds(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
2022-09-08 14:49:56 -07:00
case *types.MsgUnlockFunds:
res, err := msgServer.UnlockFunds(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
2022-09-08 16:29:08 -07:00
case *types.MsgUnlockAllFunds:
res, err := msgServer.UnlockAllFunds(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgClaimFunds:
res, err := msgServer.ClaimFunds(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)
2022-08-27 14:19:03 -07:00
// this line is used by starport scaffolding # 1
2022-08-25 16:51:14 -07:00
default:
errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg)
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
}
}
}