40 lines
888 B
Go
40 lines
888 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
"cosmossdk.io/errors"
|
|
"cosmossdk.io/x/mint/types"
|
|
)
|
|
|
|
var _ types.MsgServer = msgServer{}
|
|
|
|
// msgServer is a wrapper of Keeper.
|
|
type msgServer struct {
|
|
Keeper
|
|
}
|
|
|
|
// NewMsgServerImpl returns an implementation of the x/mint MsgServer interface.
|
|
func NewMsgServerImpl(k Keeper) types.MsgServer {
|
|
return &msgServer{
|
|
Keeper: k,
|
|
}
|
|
}
|
|
|
|
// UpdateParams updates the params.
|
|
func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
|
if ms.authority != msg.Authority {
|
|
return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, msg.Authority)
|
|
}
|
|
|
|
if err := msg.Params.Validate(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := ms.Params.Set(ctx, msg.Params); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.MsgUpdateParamsResponse{}, nil
|
|
}
|