|
5 | 5 | "strconv"
|
6 | 6 | "strings"
|
7 | 7 |
|
| 8 | + sdk "github.com/cosmos/cosmos-sdk/types" |
| 9 | + |
8 | 10 | "github.com/liftedinit/manifest-ledger/x/manifest/types"
|
9 | 11 | "github.com/spf13/cobra"
|
10 | 12 |
|
@@ -34,40 +36,35 @@ func NewTxCmd() *cobra.Command {
|
34 | 36 | // contract for the module.
|
35 | 37 | func MsgUpdateParams() *cobra.Command {
|
36 | 38 | cmd := &cobra.Command{
|
37 |
| - Use: "update-params address:1_000_000,address2:99_000_000 [inflation-enabled] [inflation-per-year-amount] [mint-denom]", |
38 |
| - Short: "Update the params (must be submitted from the authority)", |
39 |
| - Args: cobra.ExactArgs(1), |
| 39 | + Use: "update-params [address_pairs] [automatic_inflation_enabled] [inflation_per_year]", |
| 40 | + Short: "Update the params (must be submitted from the authority)", |
| 41 | + Example: `update-params address:1_000_000,address2:99_000_000 true 500000000umfx`, |
| 42 | + Args: cobra.ExactArgs(1), |
40 | 43 | RunE: func(cmd *cobra.Command, args []string) error {
|
41 | 44 | cliCtx, err := client.GetClientTxContext(cmd)
|
42 | 45 | if err != nil {
|
43 | 46 | return err
|
44 | 47 | }
|
45 |
| - |
46 | 48 | senderAddress := cliCtx.GetFromAddress()
|
47 | 49 |
|
48 | 50 | sh, err := fromStrToStakeholders(args[0])
|
49 | 51 | if err != nil {
|
50 | 52 | return err
|
51 | 53 | }
|
52 | 54 |
|
53 |
| - isInflationEnabled, err := cmd.Flags().GetBool("inflation-enabled") |
54 |
| - if err != nil { |
55 |
| - return err |
56 |
| - } |
57 |
| - |
58 |
| - inflationPerYearAmount, err := cmd.Flags().GetUint64("inflation-per-year-amount") |
| 55 | + isInflationEnabled, err := strconv.ParseBool(args[1]) |
59 | 56 | if err != nil {
|
60 | 57 | return err
|
61 | 58 | }
|
62 | 59 |
|
63 |
| - mintDenom, err := cmd.Flags().GetString("mint-denom") |
| 60 | + coin, err := sdk.ParseCoinNormalized(args[2]) |
64 | 61 | if err != nil {
|
65 | 62 | return err
|
66 | 63 | }
|
67 | 64 |
|
68 | 65 | msg := &types.MsgUpdateParams{
|
69 | 66 | Authority: senderAddress.String(),
|
70 |
| - Params: types.NewParams(sh, isInflationEnabled, inflationPerYearAmount, mintDenom), |
| 67 | + Params: types.NewParams(sh, isInflationEnabled, coin.Amount.Uint64(), coin.Denom), |
71 | 68 | }
|
72 | 69 |
|
73 | 70 | if err := msg.Validate(); err != nil {
|
|
0 commit comments