-
Notifications
You must be signed in to change notification settings - Fork 168
/
msg_server.go
55 lines (45 loc) · 1.29 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
55
package keeper
import (
"context"
"github.com/umee-network/umee/v5/util/sdkutil"
"github.com/umee-network/umee/v5/x/uibc"
)
var _ uibc.MsgServer = msgServer{}
type msgServer struct {
kb Builder
}
// NewMsgServerImpl returns an implementation of uibc.MsgServer
func NewMsgServerImpl(kb Builder) uibc.MsgServer {
return &msgServer{kb: kb}
}
// GovUpdateQuota implements types.MsgServer
func (m msgServer) GovUpdateQuota(ctx context.Context, msg *uibc.MsgGovUpdateQuota) (
*uibc.MsgGovUpdateQuotaResponse, error,
) {
sdkCtx, err := sdkutil.StartMsg(ctx, msg)
if err != nil {
return nil, err
}
k := m.kb.Keeper(&sdkCtx)
if err := k.UpdateQuotaParams(msg.Total, msg.PerDenom, msg.QuotaDuration); err != nil {
return nil, err
}
return &uibc.MsgGovUpdateQuotaResponse{}, nil
}
// GovSetIBCStatus implements types.MsgServer
func (m msgServer) GovSetIBCStatus(
ctx context.Context, msg *uibc.MsgGovSetIBCStatus,
) (*uibc.MsgGovSetIBCStatusResponse, error) {
sdkCtx, err := sdkutil.StartMsg(ctx, msg)
if err != nil {
return nil, err
}
k := m.kb.Keeper(&sdkCtx)
if err := k.SetIBCStatus(msg.IbcStatus); err != nil {
return &uibc.MsgGovSetIBCStatusResponse{}, err
}
sdkutil.Emit(&sdkCtx, &uibc.EventIBCTransferStatus{
Status: msg.IbcStatus,
})
return &uibc.MsgGovSetIBCStatusResponse{}, nil
}