planetmint-go/x/machine/keeper/msg_server_update_params.go
Jürgen Eckel b14f175eba
added UpdateParam messge for the machine module
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-02-26 11:02:50 +01:00

25 lines
662 B
Go

package keeper
import (
"context"
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/planetmint/planetmint-go/x/machine/types"
)
func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if k.authority != msg.Authority {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority)
}
if err := k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &types.MsgUpdateParamsResponse{}, nil
}