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
fb8defde
Commit
fb8defde
authored
Aug 27, 2019
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add show active rule
parent
12851cc2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
6 deletions
+65
-6
proposal_board.go
plugin/dapp/autonomy/commands/proposal_board.go
+4
-3
proposal_change.go
plugin/dapp/autonomy/commands/proposal_change.go
+1
-1
proposal_project.go
plugin/dapp/autonomy/commands/proposal_project.go
+1
-1
proposal_rule.go
plugin/dapp/autonomy/commands/proposal_rule.go
+24
-1
query.go
plugin/dapp/autonomy/executor/query.go
+5
-0
rule.go
plugin/dapp/autonomy/executor/rule.go
+18
-0
jrpc_channel_test.go
plugin/dapp/autonomy/rpc/jrpc_channel_test.go
+1
-0
rule_jrpc_channel_test.go
plugin/dapp/autonomy/rpc/rule_jrpc_channel_test.go
+9
-0
const.go
plugin/dapp/autonomy/types/const.go
+2
-0
No files found.
plugin/dapp/autonomy/commands/proposal_board.go
View file @
fb8defde
...
...
@@ -51,6 +51,7 @@ func AutonomyCmd() *cobra.Command {
VoteProposalRuleCmd
(),
TerminateProposalRuleCmd
(),
ShowProposalRuleCmd
(),
ShowActiveRuleCmd
(),
)
cmd
.
AddCommand
(
...
...
@@ -264,7 +265,7 @@ func terminateProposalBoard(cmd *cobra.Command, args []string) {
// ShowProposalBoardCmd 显示提案查询信息
func
ShowProposalBoardCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showBoard
Info
"
,
Use
:
"showBoard"
,
Short
:
"show proposal board info"
,
Run
:
showProposalBoard
,
}
...
...
@@ -327,8 +328,8 @@ func showProposalBoard(cmd *cobra.Command, args []string) {
// ShowActiveBoardCmd 显示提案查询信息
func
ShowActiveBoardCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showActiveBoard
Info
"
,
Short
:
"show active board
info
"
,
Use
:
"showActiveBoard"
,
Short
:
"show active board"
,
Run
:
showActiveBoard
,
}
return
cmd
...
...
plugin/dapp/autonomy/commands/proposal_change.go
View file @
fb8defde
...
...
@@ -221,7 +221,7 @@ func terminateProposalChange(cmd *cobra.Command, args []string) {
// ShowProposalChangeCmd 显示提案查询信息
func
ShowProposalChangeCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showChange
Info
"
,
Use
:
"showChange"
,
Short
:
"show proposal change info"
,
Run
:
showProposalChange
,
}
...
...
plugin/dapp/autonomy/commands/proposal_project.go
View file @
fb8defde
...
...
@@ -283,7 +283,7 @@ func terminateProposalProject(cmd *cobra.Command, args []string) {
// ShowProposalProjectCmd 显示提案查询信息
func
ShowProposalProjectCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showProject
Info
"
,
Use
:
"showProject"
,
Short
:
"show proposal project info"
,
Run
:
showProposalProject
,
}
...
...
plugin/dapp/autonomy/commands/proposal_rule.go
View file @
fb8defde
...
...
@@ -221,7 +221,7 @@ func terminateProposalRule(cmd *cobra.Command, args []string) {
// ShowProposalRuleCmd 显示提案查询信息
func
ShowProposalRuleCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showRule
Info
"
,
Use
:
"showRule"
,
Short
:
"show proposal rule info"
,
Run
:
showProposalRule
,
}
...
...
@@ -281,6 +281,29 @@ func showProposalRule(cmd *cobra.Command, args []string) {
ctx
.
Run
()
}
// ShowActiveRuleCmd 显示提案查询信息
func
ShowActiveRuleCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"showActiveRule"
,
Short
:
"show active rule"
,
Run
:
showActiveRule
,
}
return
cmd
}
func
showActiveRule
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
params
:=
rpctypes
.
Query4Jrpc
{}
params
.
Execer
=
auty
.
AutonomyX
params
.
FuncName
=
auty
.
GetActiveRule
params
.
Payload
=
types
.
MustPBToJSON
(
&
types
.
ReqString
{})
rep
:=
&
auty
.
RuleConfig
{}
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
rep
)
ctx
.
Run
()
}
// TransferFundCmd 资金转入自治系统合约中
func
TransferFundCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
...
...
plugin/dapp/autonomy/executor/query.go
View file @
fb8defde
...
...
@@ -44,6 +44,11 @@ func (a *Autonomy) Query_ListProposalRule(in *auty.ReqQueryProposalRule) (types.
return
a
.
listProposalRule
(
in
)
}
// Query_GetActiveRule 查询当前rule
func
(
a
*
Autonomy
)
Query_GetActiveRule
(
in
*
types
.
ReqString
)
(
types
.
Message
,
error
)
{
return
a
.
getActiveRule
()
}
// Query_ListProposalComment 批量查询提案评论
func
(
a
*
Autonomy
)
Query_ListProposalComment
(
in
*
auty
.
ReqQueryProposalComment
)
(
types
.
Message
,
error
)
{
return
a
.
listProposalComment
(
in
)
...
...
plugin/dapp/autonomy/executor/rule.go
View file @
fb8defde
...
...
@@ -124,6 +124,24 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa
return
&
rep
,
nil
}
func
(
a
*
Autonomy
)
getActiveRule
()
(
types
.
Message
,
error
)
{
rule
:=
&
auty
.
RuleConfig
{}
value
,
err
:=
a
.
GetStateDB
()
.
Get
(
activeRuleID
())
if
err
==
nil
{
err
=
types
.
Decode
(
value
,
rule
)
if
err
!=
nil
{
return
nil
,
err
}
}
else
{
// 载入系统默认值
rule
.
BoardApproveRatio
=
boardApproveRatio
rule
.
PubOpposeRatio
=
pubOpposeRatio
rule
.
ProposalAmount
=
proposalAmount
rule
.
LargeProjectAmount
=
largeProjectAmount
rule
.
PublicPeriod
=
publicPeriod
}
return
rule
,
nil
}
func
(
a
*
Autonomy
)
execAutoLocalCommentProp
(
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
set
,
err
:=
a
.
execLocalCommentProp
(
receiptData
)
if
err
!=
nil
{
...
...
plugin/dapp/autonomy/rpc/jrpc_channel_test.go
View file @
fb8defde
...
...
@@ -58,6 +58,7 @@ func TestJRPCChannel(t *testing.T) {
{
fn
:
testTerminateProposalRuleTxCmd
},
{
fn
:
testGetProposalRuleCmd
},
{
fn
:
testListProposalRuleCmd
},
{
fn
:
testGetActiveRuleCmd
},
{
fn
:
testTransferFundTxCmd
},
{
fn
:
testCommentProposalTxCmd
},
...
...
plugin/dapp/autonomy/rpc/rule_jrpc_channel_test.go
View file @
fb8defde
...
...
@@ -97,6 +97,15 @@ func testListProposalRuleCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
func
testGetActiveRuleCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
rpctypes
.
Query4Jrpc
params
.
FuncName
=
auty
.
GetActiveRule
params
.
Payload
=
types
.
MustPBToJSON
(
&
types
.
ReqString
{})
rep
=
&
auty
.
RuleConfig
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
func
testTransferFundTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
&
auty
.
TransferFund
{}
payLoad
,
err
:=
json
.
Marshal
(
params
)
...
...
plugin/dapp/autonomy/types/const.go
View file @
fb8defde
...
...
@@ -103,6 +103,8 @@ const (
GetProposalRule
=
"GetProposalRule"
// ListProposalRule 查询多个
ListProposalRule
=
"ListProposalRule"
// GetActiveRule 查询当前的
GetActiveRule
=
"GetActiveRule"
// ListProposalComment 查询多个
ListProposalComment
=
"ListProposalComment"
// GetProposalChange 用于在cmd里面的区分不同的查询
...
...
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