@@ -23,34 +23,36 @@ type msgServer struct {
23
23
}
24
24
25
25
func (k msgServer ) UpdateRewardsParams (goCtx context.Context , msg * types.MsgUpdateRewardsParamsRequest ) (* types.MsgUpdateRewardsParamsResponse , error ) {
26
+ response := & types.MsgUpdateRewardsParamsResponse {}
26
27
ctx := sdk .UnwrapSDKContext (goCtx )
27
28
signer , err := sdk .AccAddressFromBech32 (msg .Signer )
28
29
if err != nil {
29
- return nil , err
30
+ return response , err
30
31
}
31
- if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , types . ModuleName , signer ) {
32
- return nil , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
32
+ if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , tokenregistrytypes . AdminType_PMTPREWARDS , signer ) {
33
+ return response , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
33
34
}
34
35
params := k .GetRewardsParams (ctx )
35
36
params .LiquidityRemovalLockPeriod = msg .LiquidityRemovalLockPeriod
36
37
params .LiquidityRemovalCancelPeriod = msg .LiquidityRemovalCancelPeriod
37
38
k .SetRewardParams (ctx , params )
38
- return & types. MsgUpdateRewardsParamsResponse {} , err
39
+ return response , err
39
40
}
40
41
41
42
func (k msgServer ) AddRewardPeriod (goCtx context.Context , msg * types.MsgAddRewardPeriodRequest ) (* types.MsgAddRewardPeriodResponse , error ) {
43
+ response := & types.MsgAddRewardPeriodResponse {}
42
44
ctx := sdk .UnwrapSDKContext (goCtx )
43
45
signer , err := sdk .AccAddressFromBech32 (msg .Signer )
44
46
if err != nil {
45
- return nil , err
47
+ return response , err
46
48
}
47
- if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , types . ModuleName , signer ) {
48
- return nil , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
49
+ if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , tokenregistrytypes . AdminType_PMTPREWARDS , signer ) {
50
+ return response , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
49
51
}
50
52
params := k .GetRewardsParams (ctx )
51
53
params .RewardPeriods = msg .RewardPeriods
52
54
k .SetRewardParams (ctx , params )
53
- return & types. MsgAddRewardPeriodResponse {} , nil
55
+ return response , nil
54
56
}
55
57
56
58
// NewMsgServerImpl returns an implementation of the clp MsgServer interface
@@ -68,7 +70,7 @@ func (k msgServer) UpdatePmtpParams(goCtx context.Context, msg *types.MsgUpdateP
68
70
if err != nil {
69
71
return response , err
70
72
}
71
- if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , types . ModuleName , signer ) {
73
+ if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , tokenregistrytypes . AdminType_PMTPREWARDS , signer ) {
72
74
return response , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
73
75
}
74
76
params := k .GetPmtpParams (ctx )
@@ -115,7 +117,7 @@ func (k msgServer) ModifyPmtpRates(goCtx context.Context, msg *types.MsgModifyPm
115
117
if err != nil {
116
118
return response , err
117
119
}
118
- if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , types . ModuleName , signer ) {
120
+ if ! k .tokenRegistryKeeper .IsAdminAccount (ctx , tokenregistrytypes . AdminType_PMTPREWARDS , signer ) {
119
121
return response , errors .Wrap (types .ErrNotEnoughPermissions , fmt .Sprintf ("Sending Account : %s" , msg .Signer ))
120
122
}
121
123
params := k .GetPmtpParams (ctx )
@@ -213,6 +215,7 @@ func (k msgServer) DecommissionPool(goCtx context.Context, msg *types.MsgDecommi
213
215
if err != nil {
214
216
return nil , err
215
217
}
218
+ // TODO : Deprecate this Admin in favor of TokenRegistry
216
219
if ! k .Keeper .ValidateAddress (ctx , addAddr ) {
217
220
return nil , sdkerrors .Wrap (types .ErrInvalid , "user does not have permission to decommission pool" )
218
221
}
0 commit comments