clean up bond module

This commit is contained in:
Roy Crihfield 2025-01-15 15:51:05 +08:00
parent ee196716dd
commit 2cb51c6537
2 changed files with 9 additions and 15 deletions

View File

@ -11,16 +11,16 @@ import (
"git.vdb.to/cerc-io/laconicd/x/bond"
)
type msgHandlers struct {
type msgServer struct {
k *Keeper
}
// NewMsgServerImpl returns an implementation of the module MsgServer interface.
func NewMsgServerImpl(keeper *Keeper) msgHandlers {
return msgHandlers{k: keeper}
func NewMsgServerImpl(keeper *Keeper) msgServer {
return msgServer{k: keeper}
}
func (ms msgHandlers) CreateBond(ctx context.Context, msg *bond.MsgCreateBond) (*bond.MsgCreateBondResponse, error) {
func (ms msgServer) CreateBond(ctx context.Context, msg *bond.MsgCreateBond) (*bond.MsgCreateBondResponse, error) {
ms.k.logger.Debug("handlers.CreateBond", "msg", msg)
if err := msg.ValidateBasic(); err != nil {
@ -60,7 +60,7 @@ func (ms msgHandlers) CreateBond(ctx context.Context, msg *bond.MsgCreateBond) (
}
// RefillBond implements bond.MsgServer.
func (ms msgHandlers) RefillBond(ctx context.Context, msg *bond.MsgRefillBond) (*bond.MsgRefillBondResponse, error) {
func (ms msgServer) RefillBond(ctx context.Context, msg *bond.MsgRefillBond) (*bond.MsgRefillBondResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
@ -100,7 +100,7 @@ func (ms msgHandlers) RefillBond(ctx context.Context, msg *bond.MsgRefillBond) (
}
// WithdrawBond implements bond.MsgServer.
func (ms msgHandlers) WithdrawBond(ctx context.Context, msg *bond.MsgWithdrawBond) (*bond.MsgWithdrawBondResponse, error) {
func (ms msgServer) WithdrawBond(ctx context.Context, msg *bond.MsgWithdrawBond) (*bond.MsgWithdrawBondResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
@ -140,7 +140,7 @@ func (ms msgHandlers) WithdrawBond(ctx context.Context, msg *bond.MsgWithdrawBon
}
// CancelBond implements bond.MsgServer.
func (ms msgHandlers) CancelBond(ctx context.Context, msg *bond.MsgCancelBond) (*bond.MsgCancelBondResponse, error) {
func (ms msgServer) CancelBond(ctx context.Context, msg *bond.MsgCancelBond) (*bond.MsgCancelBondResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
@ -179,7 +179,7 @@ func (ms msgHandlers) CancelBond(ctx context.Context, msg *bond.MsgCancelBond) (
}
// UpdateParams defines a method to perform updation of module params.
func (ms msgHandlers) UpdateParams(ctx context.Context, msg *bond.MsgUpdateParams) (*bond.MsgUpdateParamsResponse, error) {
func (ms msgServer) UpdateParams(ctx context.Context, msg *bond.MsgUpdateParams) (*bond.MsgUpdateParamsResponse, error) {
if err := utils.CheckAuthorityAddress(ms.k.addressCodec, ms.k.authority, msg.Authority); err != nil {
return nil, err
}

View File

@ -21,7 +21,6 @@ import (
)
var (
_ appmodule.AppModule = AppModule{}
_ appmodule.HasConsensusVersion = AppModule{}
_ appmodule.HasGenesis = AppModule{}
_ appmodule.HasMsgHandlers = AppModule{}
@ -31,7 +30,7 @@ var (
_ module.HasGRPCGateway = AppModule{}
// _ module.HasServices = AppModule{}
_ module.HasInvariants = AppModule{}
// _ module.HasAminoCodec = AppModule{} // TODO
// _ module.HasAminoCodec = AppModule{} // TODO still needed?
)
// ConsensusVersion defines the current module consensus version
@ -50,11 +49,6 @@ func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper) AppModule {
}
}
// module.AppModule
// Name returns the bond module's name.
func (AppModule) Name() string { return bond.ModuleName }
// module.HasGRPCGateway
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the bond module.