-
Notifications
You must be signed in to change notification settings - Fork 3
/
msg_server.go
48 lines (34 loc) · 1.37 KB
/
msg_server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package keeper
// DONTCOVER
// Although written in msg_server_test.go, it is approached at the keeper level rather than at the msgServer level
// so is not included in the coverage.
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmosquad-labs/squad/v3/x/marketmaker/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the marketmaker MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}
var _ types.MsgServer = msgServer{}
// ApplyMarketMaker defines a method for apply to be market maker.
func (k msgServer) ApplyMarketMaker(goCtx context.Context, msg *types.MsgApplyMarketMaker) (*types.MsgApplyMarketMakerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if err := k.Keeper.ApplyMarketMaker(ctx, msg.GetAddress(), msg.PairIds); err != nil {
return nil, err
}
return &types.MsgApplyMarketMakerResponse{}, nil
}
// ClaimIncentives defines a method for claim all claimable incentives of the market maker.
func (k msgServer) ClaimIncentives(goCtx context.Context, msg *types.MsgClaimIncentives) (*types.MsgClaimIncentivesResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
if err := k.Keeper.ClaimIncentives(ctx, msg.GetAddress()); err != nil {
return nil, err
}
return &types.MsgClaimIncentivesResponse{}, nil
}