@@ -39,6 +39,12 @@ func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router, queryRoute strin
39
39
withdrawValidatorRewardsHandlerFn (cliCtx ),
40
40
).Methods ("POST" )
41
41
42
+ // Fund the community pool
43
+ r .HandleFunc (
44
+ "/distribution/community_pool" ,
45
+ withdrawValidatorRewardsHandlerFn (cliCtx ),
46
+ ).Methods ("POST" )
47
+
42
48
}
43
49
44
50
type (
@@ -50,6 +56,11 @@ type (
50
56
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
51
57
WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"`
52
58
}
59
+
60
+ fundCommunityPoolReq struct {
61
+ BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
62
+ Amount sdk.Coins `json:"amount" yaml:"amount"`
63
+ }
53
64
)
54
65
55
66
// Withdraw delegator rewards
@@ -177,6 +188,30 @@ func withdrawValidatorRewardsHandlerFn(cliCtx context.CLIContext) http.HandlerFu
177
188
}
178
189
}
179
190
191
+ // Fund the community pool
192
+ func fundCommunityPoolHandlerFn (cliCtx context.CLIContext ) http.HandlerFunc {
193
+ return func (w http.ResponseWriter , r * http.Request ) {
194
+ var req fundCommunityPoolReq
195
+ if ! rest .ReadRESTReq (w , r , cliCtx .Codec , & req ) {
196
+ return
197
+ }
198
+
199
+ req .BaseReq = req .BaseReq .Sanitize ()
200
+ if ! req .BaseReq .ValidateBasic (w ) {
201
+ return
202
+ }
203
+
204
+ fromAddr , err := sdk .AccAddressFromBech32 (req .BaseReq .From )
205
+ if err != nil {
206
+ rest .WriteErrorResponse (w , http .StatusBadRequest , err .Error ())
207
+ return
208
+ }
209
+
210
+ msg := types .NewMsgDepositIntoCommunityPool (req .Amount , fromAddr )
211
+ utils .WriteGenerateStdTxResponse (w , cliCtx , req .BaseReq , []sdk.Msg {msg })
212
+ }
213
+ }
214
+
180
215
// Auxiliary
181
216
182
217
func checkDelegatorAddressVar (w http.ResponseWriter , r * http.Request ) (sdk.AccAddress , bool ) {
0 commit comments