Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
e3dff3a2
Commit
e3dff3a2
authored
Nov 07, 2018
by
linj
Committed by
linj
Nov 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add part of cmd
parent
43c395d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
2 deletions
+133
-2
unfreeze.go
commands/unfreeze.go
+133
-2
No files found.
commands/unfreeze.go
View file @
e3dff3a2
package
commands
package
commands
import
"github.com/spf13/cobra"
import
(
"fmt"
"github.com/spf13/cobra"
)
func
Cmd
()
*
cobra
.
Command
{
func
Cmd
()
*
cobra
.
Command
{
return
nil
cmd
:=
&
cobra
.
Command
{
Use
:
"unfreeze"
,
Short
:
"Unfreeze construct management"
,
Args
:
cobra
.
MinimumNArgs
(
1
),
}
cmd
.
AddCommand
(
createCmd
())
cmd
.
AddCommand
(
withdrawCmd
())
cmd
.
AddCommand
(
terminateCmd
())
cmd
.
AddCommand
(
showCmd
())
return
cmd
}
func
createCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"create"
,
Short
:
"create unfreeze construct"
,
}
cmd
.
AddCommand
(
fixAmountCmd
())
cmd
.
AddCommand
(
leftCmd
())
return
cmd
}
func
createFlag
(
cmd
*
cobra
.
Command
)
*
cobra
.
Command
{
cmd
.
PersistentFlags
()
.
StringP
(
"beneficiary"
,
"b"
,
""
,
"address of beneficiary"
)
cmd
.
MarkFlagRequired
(
"beneficiary"
)
cmd
.
PersistentFlags
()
.
StringP
(
"asset_exec"
,
"e"
,
""
,
"asset exec"
)
cmd
.
MarkFlagRequired
(
"asset_exec"
)
cmd
.
PersistentFlags
()
.
StringP
(
"asset_symbol"
,
"s"
,
""
,
"asset symbol"
)
cmd
.
MarkFlagRequired
(
"asset_symbol"
)
cmd
.
PersistentFlags
()
.
Float64P
(
"total"
,
"t"
,
0
,
"total count of asset"
)
cmd
.
MarkFlagRequired
(
"total"
)
cmd
.
PersistentFlags
()
.
Int64P
(
"start_ts"
,
""
,
0
,
"effect, UTC timestamp"
)
//cmd.MarkFlagRequired("start_ts")
return
cmd
}
func
fixAmountCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"fix_amount"
,
Short
:
"create fix amount means unfreeze construct"
,
Run
:
fixAmount
,
}
cmd
=
createFlag
(
cmd
)
cmd
.
Flags
()
.
Int64P
(
"amount"
,
"a"
,
0
,
"amount every period"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Int64P
(
"period"
,
"p"
,
0
,
"period in second"
)
cmd
.
MarkFlagRequired
(
"period"
)
return
cmd
}
func
fixAmount
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
beneficiary
,
_
:=
cmd
.
Flags
()
.
GetString
(
"beneficiary"
)
fmt
.
Printf
(
"%s
\n
"
,
beneficiary
)
}
func
leftCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"left_proportion"
,
Short
:
"create left proportion means unfreeze construct"
,
Run
:
left
,
}
cmd
=
createFlag
(
cmd
)
cmd
.
Flags
()
.
Int64P
(
"ten_thousandth"
,
""
,
0
,
"input/10000 of total"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Int64P
(
"period"
,
"p"
,
0
,
"period in second"
)
cmd
.
MarkFlagRequired
(
"period"
)
return
cmd
}
func
left
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
beneficiary
,
_
:=
cmd
.
Flags
()
.
GetString
(
"beneficiary"
)
fmt
.
Printf
(
"%s
\n
"
,
beneficiary
)
}
func
withdrawCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"withdraw"
,
Short
:
"withdraw asset from construct"
,
Run
:
withdraw
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"unfreeze construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
terminateCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"terminate"
,
Short
:
"terminate construct"
,
Run
:
terminate
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"unfreeze construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
showCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"show"
,
Short
:
"show construct"
,
Run
:
show
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"unfreeze construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
show
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
}
func
withdraw
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
}
func
terminate
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment