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
158281da
Commit
158281da
authored
Jul 17, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify some name
parent
49658b66
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
99 deletions
+98
-99
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+17
-12
projectaction.go
plugin/dapp/autonomy/executor/projectaction.go
+12
-18
ruleaction.go
plugin/dapp/autonomy/executor/ruleaction.go
+24
-25
lcommon.proto
plugin/dapp/autonomy/proto/lcommon.proto
+9
-8
lcommon.pb.go
plugin/dapp/autonomy/types/lcommon.pb.go
+36
-36
No files found.
plugin/dapp/autonomy/executor/boardaction.go
View file @
158281da
...
@@ -18,10 +18,15 @@ import (
...
@@ -18,10 +18,15 @@ import (
const
(
const
(
minBoards
=
3
minBoards
=
3
maxBoards
=
30
maxBoards
=
30
lockAmount
int64
=
types
.
Coin
*
1000
// 创建者消耗金额
publicPeriod
=
120960
// 公示一周时间,以区块高度计算
ticketPrice
=
types
.
Coin
*
3000
// 单张票价
ticketPrice
=
types
.
Coin
*
3000
// 单张票价
participationRate
int32
=
66
// 参与率以%计
largeProjectAmount
=
types
.
Coin
*
100
*
10000
// 重大项目公示金额阈值
approveRate
int32
=
66
// 赞成率以%计
proposalAmount
=
types
.
Coin
*
1000
// 创建者消耗金额
boardAttendRatio
int32
=
66
// 董事会成员参与率,以%计,可修改
boardApproveRatio
int32
=
66
// 董事会成员赞成率,以%计,可修改
pubAttendRatio
int32
=
50
// 全体持票人参与率,以%计
pubApproveRatio
int32
=
50
// 全体持票人赞成率,以%计
pubOpposeRatio
int32
=
33
// 全体持票人否决率,以%计
)
)
type
action
struct
{
type
action
struct
{
...
@@ -62,11 +67,11 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
...
@@ -62,11 +67,11 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
return
nil
,
err
return
nil
,
err
}
}
}
else
{
// 载入系统默认值
}
else
{
// 载入系统默认值
rule
.
BoardAttend
Prob
=
participationRate
rule
.
BoardAttend
Ratio
=
boardAttendRatio
rule
.
Board
PassProb
=
approveRate
rule
.
Board
ApproveRatio
=
boardApproveRatio
rule
.
OpposeProb
=
opposeRate
rule
.
PubOpposeRatio
=
pubOpposeRatio
rule
.
ProposalAmount
=
lock
Amount
rule
.
ProposalAmount
=
proposal
Amount
rule
.
PubAmountThreshold
=
large
Amount
rule
.
LargeProjectAmount
=
largeProject
Amount
}
}
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
rule
.
ProposalAmount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
rule
.
ProposalAmount
)
...
@@ -242,8 +247,8 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
...
@@ -242,8 +247,8 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
!=
0
&&
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttendProb
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
pubAttendRatio
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
OpposeProb
)
/
100.0
{
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
pubApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
VoteResult
.
Pass
=
true
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
...
@@ -325,8 +330,8 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
...
@@ -325,8 +330,8 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
cur
.
VoteResult
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
cur
.
VoteResult
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
}
}
if
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttendProb
)
/
100.0
&&
if
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
pubAttendRatio
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
OpposeProb
)
/
100.0
{
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
pubApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
VoteResult
.
Pass
=
true
}
else
{
}
else
{
cur
.
VoteResult
.
Pass
=
false
cur
.
VoteResult
.
Pass
=
false
...
...
plugin/dapp/autonomy/executor/projectaction.go
View file @
158281da
...
@@ -12,12 +12,6 @@ import (
...
@@ -12,12 +12,6 @@ import (
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/address"
)
)
const
(
largeAmount
=
types
.
Coin
*
100
*
10000
// 重大项目金额阈值
publicPeriod
=
120960
// 公示一周时间,以区块高度计算
opposeRate
int32
=
33
// 反对率以%计
)
func
(
a
*
action
)
propProject
(
prob
*
auty
.
ProposalProject
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
propProject
(
prob
*
auty
.
ProposalProject
)
(
*
types
.
Receipt
,
error
)
{
if
err
:=
address
.
CheckAddress
(
prob
.
ToAddr
);
err
!=
nil
{
if
err
:=
address
.
CheckAddress
(
prob
.
ToAddr
);
err
!=
nil
{
...
@@ -58,11 +52,11 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
...
@@ -58,11 +52,11 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
return
nil
,
err
return
nil
,
err
}
}
}
else
{
// 载入系统默认值
}
else
{
// 载入系统默认值
rule
.
BoardAttend
Prob
=
participationRate
rule
.
BoardAttend
Ratio
=
boardAttendRatio
rule
.
Board
PassProb
=
approveRate
rule
.
Board
ApproveRatio
=
boardApproveRatio
rule
.
OpposeProb
=
opposeRate
rule
.
PubOpposeRatio
=
pubOpposeRatio
rule
.
ProposalAmount
=
lock
Amount
rule
.
ProposalAmount
=
proposal
Amount
rule
.
PubAmountThreshold
=
large
Amount
rule
.
LargeProjectAmount
=
largeProject
Amount
}
}
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
rule
.
ProposalAmount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
rule
.
ProposalAmount
)
...
@@ -78,7 +72,7 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
...
@@ -78,7 +72,7 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
var
isPubVote
bool
var
isPubVote
bool
if
prob
.
Amount
>=
rule
.
PubAmountThreshold
{
if
prob
.
Amount
>=
rule
.
LargeProjectAmount
{
isPubVote
=
true
isPubVote
=
true
}
}
cur
:=
&
auty
.
AutonomyProposalProject
{
cur
:=
&
auty
.
AutonomyProposalProject
{
...
@@ -242,8 +236,8 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
...
@@ -242,8 +236,8 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
!=
0
&&
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttend
Prob
)
/
100.0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttend
Ratio
)
/
100.0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
Board
PassProb
)
/
100.0
{
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
Board
ApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
cur
.
BoardVoteRes
.
Pass
=
true
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
autonomyAddr
,
a
.
execaddr
,
cur
.
CurRule
.
ProposalAmount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
autonomyAddr
,
a
.
execaddr
,
cur
.
CurRule
.
ProposalAmount
)
...
@@ -373,7 +367,7 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ
...
@@ -373,7 +367,7 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ
var
kv
[]
*
types
.
KeyValue
var
kv
[]
*
types
.
KeyValue
if
cur
.
PubVote
.
TotalVotes
!=
0
&&
if
cur
.
PubVote
.
TotalVotes
!=
0
&&
float32
(
cur
.
PubVote
.
OpposeVotes
)
/
float32
(
cur
.
PubVote
.
TotalVotes
)
>=
float32
(
opposeRate
)
{
float32
(
cur
.
PubVote
.
OpposeVotes
)
/
float32
(
cur
.
PubVote
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
PubOpposeRatio
)
{
cur
.
PubVote
.
PubPass
=
false
cur
.
PubVote
.
PubPass
=
false
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
cur
.
PropProject
.
RealEndBlockHeight
=
a
.
height
...
@@ -476,8 +470,8 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
...
@@ -476,8 +470,8 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
if
cur
.
BoardVoteRes
.
TotalVotes
!=
0
&&
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
!=
0
&&
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
!=
0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttend
Prob
)
/
100.0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
/
float32
(
cur
.
BoardVoteRes
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
BoardAttend
Ratio
)
/
100.0
&&
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
Board
PassProb
)
/
100.0
{
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
)
/
float32
(
cur
.
BoardVoteRes
.
ApproveVotes
+
cur
.
BoardVoteRes
.
OpposeVotes
)
>=
float32
(
cur
.
CurRule
.
Board
ApproveRatio
)
/
100.0
{
cur
.
BoardVoteRes
.
Pass
=
true
cur
.
BoardVoteRes
.
Pass
=
true
}
else
{
}
else
{
cur
.
BoardVoteRes
.
Pass
=
false
cur
.
BoardVoteRes
.
Pass
=
false
...
@@ -493,7 +487,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
...
@@ -493,7 +487,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
cur
.
PubVote
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
cur
.
PubVote
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
}
}
if
cur
.
PubVote
.
TotalVotes
!=
0
&&
if
cur
.
PubVote
.
TotalVotes
!=
0
&&
float32
(
cur
.
PubVote
.
OpposeVotes
)
/
float32
(
cur
.
PubVote
.
TotalVotes
)
>=
float32
(
opposeRate
)
{
float32
(
cur
.
PubVote
.
OpposeVotes
)
/
float32
(
cur
.
PubVote
.
TotalVotes
)
>=
float32
(
cur
.
CurRule
.
PubOpposeRatio
)
{
cur
.
PubVote
.
PubPass
=
false
cur
.
PubVote
.
PubPass
=
false
}
}
}
}
...
...
plugin/dapp/autonomy/executor/ruleaction.go
View file @
158281da
...
@@ -11,16 +11,12 @@ import (
...
@@ -11,16 +11,12 @@ import (
)
)
const
(
ruleAttendRate
=
50
// 提案规则修改参与率
ruleApproveRate
=
50
// 提案规则修改赞成率
)
func
(
a
*
action
)
propRule
(
prob
*
auty
.
ProposalRule
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
propRule
(
prob
*
auty
.
ProposalRule
)
(
*
types
.
Receipt
,
error
)
{
//如果全小于等于0,则说明该提案规则参数不正确
//如果全小于等于0,则说明该提案规则参数不正确
if
prob
.
RuleCfg
==
nil
||
prob
.
RuleCfg
.
BoardAttend
Prob
<=
0
&&
prob
.
RuleCfg
.
BoardPassProb
<=
0
&&
if
prob
.
RuleCfg
==
nil
||
prob
.
RuleCfg
.
BoardAttend
Ratio
<=
0
&&
prob
.
RuleCfg
.
BoardApproveRatio
<=
0
&&
prob
.
RuleCfg
.
OpposeProb
<=
0
&&
prob
.
RuleCfg
.
ProposalAmount
<=
0
&&
prob
.
RuleCfg
.
PubAmountThreshold
<=
0
{
prob
.
RuleCfg
.
PubOpposeRatio
<=
0
&&
prob
.
RuleCfg
.
ProposalAmount
<=
0
&&
prob
.
RuleCfg
.
LargeProjectAmount
<=
0
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
@@ -38,28 +34,31 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
...
@@ -38,28 +34,31 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
return
nil
,
err
return
nil
,
err
}
}
}
else
{
// 载入系统默认值
}
else
{
// 载入系统默认值
rule
.
BoardAttendProb
=
participationRate
rule
.
BoardAttendRatio
=
boardAttendRatio
rule
.
BoardPassProb
=
approveRate
rule
.
BoardApproveRatio
=
boardApproveRatio
rule
.
OpposeProb
=
opposeRate
rule
.
PubOpposeRatio
=
pubOpposeRatio
rule
.
ProposalAmount
=
lockAmount
rule
.
ProposalAmount
=
proposalAmount
rule
.
PubAmountThreshold
=
largeAmount
rule
.
LargeProjectAmount
=
largeProjectAmount
}
if
prob
.
RuleCfg
.
BoardAttendRatio
>
0
{
rule
.
BoardAttendRatio
=
prob
.
RuleCfg
.
BoardAttendRatio
}
}
if
prob
.
RuleCfg
.
BoardA
ttendProb
>
0
{
if
prob
.
RuleCfg
.
BoardA
pproveRatio
>
0
{
rule
.
BoardA
ttendProb
=
prob
.
RuleCfg
.
BoardAttendProb
rule
.
BoardA
pproveRatio
=
prob
.
RuleCfg
.
BoardApproveRatio
}
}
if
prob
.
RuleCfg
.
BoardPassProb
>
0
{
if
prob
.
RuleCfg
.
PubOpposeRatio
>
0
{
rule
.
Board
PassProb
=
prob
.
RuleCfg
.
BoardPassProb
rule
.
Board
ApproveRatio
=
prob
.
RuleCfg
.
PubOpposeRatio
}
}
if
prob
.
RuleCfg
.
ProposalAmount
>
0
{
if
prob
.
RuleCfg
.
ProposalAmount
>
0
{
rule
.
ProposalAmount
=
prob
.
RuleCfg
.
ProposalAmount
rule
.
ProposalAmount
=
prob
.
RuleCfg
.
ProposalAmount
}
}
if
prob
.
RuleCfg
.
PubAmountThreshold
>
0
{
if
prob
.
RuleCfg
.
LargeProjectAmount
>
0
{
rule
.
PubAmountThreshold
=
prob
.
RuleCfg
.
PubAmountThreshold
rule
.
LargeProjectAmount
=
prob
.
RuleCfg
.
LargeProjectAmount
}
}
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
lock
Amount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
rule
.
Proposal
Amount
)
if
err
!=
nil
{
if
err
!=
nil
{
alog
.
Error
(
"propRule "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecFrozen amount"
,
lock
Amount
)
alog
.
Error
(
"propRule "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecFrozen amount"
,
rule
.
Proposal
Amount
)
return
nil
,
err
return
nil
,
err
}
}
...
@@ -132,9 +131,9 @@ func (a *action) rvkPropRule(rvkProb *auty.RevokeProposalRule) (*types.Receipt,
...
@@ -132,9 +131,9 @@ func (a *action) rvkPropRule(rvkProb *auty.RevokeProposalRule) (*types.Receipt,
var
logs
[]
*
types
.
ReceiptLog
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
kv
[]
*
types
.
KeyValue
receipt
,
err
:=
a
.
coinsAccount
.
ExecActive
(
a
.
fromaddr
,
a
.
execaddr
,
lock
Amount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecActive
(
a
.
fromaddr
,
a
.
execaddr
,
cur
.
Rule
.
Proposal
Amount
)
if
err
!=
nil
{
if
err
!=
nil
{
alog
.
Error
(
"rvkPropRule "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecActive amount"
,
lock
Amount
,
"err"
,
err
)
alog
.
Error
(
"rvkPropRule "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecActive amount"
,
cur
.
Rule
.
Proposal
Amount
,
"err"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
logs
=
append
(
logs
,
receipt
.
Logs
...
)
...
@@ -232,8 +231,8 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
...
@@ -232,8 +231,8 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
!=
0
&&
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
ruleAttendRate
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
pubAttendRatio
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
ruleApproveRate
)
/
100.0
{
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
pubApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
VoteResult
.
Pass
=
true
cur
.
PropRule
.
RealEndBlockHeight
=
a
.
height
cur
.
PropRule
.
RealEndBlockHeight
=
a
.
height
...
@@ -315,8 +314,8 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
...
@@ -315,8 +314,8 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
cur
.
VoteResult
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
cur
.
VoteResult
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
}
}
if
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
ruleAttendRate
)
/
100.0
&&
if
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
float32
(
pubAttendRatio
)
/
100.0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
ruleApproveRate
)
/
100.0
{
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
float32
(
pubApproveRatio
)
/
100.0
{
cur
.
VoteResult
.
Pass
=
true
cur
.
VoteResult
.
Pass
=
true
}
else
{
}
else
{
cur
.
VoteResult
.
Pass
=
false
cur
.
VoteResult
.
Pass
=
false
...
...
plugin/dapp/autonomy/proto/lcommon.proto
View file @
158281da
...
@@ -33,14 +33,14 @@ message VotesRecord {
...
@@ -33,14 +33,14 @@ message VotesRecord {
}
}
message
RuleConfig
{
message
RuleConfig
{
// 参与率,以%为单位,只保留整数部分
//
董事会成员
参与率,以%为单位,只保留整数部分
int32
boardAttend
Prob
=
1
;
int32
boardAttend
Ratio
=
1
;
//
通过
率
//
董事会成员赞成
率
int32
board
PassProb
=
2
;
int32
board
ApproveRatio
=
2
;
// 否决率
//
全体持票人
否决率
int32
opposeProb
=
3
;
int32
pubOpposeRatio
=
3
;
// 提案金额
// 提案金额
int64
proposalAmount
=
4
;
int64
proposalAmount
=
4
;
// 公示金额阈值
//
重大项目
公示金额阈值
int64
pubAmountThreshold
=
5
;
int64
largeProjectAmount
=
5
;
}
}
\ No newline at end of file
plugin/dapp/autonomy/types/lcommon.pb.go
View file @
158281da
...
@@ -117,16 +117,16 @@ func (m *VotesRecord) GetAddress() []string {
...
@@ -117,16 +117,16 @@ func (m *VotesRecord) GetAddress() []string {
}
}
type
RuleConfig
struct
{
type
RuleConfig
struct
{
// 参与率,以%为单位,只保留整数部分
//
董事会成员
参与率,以%为单位,只保留整数部分
BoardAttend
Prob
int32
`protobuf:"varint,1,opt,name=boardAttendProb" json:"boardAttendProb
,omitempty"`
BoardAttend
Ratio
int32
`protobuf:"varint,1,opt,name=boardAttendRatio" json:"boardAttendRatio
,omitempty"`
//
通过
率
//
董事会成员赞成
率
Board
PassProb
int32
`protobuf:"varint,2,opt,name=boardPassProb" json:"boardPassProb
,omitempty"`
Board
ApproveRatio
int32
`protobuf:"varint,2,opt,name=boardApproveRatio" json:"boardApproveRatio
,omitempty"`
// 否决率
//
全体持票人
否决率
OpposeProb
int32
`protobuf:"varint,3,opt,name=opposeProb" json:"opposeProb
,omitempty"`
PubOpposeRatio
int32
`protobuf:"varint,3,opt,name=pubOpposeRatio" json:"pubOpposeRatio
,omitempty"`
// 提案金额
// 提案金额
ProposalAmount
int64
`protobuf:"varint,4,opt,name=proposalAmount" json:"proposalAmount,omitempty"`
ProposalAmount
int64
`protobuf:"varint,4,opt,name=proposalAmount" json:"proposalAmount,omitempty"`
// 公示金额阈值
//
重大项目
公示金额阈值
PubAmountThreshold
int64
`protobuf:"varint,5,opt,name=pubAmountThreshold" json:"pubAmountThreshold
,omitempty"`
LargeProjectAmount
int64
`protobuf:"varint,5,opt,name=largeProjectAmount" json:"largeProjectAmount
,omitempty"`
}
}
func
(
m
*
RuleConfig
)
Reset
()
{
*
m
=
RuleConfig
{}
}
func
(
m
*
RuleConfig
)
Reset
()
{
*
m
=
RuleConfig
{}
}
...
@@ -134,23 +134,23 @@ func (m *RuleConfig) String() string { return proto.CompactTextString
...
@@ -134,23 +134,23 @@ func (m *RuleConfig) String() string { return proto.CompactTextString
func
(
*
RuleConfig
)
ProtoMessage
()
{}
func
(
*
RuleConfig
)
ProtoMessage
()
{}
func
(
*
RuleConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
3
}
}
func
(
*
RuleConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
3
}
}
func
(
m
*
RuleConfig
)
GetBoardAttend
Prob
()
int32
{
func
(
m
*
RuleConfig
)
GetBoardAttend
Ratio
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
BoardAttend
Prob
return
m
.
BoardAttend
Ratio
}
}
return
0
return
0
}
}
func
(
m
*
RuleConfig
)
GetBoard
PassProb
()
int32
{
func
(
m
*
RuleConfig
)
GetBoard
ApproveRatio
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
Board
PassProb
return
m
.
Board
ApproveRatio
}
}
return
0
return
0
}
}
func
(
m
*
RuleConfig
)
Get
OpposeProb
()
int32
{
func
(
m
*
RuleConfig
)
Get
PubOpposeRatio
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
OpposeProb
return
m
.
PubOpposeRatio
}
}
return
0
return
0
}
}
...
@@ -162,9 +162,9 @@ func (m *RuleConfig) GetProposalAmount() int64 {
...
@@ -162,9 +162,9 @@ func (m *RuleConfig) GetProposalAmount() int64 {
return
0
return
0
}
}
func
(
m
*
RuleConfig
)
Get
PubAmountThreshold
()
int64
{
func
(
m
*
RuleConfig
)
Get
LargeProjectAmount
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
PubAmountThreshold
return
m
.
LargeProjectAmount
}
}
return
0
return
0
}
}
...
@@ -179,24 +179,24 @@ func init() {
...
@@ -179,24 +179,24 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor2
)
}
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor2
)
}
var
fileDescriptor2
=
[]
byte
{
var
fileDescriptor2
=
[]
byte
{
// 29
7
bytes of a gzipped FileDescriptorProto
// 29
9
bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x92
,
0xc
b
,
0x4a
,
0x33
,
0x41
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x92
,
0xc
d
,
0x4a
,
0xc3
,
0x40
,
0x10
,
0x8
5
,
0x99
,
0x5c
,
0xfe
,
0x3f
,
0xa9
,
0x18
,
0x85
,
0x5a
,
0xcd
,
0x42
,
0x24
,
0x0c
,
0xa2
,
0xb3
,
0x10
,
0x8
0
,
0x49
,
0x7f
,
0xb4
,
0x9d
,
0xaa
,
0xe8
,
0x9c
,
0x7a
,
0x10
,
0x29
,
0x39
,
0x68
,
0x11
,
0xe9
,
0xc
a
,
0xc6
,
0x27
,
0x08
,
0xbe
,
0x40
,
0x68
,
0xc4
,
0xfd
,
0x74
,
0xba
,
0x35
,
0x81
,
0xce
,
0x54
,
0xd1
,
0xc
5
,
0x27
,
0x28
,
0x3e
,
0x80
,
0x65
,
0x0f
,
0xde
,
0x37
,
0xc9
,
0x5a
,
0x22
,
0xdb
,
0xcc
,
0xb2
,
0x3b
,
0x
17
,
0x21
,
0x2f
,
0xe0
,
0x13
,
0xfa
,
0x40
,
0xd2
,
0x35
,
0x09
,
0xb9
,
0x28
,
0xb8
,
0x9b
,
0xf3
,
0xcd
,
0x
2b
,
0xf4
,
0x05
,
0x7c
,
0x54
,
0x9f
,
0x43
,
0x32
,
0xdb
,
0xd2
,
0xda
,
0x08
,
0xde
,
0x32
,
0xdf
,
0x7e
,
0x
07
,
0x73
,
0x4e
,
0x31
,
0x30
,
0x75
,
0x2b
,
0xda
,
0x6e
,
0xa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,
0x1e
,
0xa6
,
0x82
,
0xf2
,
0xe7
,
0xc4
,
0xeb
,
0x06
,
0x9c
,
0xc3
,
0xbc
,
0xb1
,
0x2b
,
0x2c
,
0x
e1
,
0xf8
,
0x04
,
0x37
,
0x89
,
0xa5
,
0xbb
,
0x25
,
0x39
,
0xad
,
0xd1
,
0x7d
,
0xc0
,
0x7b
,
0xb8
,
0x72
,
0x
4a
,
0x37
,
0xe1
,
0x84
,
0xe0
,
0x03
,
0x5c
,
0xb3
,
0x27
,
0xa6
,
0xd0
,
0xb8
,
0xc5
,
0x96
,
0x52
,
0x1b
,
0x
b1
,
0x78
,
0x95
,
0xfa
,
0xa4
,
0xa6
,
0x85
,
0x4e
,
0xa8
,
0x78
,
0x9e
,
0x1c
,
0x05
,
0x6d
,
0x97
,
0x1b
,
0x
65
,
0x48
,
0x5f
,
0x5d
,
0x50
,
0x9c
,
0x03
,
0x72
,
0xd2
,
0x5d
,
0x78
,
0x59
,
0x7b
,
0x1b
,
0xd6
,
0xe4
,
0x
8a
,
0x0d
,
0xcb
,
0x6a
,
0x7d
,
0x75
,
0x42
,
0x71
,
0x01
,
0x68
,
0xb5
,
0x5f
,
0x9b
,
0x95
,
0xa7
,
0x0f
,
0x
4c
,
0x39
,
0x14
,
0xf7
,
0x97
,
0x37
,
0xfa
,
0x9f
,
0xfc
,
0x1f
,
0x4f
,
0xdf
,
0x01
,
0x00
,
0x00
,
0xff
,
0x
53
,
0xf2
,
0xce
,
0x1d
,
0x8a
,
0xfb
,
0xc7
,
0x4b
,
0x71
,
0x26
,
0x7f
,
0xcc
,
0xf3
,
0x4f
,
0x00
,
0x00
,
0x
ff
,
0x8a
,
0x95
,
0x5e
,
0xd6
,
0x30
,
0x02
,
0x00
,
0x00
,
0x
00
,
0xff
,
0xff
,
0x39
,
0xcc
,
0x0c
,
0x6d
,
0x42
,
0x02
,
0x00
,
0x00
,
}
}
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