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
644a26e3
Commit
644a26e3
authored
Jul 12, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add prob project
parent
dba1186c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
36 deletions
+49
-36
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+20
-18
projectaction.go
plugin/dapp/autonomy/executor/projectaction.go
+0
-0
lcommon.proto
plugin/dapp/autonomy/proto/lcommon.proto
+4
-2
lcommon.pb.go
plugin/dapp/autonomy/types/lcommon.pb.go
+25
-16
No files found.
plugin/dapp/autonomy/executor/boardaction.go
View file @
644a26e3
...
...
@@ -160,6 +160,14 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
}
pre
:=
copyAutonomyProposalBoard
(
&
cur
)
// 检查当前状态
if
cur
.
Status
!=
auty
.
AutonomyStatusProposalBoard
&&
cur
.
Status
!=
auty
.
AutonomyStatusVotePropBoard
{
err
:=
auty
.
ErrProposalStatus
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"ProposalID"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
real
:=
cur
.
GetPropBoard
()
.
RealEndBlockHeight
...
...
@@ -170,14 +178,6 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
return
nil
,
err
}
// 检查当前状态
if
cur
.
Status
!=
auty
.
AutonomyStatusProposalBoard
&&
cur
.
Status
!=
auty
.
AutonomyStatusVotePropBoard
{
err
:=
auty
.
ErrProposalStatus
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"ProposalID"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
// 检查是否已经参与投票
var
votes
auty
.
VotesRecord
value
,
err
=
a
.
db
.
Get
(
VotesRecord
(
voteProb
.
ProposalID
))
...
...
@@ -224,7 +224,9 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
if
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
participationRate
&&
if
cur
.
VoteResult
.
TotalVotes
!=
0
&&
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
!=
0
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
/
float32
(
cur
.
VoteResult
.
TotalVotes
)
>=
participationRate
&&
float32
(
cur
.
VoteResult
.
ApproveVotes
)
/
float32
(
cur
.
VoteResult
.
ApproveVotes
+
cur
.
VoteResult
.
OpposeVotes
)
>=
approveRate
{
cur
.
VoteResult
.
Pass
=
true
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
...
...
@@ -281,15 +283,6 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
}
pre
:=
copyAutonomyProposalBoard
(
&
cur
)
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
if
a
.
height
<
end
&&
cur
.
Status
!=
auty
.
AutonomyStatusVotePropBoard
{
err
:=
auty
.
ErrTerminatePeriod
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"height"
,
a
.
height
,
"ProposalID"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
// 检查当前状态
if
cur
.
Status
==
auty
.
AutonomyStatusTmintPropBoard
{
err
:=
auty
.
ErrProposalStatus
...
...
@@ -298,6 +291,15 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
return
nil
,
err
}
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
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
)
return
nil
,
err
}
if
cur
.
GetVoteResult
()
.
TotalVotes
==
0
{
//需要统计票数
addr
:=
"16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account
,
err
:=
a
.
getStartHeightVoteAccount
(
addr
,
start
)
...
...
plugin/dapp/autonomy/executor/projectaction.go
View file @
644a26e3
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/proto/lcommon.proto
View file @
644a26e3
...
...
@@ -20,10 +20,12 @@ message VoteResult {
message
PublicVote
{
// 是否需要公示
bool
publicity
=
1
;
// 总票数
int32
totalVotes
=
2
;
// 全体持票人反对票
int32
opposeVotes
=
2
;
int32
opposeVotes
=
3
;
// 是否通过
bool
pubPass
=
3
;
bool
pubPass
=
4
;
}
message
VotesRecord
{
...
...
plugin/dapp/autonomy/types/lcommon.pb.go
View file @
644a26e3
...
...
@@ -59,10 +59,12 @@ func (m *VoteResult) GetPass() bool {
type
PublicVote
struct
{
// 是否需要公示
Publicity
bool
`protobuf:"varint,1,opt,name=publicity" json:"publicity,omitempty"`
// 总票数
TotalVotes
int32
`protobuf:"varint,2,opt,name=totalVotes" json:"totalVotes,omitempty"`
// 全体持票人反对票
OpposeVotes
int32
`protobuf:"varint,
2
,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
OpposeVotes
int32
`protobuf:"varint,
3
,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
PubPass
bool
`protobuf:"varint,
3
,opt,name=pubPass" json:"pubPass,omitempty"`
PubPass
bool
`protobuf:"varint,
4
,opt,name=pubPass" json:"pubPass,omitempty"`
}
func
(
m
*
PublicVote
)
Reset
()
{
*
m
=
PublicVote
{}
}
...
...
@@ -77,6 +79,13 @@ func (m *PublicVote) GetPublicity() bool {
return
false
}
func
(
m
*
PublicVote
)
GetTotalVotes
()
int32
{
if
m
!=
nil
{
return
m
.
TotalVotes
}
return
0
}
func
(
m
*
PublicVote
)
GetOpposeVotes
()
int32
{
if
m
!=
nil
{
return
m
.
OpposeVotes
...
...
@@ -116,18 +125,18 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor2
)
}
var
fileDescriptor2
=
[]
byte
{
// 20
5
bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x
64
,
0x90
,
0xcd
,
0x4e
,
0x85
,
0x30
,
0x10
,
0x
85
,
0x53
,
0x7e
,
0x14
,
0x06
,
0xdd
,
0x74
,
0xc5
,
0xc2
,
0x18
,
0xd2
,
0x8d
,
0xac
,
0xdc
,
0xf8
,
0x
22
,
0xa4
,
0x0b
,
0xf7
,
0x05
,
0x6a
,
0x42
,
0x52
,
0x9c
,
0x49
,
0x5b
,
0x4c
,
0x78
,
0x01
,
0x9f
,
0xdb
,
0x7
4
,
0x94
,
0xc8
,
0xbd
,
0x77
,
0xd7
,
0xf3
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
0xe1
,
0x91
,
0x
d6
,
0xa1
,
0x3f
,
0x2a
,
0xf6
,
0xd9
,
0xbe
,
0x41
,
0xc5
,
0x8a
,
0x32
,
0x23
,
0xba
,
0x29
,
0x8a
,
0x7a
,
0x
9a
,
0x9c
,
0xf1
,
0xf1
,
0x1d
,
0x69
,
0x57
,
0xaa
,
0x7d
,
0x0e
,
0x0f
,
0xfc
,
0xc8
,
0x8f
,
0xdf
,
0x00
,
0x00
,
0x00
,
0x
ff
,
0xff
,
0x86
,
0x6a
,
0x7e
,
0x62
,
0x59
,
0x01
,
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