2023-01-05 16:59:46 +00:00
|
|
|
package feemarket
|
|
|
|
|
|
|
|
import (
|
|
|
|
errorsmod "cosmossdk.io/errors"
|
2023-03-13 07:04:10 +00:00
|
|
|
"github.com/cerc-io/laconicd/x/feemarket/types"
|
2023-01-05 16:59:46 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewHandler returns a handler for Ethermint type messages.
|
|
|
|
func NewHandler(server types.MsgServer) sdk.Handler {
|
|
|
|
return func(ctx sdk.Context, msg sdk.Msg) (result *sdk.Result, err error) {
|
|
|
|
ctx = ctx.WithEventManager(sdk.NewEventManager())
|
|
|
|
|
|
|
|
switch msg := msg.(type) {
|
|
|
|
case *types.MsgUpdateParams:
|
|
|
|
// execute state transition
|
|
|
|
res, err := server.UpdateParams(sdk.WrapSDKContext(ctx), msg)
|
|
|
|
return sdk.WrapServiceResult(ctx, res, err)
|
|
|
|
|
|
|
|
default:
|
|
|
|
err := errorsmod.Wrapf(errortypes.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|