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
b5995cbf
Commit
b5995cbf
authored
Jul 23, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify some bug
parent
74f124c0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
32 deletions
+57
-32
proposal_board.go
plugin/dapp/autonomy/commands/proposal_board.go
+10
-4
proposal_project.go
plugin/dapp/autonomy/commands/proposal_project.go
+28
-15
proposal_rule.go
plugin/dapp/autonomy/commands/proposal_rule.go
+16
-10
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+1
-1
kv.go
plugin/dapp/autonomy/executor/kv.go
+1
-1
ruleaction.go
plugin/dapp/autonomy/executor/ruleaction.go
+1
-1
No files found.
plugin/dapp/autonomy/commands/proposal_board.go
View file @
b5995cbf
...
...
@@ -146,17 +146,23 @@ func VoteProposalBoardCmd() *cobra.Command {
func
addVoteProposalBoardFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
BoolP
(
"approve"
,
"ap"
,
true
,
"is approve, default true"
)
cmd
.
Flags
()
.
Int32P
(
"approve"
,
"r"
,
1
,
"is approve, default true"
)
}
func
voteProposalBoard
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proposalID"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetBool
(
"approve"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"approve"
)
var
isapp
bool
if
approve
==
0
{
isapp
=
false
}
else
{
isapp
=
true
}
params
:=
&
auty
.
VoteProposalBoard
{
ProposalID
:
ID
,
Approve
:
approve
,
Approve
:
isapp
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"autonomy.VoteProposalBoardTx"
,
params
,
&
res
)
...
...
@@ -194,7 +200,7 @@ func terminateProposalBoard(cmd *cobra.Command, args []string) {
// ShowProposalBoardCmd 显示提案查询信息
func
ShowProposalBoardCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showInfo"
,
Use
:
"show
Board
Info"
,
Short
:
"show proposal board info"
,
Run
:
showProposalBoard
,
}
...
...
plugin/dapp/autonomy/commands/proposal_project.go
View file @
b5995cbf
...
...
@@ -28,16 +28,16 @@ func addProposalProjectFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Int32P
(
"month"
,
"m"
,
0
,
"month"
)
cmd
.
Flags
()
.
Int32P
(
"day"
,
"d"
,
0
,
"day"
)
cmd
.
Flags
()
.
StringP
(
"firstStage"
,
"f
irstStage
"
,
""
,
"first stage proposal ID"
)
cmd
.
Flags
()
.
StringP
(
"lastStage"
,
"l
astStage
"
,
""
,
"last stage proposal ID"
)
cmd
.
Flags
()
.
StringP
(
"production"
,
"p
roduction
"
,
""
,
"production address"
)
cmd
.
Flags
()
.
StringP
(
"description"
,
"
description
"
,
""
,
"description project"
)
cmd
.
Flags
()
.
StringP
(
"contractor"
,
"c
ontractor
"
,
""
,
"contractor introduce"
)
cmd
.
Flags
()
.
StringP
(
"firstStage"
,
"f"
,
""
,
"first stage proposal ID"
)
cmd
.
Flags
()
.
StringP
(
"lastStage"
,
"l"
,
""
,
"last stage proposal ID"
)
cmd
.
Flags
()
.
StringP
(
"production"
,
"p"
,
""
,
"production address"
)
cmd
.
Flags
()
.
StringP
(
"description"
,
"
i
"
,
""
,
"description project"
)
cmd
.
Flags
()
.
StringP
(
"contractor"
,
"c"
,
""
,
"contractor introduce"
)
cmd
.
Flags
()
.
Int64P
(
"amount"
,
"a"
,
0
,
"project cost amount"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
StringP
(
"amountDetail"
,
"
detail
"
,
""
,
"project cost amount detail"
)
cmd
.
Flags
()
.
StringP
(
"toAddr"
,
"
t
o"
,
""
,
"project contractor account address"
)
cmd
.
Flags
()
.
StringP
(
"amountDetail"
,
"
t
"
,
""
,
"project cost amount detail"
)
cmd
.
Flags
()
.
StringP
(
"toAddr"
,
"o"
,
""
,
"project contractor account address"
)
cmd
.
MarkFlagRequired
(
"toAddr"
)
cmd
.
Flags
()
.
Int64P
(
"startBlock"
,
"s"
,
0
,
"start block height"
)
...
...
@@ -133,17 +133,23 @@ func VoteProposalProjectCmd() *cobra.Command {
func
addVoteProposalProjectFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
BoolP
(
"approve"
,
"ap"
,
true
,
"is approve, default true"
)
cmd
.
Flags
()
.
Int32P
(
"approve"
,
"r"
,
1
,
"is approve, default true"
)
}
func
voteProposalProject
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proposalID"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetBool
(
"approve"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"approve"
)
var
isapp
bool
if
approve
==
0
{
isapp
=
false
}
else
{
isapp
=
true
}
params
:=
&
auty
.
VoteProposalProject
{
ProposalID
:
ID
,
Approve
:
approve
,
Approve
:
isapp
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"autonomy.VoteProposalProjectTx"
,
params
,
&
res
)
...
...
@@ -164,17 +170,24 @@ func PubVoteProposalProjectCmd() *cobra.Command {
func
addPubVoteProposalProjectFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
BoolP
(
"oppose"
,
"op"
,
true
,
"is oppose, default true"
)
cmd
.
Flags
()
.
Int32P
(
"oppose"
,
"o"
,
1
,
"is oppose, default true"
)
}
func
pubVoteProposalProject
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proposalID"
)
oppose
,
_
:=
cmd
.
Flags
()
.
GetBool
(
"oppose"
)
oppose
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"oppose"
)
var
isopp
bool
if
oppose
==
0
{
isopp
=
false
}
else
{
isopp
=
true
}
params
:=
&
auty
.
PubVoteProposalProject
{
ProposalID
:
ID
,
Oppose
:
oppose
,
Oppose
:
isopp
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"autonomy.PubVoteProposalProjectTx"
,
params
,
&
res
)
...
...
@@ -213,8 +226,8 @@ func terminateProposalProject(cmd *cobra.Command, args []string) {
// ShowProposalProjectCmd 显示提案查询信息
func
ShowProposalProjectCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showInfo"
,
Short
:
"show proposal
P
roject info"
,
Use
:
"show
Project
Info"
,
Short
:
"show proposal
p
roject info"
,
Run
:
showProposalProject
,
}
addShowProposalProjectflags
(
cmd
)
...
...
plugin/dapp/autonomy/commands/proposal_rule.go
View file @
b5995cbf
...
...
@@ -33,11 +33,11 @@ func addProposalRuleFlags(cmd *cobra.Command) {
cmd
.
MarkFlagRequired
(
"endBlock"
)
// 可修改规则
cmd
.
Flags
()
.
Int32P
(
"boardAttendRatio"
,
"
attend
"
,
0
,
"board attend ratio(unit is %)"
)
cmd
.
Flags
()
.
Int32P
(
"boardApproveRatio"
,
"
approve
"
,
0
,
"board approve ratio(unit is %)"
)
cmd
.
Flags
()
.
Int32P
(
"pubOpposeRatio"
,
"o
ppose
"
,
0
,
"public oppose ratio(unit is %)"
)
cmd
.
Flags
()
.
Int64P
(
"proposalAmount"
,
"p
a
"
,
0
,
"proposal cost amount"
)
cmd
.
Flags
()
.
Int64P
(
"largeProjectAmount"
,
"l
a
"
,
0
,
"large project amount threshold"
)
cmd
.
Flags
()
.
Int32P
(
"boardAttendRatio"
,
"
t
"
,
0
,
"board attend ratio(unit is %)"
)
cmd
.
Flags
()
.
Int32P
(
"boardApproveRatio"
,
"
r
"
,
0
,
"board approve ratio(unit is %)"
)
cmd
.
Flags
()
.
Int32P
(
"pubOpposeRatio"
,
"o"
,
0
,
"public oppose ratio(unit is %)"
)
cmd
.
Flags
()
.
Int64P
(
"proposalAmount"
,
"p"
,
0
,
"proposal cost amount"
)
cmd
.
Flags
()
.
Int64P
(
"largeProjectAmount"
,
"l"
,
0
,
"large project amount threshold"
)
}
func
proposalRule
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
@@ -118,17 +118,23 @@ func VoteProposalRuleCmd() *cobra.Command {
func
addVoteProposalRuleFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
BoolP
(
"approve"
,
"ap"
,
true
,
"is approve, default true"
)
cmd
.
Flags
()
.
Int32P
(
"approve"
,
"r"
,
1
,
"is approve, default true"
)
}
func
voteProposalRule
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proposalID"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetBool
(
"approve"
)
approve
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"approve"
)
var
isapp
bool
if
approve
==
0
{
isapp
=
false
}
else
{
isapp
=
true
}
params
:=
&
auty
.
VoteProposalRule
{
ProposalID
:
ID
,
Approve
:
approve
,
Approve
:
isapp
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"autonomy.VoteProposalRuleTx"
,
params
,
&
res
)
...
...
@@ -166,8 +172,8 @@ func terminateProposalRule(cmd *cobra.Command, args []string) {
// ShowProposalRuleCmd 显示提案查询信息
func
ShowProposalRuleCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showInfo"
,
Short
:
"show proposal
R
ule info"
,
Use
:
"show
Rule
Info"
,
Short
:
"show proposal
r
ule info"
,
Run
:
showProposalRule
,
}
addShowProposalRuleflags
(
cmd
)
...
...
plugin/dapp/autonomy/executor/boardaction.go
View file @
b5995cbf
...
...
@@ -270,7 +270,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
if
a
.
height
<
end
&&
!
cur
.
VoteResult
.
Pass
{
if
a
.
height
<
=
end
&&
!
cur
.
VoteResult
.
Pass
{
err
:=
auty
.
ErrTerminatePeriod
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"height"
,
a
.
height
,
"in vote period can not terminate"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
...
...
plugin/dapp/autonomy/executor/kv.go
View file @
b5995cbf
...
...
@@ -14,7 +14,7 @@ var (
idPrefix
=
"mavl-"
+
auty
.
AutonomyX
+
"-"
votesRecordPrefix
=
idPrefix
+
"vote"
+
"-"
localPrefix
=
"LO
CDB
"
+
auty
.
AutonomyX
+
"-"
localPrefix
=
"LO
DB-
"
+
auty
.
AutonomyX
+
"-"
)
func
votesRecord
(
txHash
string
)
[]
byte
{
...
...
plugin/dapp/autonomy/executor/ruleaction.go
View file @
b5995cbf
...
...
@@ -242,7 +242,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
start
:=
cur
.
GetPropRule
()
.
StartBlockHeight
end
:=
cur
.
GetPropRule
()
.
EndBlockHeight
if
a
.
height
<
end
&&
!
cur
.
VoteResult
.
Pass
{
if
a
.
height
<
=
end
&&
!
cur
.
VoteResult
.
Pass
{
err
:=
auty
.
ErrTerminatePeriod
alog
.
Error
(
"tmintPropRule "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"height"
,
a
.
height
,
"in vote period can not terminate"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
...
...
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