Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Co-authored-by: Facundo Medica <facundomedica@gmail.com>
42 lines
961 B
Go
42 lines
961 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
"cosmossdk.io/errors"
|
|
|
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
|
"github.com/cosmos/cosmos-sdk/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(govtypes.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
|
|
}
|