-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmsg_server.go
54 lines (42 loc) · 1.39 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
49
50
51
52
53
54
package keeper
import (
"context"
"github.com/Canto-Network/Canto/v7/x/govshuttle/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type msgServer struct {
Keeper
}
// NewMsgServerImpl returns an implementation of the MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}
var _ types.MsgServer = msgServer{}
func (k Keeper) LendingMarketProposal(goCtx context.Context, req *types.MsgLendingMarketProposal) (*types.MsgLendingMarketProposalResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
legacyProposal := types.LendingMarketProposal{
Title: req.Title,
Description: req.Description,
Metadata: req.Metadata,
}
_, err := k.AppendLendingMarketProposal(ctx, &legacyProposal)
if err != nil {
return nil, err
}
return &types.MsgLendingMarketProposalResponse{}, nil
}
func (k Keeper) TreasuryProposal(goCtx context.Context, req *types.MsgTreasuryProposal) (*types.MsgTreasuryProposalResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
legacyTreasuryProposal := types.TreasuryProposal{
Title: req.Title,
Description: req.Description,
Metadata: req.Metadata,
}
legacyProposal := legacyTreasuryProposal.FromTreasuryToLendingMarket()
_, err := k.AppendLendingMarketProposal(ctx, legacyProposal)
if err != nil {
return nil, err
}
return &types.MsgTreasuryProposalResponse{}, nil
}