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

Function GetAdminCloseAllCmd

x/margin/client/cli/admin_tx.go:13–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11)
12
13func GetAdminCloseAllCmd() *cobra.Command {
14 cmd := &cobra.Command{
15 Use: "admin-close-all",
16 Short: "Force close margin position",
17 RunE: func(cmd *cobra.Command, args []string) error {
18 clientCtx, err := client.GetClientTxContext(cmd)
19 if err != nil {
20 return err
21 }
22
23 signer := clientCtx.GetFromAddress()
24 if signer == nil {
25 return errors.New("signer address is missing")
26 }
27
28 takeMarginFund, err := cmd.Flags().GetBool("take_margin_fund")
29 if err != nil {
30 return err
31 }
32
33 msg := types.MsgAdminCloseAll{
34 Signer: signer.String(),
35 TakeMarginFund: takeMarginFund,
36 }
37 return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
38 },
39 }
40 cmd.Flags().Bool("take_margin_fund", true, "boolean value to indicate weather margin fund will be deducted on close")
41 _ = cmd.MarkFlagRequired("take_margin_fund")
42 flags.AddTxFlagsToCmd(cmd)
43 return cmd
44}
45
46func GetAdminCloseCmd() *cobra.Command {
47 cmd := &cobra.Command{

Callers 1

GetTxCmdFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected