()
| 267 | } |
| 268 | |
| 269 | func GetUpdatePoolsCmd() *cobra.Command { |
| 270 | cmd := &cobra.Command{ |
| 271 | Use: "update-pools [pools.json]", |
| 272 | Short: "Update margin enabled pools, and closed pools", |
| 273 | Args: cobra.ExactArgs(1), |
| 274 | RunE: func(cmd *cobra.Command, args []string) error { |
| 275 | clientCtx, err := client.GetClientTxContext(cmd) |
| 276 | if err != nil { |
| 277 | return err |
| 278 | } |
| 279 | |
| 280 | signer := clientCtx.GetFromAddress() |
| 281 | if signer == nil { |
| 282 | return errors.New("signer address is missing") |
| 283 | } |
| 284 | |
| 285 | pools, err := readPoolsJSON(args[0]) |
| 286 | if err != nil { |
| 287 | return err |
| 288 | } |
| 289 | |
| 290 | closedPools, err := readPoolsJSON(viper.GetString("closed-pools")) |
| 291 | if err != nil { |
| 292 | return err |
| 293 | } |
| 294 | |
| 295 | msg := types.MsgUpdatePools{ |
| 296 | Signer: signer.String(), |
| 297 | Pools: pools, |
| 298 | ClosedPools: closedPools, |
| 299 | } |
| 300 | |
| 301 | return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) |
| 302 | }, |
| 303 | } |
| 304 | cmd.Flags().String("closed-pools", "", "pools that new positions cannot be opened on") |
| 305 | _ = cmd.MarkFlagRequired("closed-pools") |
| 306 | flags.AddTxFlagsToCmd(cmd) |
| 307 | return cmd |
| 308 | } |
| 309 | |
| 310 | func readPoolsJSON(filename string) ([]string, error) { |
| 311 | var pools []string |
no test coverage detected