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
0b56fd16
Commit
0b56fd16
authored
Jul 11, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test and modify bug
parent
43b37845
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
19 deletions
+23
-19
autonomy.go
plugin/dapp/autonomy/executor/autonomy.go
+6
-2
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+15
-15
boardaction_test.go
plugin/dapp/autonomy/executor/boardaction_test.go
+0
-0
errors.go
plugin/dapp/autonomy/types/errors.go
+2
-2
No files found.
plugin/dapp/autonomy/executor/autonomy.go
View file @
0b56fd16
...
...
@@ -9,11 +9,15 @@ import (
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/33cn/chain33/common/address"
)
var
alog
=
log
.
New
(
"module"
,
"execs.autonomy"
)
var
(
alog
=
log
.
New
(
"module"
,
"execs.autonomy"
)
driverName
=
auty
.
AutonomyX
autonomyAddr
=
address
.
ExecAddress
(
auty
.
AutonomyX
)
)
var
driverName
=
auty
.
AutonomyX
func
init
()
{
ety
:=
types
.
LoadExecutorType
(
driverName
)
...
...
plugin/dapp/autonomy/executor/boardaction.go
View file @
0b56fd16
...
...
@@ -229,16 +229,16 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
cur
.
Res
.
Pass
=
true
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
aut
y
.
AutonomyX
,
a
.
execaddr
,
lockAmount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
aut
onomyAddr
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecTransferFrozen amount fail"
,
err
)
alog
.
Error
(
"votePropBoard "
,
"addr"
,
cur
.
Address
,
"execaddr"
,
a
.
execaddr
,
"ExecTransferFrozen amount fail"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
key
:=
propBoardID
(
common
.
ToHex
(
a
.
txhash
)
)
key
:=
propBoardID
(
voteProb
.
ProposalID
)
cur
.
Status
=
auty
.
AutonomyStatusVotePropBoard
if
cur
.
Res
.
Pass
{
cur
.
Status
=
auty
.
AutonomyStatusTmintPropBoard
...
...
@@ -263,32 +263,32 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
// 获取GameID
value
,
err
:=
a
.
db
.
Get
(
propBoardID
(
tmintProb
.
ProposalID
))
if
err
!=
nil
{
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"get
round
failed"
,
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"get
propBoardID
failed"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
var
cur
auty
.
AutonomyProposalBoard
err
=
types
.
Decode
(
value
,
&
cur
)
if
err
!=
nil
{
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"decode
roun
d failed"
,
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"decode
AutonomyProposalBoar
d failed"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
pre
:=
copyAutonomyProposalBoard
(
&
cur
)
// 检查当前状态
if
cur
.
Status
!=
auty
.
AutonomyStatusVotePropBoard
{
err
:=
auty
.
ErrProposalStatus
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"status is not match"
,
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
}
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
if
a
.
height
>
end
{
err
:=
auty
.
ErrRevokeProposalPeriod
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ProposalID"
,
// 检查当前状态
if
cur
.
Status
==
auty
.
AutonomyStatusTmintPropBoard
{
err
:=
auty
.
ErrProposalStatus
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"status is not match"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
...
...
@@ -312,7 +312,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
aut
y
.
AutonomyX
,
a
.
execaddr
,
lockAmount
)
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
aut
onomyAddr
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecTransferFrozen amount fail"
,
err
)
return
nil
,
err
...
...
plugin/dapp/autonomy/executor/boardaction_test.go
View file @
0b56fd16
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/errors.go
View file @
0b56fd16
...
...
@@ -17,6 +17,6 @@ var (
ErrRevokeProposalPeriod
=
errors
.
New
(
"ErrRevokeProposalPeriod"
)
// ErrRevokeProposalPower 不能取消
ErrRevokeProposalPower
=
errors
.
New
(
"ErrRevokeProposalPower"
)
// Err
RevokeProposal 不能取消
//ErrRevokeProposal = errors.New("ErrRevokeProposal
")
// Err
TerminatePeriod 不能终止
ErrTerminatePeriod
=
errors
.
New
(
"ErrTerminatePeriod
"
)
)
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