MCPcopy Create free account
hub / github.com/Sifchain/sifnode / GetCmdAddRewardPeriod

Function GetCmdAddRewardPeriod

x/clp/client/cli/tx.go:56–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 return clpTxCmd
55}
56func GetCmdAddRewardPeriod() *cobra.Command {
57 cmd := &cobra.Command{
58 Use: "reward-period",
59 Short: "Update reward params",
60 RunE: func(cmd *cobra.Command, args []string) error {
61 clientCtx, err := client.GetClientTxContext(cmd)
62 if err != nil {
63 return err
64 }
65 var rewardPeriods []*types.RewardPeriod
66 signer := clientCtx.GetFromAddress()
67 filePath := viper.GetString(FlagRewardPeriods)
68 file, err := filepath.Abs(filePath)
69 if err != nil {
70 return err
71 }
72 input, err := ioutil.ReadFile(file)
73 if err != nil {
74 return err
75 }
76 err = json.Unmarshal(input, &rewardPeriods)
77 if err != nil {
78 return err
79 }
80 msg := types.MsgAddRewardPeriodRequest{
81 Signer: signer.String(),
82 RewardPeriods: rewardPeriods,
83 }
84 if err := msg.ValidateBasic(); err != nil {
85 return err
86 }
87 return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
88 },
89 }
90 cmd.Flags().AddFlagSet(FsFlagRewardPeriods)
91 flags.AddTxFlagsToCmd(cmd)
92 return cmd
93}
94
95func GetCmdUpdateRewardParams() *cobra.Command {
96 cmd := &cobra.Command{

Callers 1

GetTxCmdFunction · 0.85

Calls 3

ValidateBasicMethod · 0.95
UnmarshalMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected