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
af694733
Commit
af694733
authored
Jul 09, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add proposal board
parent
aa055772
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
4197 additions
and
0 deletions
+4197
-0
Makefile
plugin/dapp/autonomy/cmd/Makefile
+4
-0
build.sh
plugin/dapp/autonomy/cmd/build.sh
+16
-0
test-rpc.sh
plugin/dapp/autonomy/cmd/build/test-rpc.sh
+153
-0
testcase.sh
plugin/dapp/autonomy/cmd/build/testcase.sh
+70
-0
proposal_board.go
plugin/dapp/autonomy/commands/proposal_board.go
+414
-0
proposal_project.go
plugin/dapp/autonomy/commands/proposal_project.go
+7
-0
proposal_rule.go
plugin/dapp/autonomy/commands/proposal_rule.go
+5
-0
doc.go
plugin/dapp/autonomy/doc.go
+37
-0
autonomy.go
plugin/dapp/autonomy/executor/autonomy.go
+48
-0
board.go
plugin/dapp/autonomy/executor/board.go
+95
-0
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+374
-0
exec.go
plugin/dapp/autonomy/executor/exec.go
+35
-0
exec_del_local.go
plugin/dapp/autonomy/executor/exec_del_local.go
+30
-0
exec_local.go
plugin/dapp/autonomy/executor/exec_local.go
+30
-0
exec_test.go
plugin/dapp/autonomy/executor/exec_test.go
+282
-0
kv.go
plugin/dapp/autonomy/executor/kv.go
+37
-0
query.go
plugin/dapp/autonomy/executor/query.go
+19
-0
plugin.go
plugin/dapp/autonomy/plugin.go
+23
-0
Makefile
plugin/dapp/autonomy/proto/Makefile
+2
-0
autonomy.proto
plugin/dapp/autonomy/proto/autonomy.proto
+41
-0
board.proto
plugin/dapp/autonomy/proto/board.proto
+71
-0
create_protobuf.sh
plugin/dapp/autonomy/proto/create_protobuf.sh
+2
-0
lcommon.proto
plugin/dapp/autonomy/proto/lcommon.proto
+23
-0
project.proto
plugin/dapp/autonomy/proto/project.proto
+77
-0
rule.proto
plugin/dapp/autonomy/proto/rule.proto
+65
-0
jrpc.go
plugin/dapp/autonomy/rpc/jrpc.go
+54
-0
jrpc_channel_test.go
plugin/dapp/autonomy/rpc/jrpc_channel_test.go
+115
-0
rpc.go
plugin/dapp/autonomy/rpc/rpc.go
+58
-0
types.go
plugin/dapp/autonomy/rpc/types.go
+30
-0
autonomy.pb.go
plugin/dapp/autonomy/types/autonomy.pb.go
+680
-0
board.pb.go
plugin/dapp/autonomy/types/board.pb.go
+325
-0
const.go
plugin/dapp/autonomy/types/const.go
+87
-0
errors.go
plugin/dapp/autonomy/types/errors.go
+22
-0
lcommon.pb.go
plugin/dapp/autonomy/types/lcommon.pb.go
+95
-0
project.pb.go
plugin/dapp/autonomy/types/project.pb.go
+374
-0
rule.pb.go
plugin/dapp/autonomy/types/rule.pb.go
+307
-0
types.go
plugin/dapp/autonomy/types/types.go
+90
-0
No files found.
plugin/dapp/autonomy/cmd/Makefile
0 → 100644
View file @
af694733
all
:
chmod
+x ./build.sh
./build.sh
$(OUT)
$(FLAG)
\ No newline at end of file
plugin/dapp/autonomy/cmd/build.sh
0 → 100755
View file @
af694733
#!/usr/bin/env bash
output_dir
=
${
1
}
strpwd
=
$(
pwd
)
strcmd
=
${
strpwd
##*dapp/
}
strapp
=
${
strcmd
%/cmd*
}
OUT_DIR
=
"
${
output_dir
}
/
$strapp
"
[
!
-e
"
${
OUT_DIR
}
"
]
&&
mkdir
-p
"
${
OUT_DIR
}
"
# shellcheck disable=SC2086
cp
./build/
*
"
${
OUT_DIR
}
"
OUT_TESTDIR
=
"
${
1
}
/dapptest/
$strapp
"
mkdir
-p
"
${
OUT_TESTDIR
}
"
cp
./build/test-rpc.sh
"
${
OUT_TESTDIR
}
"
plugin/dapp/autonomy/cmd/build/test-rpc.sh
0 → 100755
View file @
af694733
#!/usr/bin/env bash
# shellcheck disable=SC2128
# shellcheck source=/dev/null
source
../dapp-test-common.sh
MAIN_HTTP
=
""
txhash
=
""
function
query_unfreezeID
()
{
chain33_BlockWait 1
"
$MAIN_HTTP
"
# echo "req=$req"
local times
=
10
while
true
;
do
req
=
'{"method":"Chain33.QueryTransaction","params":[{"hash":"'
"
$txhash
"
'"}]}'
ret
=
$(
curl
-ksd
"
$req
"
${
MAIN_HTTP
})
tx
=
$(
jq
-r
".result.tx.hash"
<<<
"
$ret
"
)
echo
"====query tx=
${
txhash
}
, return=
$ret
"
if
[
"
${
tx
}
"
!=
"
${
txhash
}
"
]
;
then
block_wait 1
times
=
$((
times
-
1
))
if
[
$times
-le
0
]
;
then
echo
"====query tx=
$txhash
failed"
echo
"req=
$req
"
curl
-ksd
"
$req
"
${
MAIN_HTTP
}
exit
1
fi
else
unfreeze_id
=
$(
jq
'(.result.receipt.logs['
"
$uid_index
"
'].log.current.unfreezeID)'
<<<
"
$ret
"
)
#echo "${unfreeze_id}"
unfreeze_id2
=
${
unfreeze_id
#\
"mavl-unfreeze-}
uid=
${
unfreeze_id2
%\
"}
echo "
====query tx=
$txhash
success
"
break
fi
done
}
function init() {
ispara=
$(
echo
'"'
"
${
MAIN_HTTP
}
"
'"'
| jq
'.|contains("8901")'
)
echo "
ipara
=
$ispara
"
exec_name="
unfreeze
"
uid_index=2
if [ "
$ispara
" == true ]; then
exec_name="
user
.p.para.
"
${
exec_name
}
uid_index=1
fi
exec_addr=
$(
curl
-ksd
'{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"'
${
exec_name
}
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
echo "
exec_addr
=
${
exec_addr
}
"
beneficiary=12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
beneficiary_key=0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01
owner=14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
owner_key=CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944
#unfreeze_exec_addr=15YsqAuXeEXVHgm6RVx4oJaAAnhtwqnu3H
Chain33_SendToAddress "
$owner
" "
$exec_addr
" 500000000 "
${
MAIN_HTTP
}
"
Chain33_SendToAddress "
$beneficiary
" "
$exec_addr
" 500000000 "
${
MAIN_HTTP
}
"
block_wait 1
}
function CreateRawUnfreezeCreate() {
req='{"
jsonrpc
": "
2
.0
", "
method
" : "
unfreeze
.CreateRawUnfreezeCreate
" , "
params
":[{"
startTime
":10000,"
assetExec
":"
coins
","
assetSymbol
":"
bty
","
totalCount
":400000000,"
beneficiary
":"
'$beneficiary'
","
means
":"
FixAmount
","
fixAmount
": {"
period
":10,"
amount
":1000000}}]}'
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
ok=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[ "
$ok
" == true ]
echo_rst "
$FUNCNAME
" "
$?
"
rawtx=
$(
jq
-r
".result"
<<<
"
$resp
"
)
chain33_SignRawTx "
$rawtx
" "
$owner_key
" "
${
MAIN_HTTP
}
"
query_unfreezeID
}
function CreateRawUnfreezeWithdraw() {
sleep 10
req='{"
method
":"
unfreeze
.CreateRawUnfreezeWithdraw
","
params
":[{"
unfreezeID
":"
'${uid}'
"}]}'
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
ok=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[ "
$ok
" == true ]
echo_rst "
$FUNCNAME
" "
$?
"
rawtx=
$(
jq
-r
".result"
<<<
"
$resp
"
)
chain33_SignRawTx "
$rawtx
" "
${
beneficiary_key
}
" "
${
MAIN_HTTP
}
"
}
function CreateRawUnfreezeTerminate() {
req='{"
method
":"
unfreeze
.CreateRawUnfreezeTerminate
","
params
":[{"
unfreezeID
":"
'${uid}'
"}]}'
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
ok=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[ "
$ok
" == true ]
echo_rst "
$FUNCNAME
" "
$?
"
rawtx=
$(
jq
-r
".result"
<<<
"
$resp
"
)
chain33_SignRawTx "
$rawtx
" "
$owner_key
" "
${
MAIN_HTTP
}
"
block_wait 2
}
function GetUnfreeze() {
req='{"
method
":"
unfreeze
.GetUnfreeze
","
params
":[{"
data
":"
'${uid}'
"}]}'
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
ok=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[ "
$ok
" == true ]
echo_rst "
$FUNCNAME
" "
$?
"
}
function GetUnfreezeWithdraw() {
req='{"
method
":"
unfreeze
.GetUnfreezeWithdraw
","
params
":[{"
data
":"
'${uid}'
"}]}'
# echo "
#request
:
$req
"
resp=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
# echo "
#resp
:
$resp
"
ok=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[ "
$ok
" == true ]
echo_rst "
$FUNCNAME
" "
$?
"
}
function run_testcases() {
CreateRawUnfreezeCreate
CreateRawUnfreezeWithdraw
GetUnfreeze
GetUnfreezeWithdraw
CreateRawUnfreezeTerminate
}
function debug_function() {
set -x
eval "
$@
"
set +x
}
function rpc_test() {
MAIN_HTTP="
$1
"
echo "
main_ip
=
$MAIN_HTTP
"
init
run_testcases
if [ -n "
$CASE_ERR
" ]; then
echo "
=======unfreeze rpc test error ===========
"
exit 1
else
echo "
====== unfreeze rpc test pass ===========
"
fi
}
debug_function rpc_test "
$1
"
plugin/dapp/autonomy/cmd/build/testcase.sh
0 → 100755
View file @
af694733
#!/usr/bin/env bash
CLI
=
"docker exec
${
NODE3
}
/root/chain33-cli"
beneficiary
=
12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv
beneficiary_key
=
0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01
#owner=14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
owner_key
=
CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944
unfreeze_exec_addr
=
15YsqAuXeEXVHgm6RVx4oJaAAnhtwqnu3H
function
unfreeze_test
()
{
echo
"=========== # unfreeze test ============="
echo
"=== 1 check exec addr"
result
=
$(
$CLI
exec
addr
-e
unfreeze
)
if
[
"
${
result
}
"
!=
"
${
unfreeze_exec_addr
}
"
]
;
then
echo
"unfreeze exec addr is not right, expect
${
unfreeze_exec_addr
}
result
${
result
}
"
exit
1
fi
block_wait
"
${
CLI
}
"
2
echo
"=== 2 prepare: transfer bty to unfreeze "
result
=
$(
$CLI
send coins transfer
-a
5
-n
test
-t
${
unfreeze_exec_addr
}
-k
${
owner_key
})
echo
"
${
result
}
"
block_wait
"
${
CLI
}
"
2
echo
"=== 3 create unfreeze tx"
tx_hash
=
$(${
CLI
}
send unfreeze create fix_amount
-a
0.01
-e
coins
-s
bty
-b
${
beneficiary
}
-p
20
-t
2
-k
${
owner_key
})
block_wait
"
${
CLI
}
"
2
unfreeze_id
=
$(${
CLI
}
tx query
-s
"
${
tx_hash
}
"
| jq
".receipt.logs[2].log.current.unfreezeID"
)
echo
"
${
unfreeze_id
}
"
unfreeze_id2
=
${
unfreeze_id
#\
"mavl-unfreeze-}
uid=
${
unfreeze_id2
%\
"}
echo "
==== 4 check some message
"
sleep 20
withdraw=
$(${
CLI
}
unfreeze show_withdraw
--id
"
${
uid
}
"
| jq
".availableAmount"
)
if [ "
${
withdraw
}
" = "
0
" ]; then
echo "
create
unfreeze failed, expect withdraw shoult >0
"
exit 1
fi
echo "
==== 5 withdraw
"
${
CLI
}
send unfreeze withdraw --id "
${
uid
}
" -k "
${
beneficiary_key
}
"
block_wait "
${
CLI
}
" 2
remaining=
$(${
CLI
}
unfreeze show
--id
"
${
uid
}
"
| jq
".remaining"
)
if [ "
${
remaining
}
" = '"
200000000
"' ]; then
echo "
withdraw
failed, expect remaining < 200000000, result
${
remaining
}
"
exit 1
fi
echo "
==== 6 termenate
"
${
CLI
}
send unfreeze terminate --id "
${
uid
}
" -k "
${
owner_key
}
"
block_wait "
${
CLI
}
" 2
remaining=
$(${
CLI
}
unfreeze show
--id
"
${
uid
}
"
| jq
".remaining"
)
remainingNum=
$(
echo
"
$remaining
"
|
awk
'{print int($0)}'
)
if [ "
100000000
" -lt "
${
remainingNum
}
" ]; then
echo "
terminate
failed, expect remaining < 100000000, result
${
remaining
}
"
exit 1
fi
echo "
==================== unfreeze test end
"
}
function unfreeze() {
if [ "
${
2
}
" == "
init
" ]; then
return
elif [ "
${
2
}
" == "
config
" ]; then
return
elif [ "
${
2
}
" == "
test
" ]; then
unfreeze_test "
${
1
}
"
fi
}
plugin/dapp/autonomy/commands/proposal_board.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
commands
import
(
"bytes"
"encoding/json"
"fmt"
"math"
"os"
"strings"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/spf13/cobra"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// Cmd autonomy 客户端主程序
func
Cmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"autonomy"
,
Short
:
"autonomy construct management"
,
Args
:
cobra
.
MinimumNArgs
(
1
),
}
cmd
.
AddCommand
(
createCmd
())
cmd
.
AddCommand
(
withdrawCmd
())
cmd
.
AddCommand
(
terminateCmd
())
cmd
.
AddCommand
(
showCmd
())
cmd
.
AddCommand
(
queryWithdrawCmd
())
cmd
.
AddCommand
(
listautonomyCmd
())
return
cmd
}
func
createCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"create"
,
Short
:
"create autonomy construct"
,
}
cmd
.
AddCommand
(
fixAmountCmd
())
cmd
.
AddCommand
(
leftCmd
())
return
cmd
}
func
createFlag
(
cmd
*
cobra
.
Command
)
*
cobra
.
Command
{
cmd
.
PersistentFlags
()
.
StringP
(
"beneficiary"
,
"b"
,
""
,
"address of beneficiary"
)
cmd
.
MarkFlagRequired
(
"beneficiary"
)
cmd
.
PersistentFlags
()
.
StringP
(
"asset_exec"
,
"e"
,
""
,
"asset exec"
)
cmd
.
MarkFlagRequired
(
"asset_exec"
)
cmd
.
PersistentFlags
()
.
StringP
(
"asset_symbol"
,
"s"
,
""
,
"asset symbol"
)
cmd
.
MarkFlagRequired
(
"asset_symbol"
)
cmd
.
PersistentFlags
()
.
Float64P
(
"total"
,
"t"
,
0
,
"total count of asset"
)
cmd
.
MarkFlagRequired
(
"total"
)
cmd
.
PersistentFlags
()
.
Int64P
(
"start_ts"
,
""
,
0
,
"effect, UTC timestamp"
)
//cmd.MarkFlagRequired("start_ts")
return
cmd
}
func
checkAmount
(
amount
float64
)
error
{
if
amount
<
0
||
amount
>
float64
(
types
.
MaxCoin
/
types
.
Coin
)
{
return
types
.
ErrAmount
}
return
nil
}
func
getCreateFlags
(
cmd
*
cobra
.
Command
)
(
*
pty
.
autonomyCreate
,
error
)
{
beneficiary
,
_
:=
cmd
.
Flags
()
.
GetString
(
"beneficiary"
)
exec
,
_
:=
cmd
.
Flags
()
.
GetString
(
"asset_exec"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"asset_symbol"
)
total
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"total"
)
startTs
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"start_ts"
)
if
err
:=
checkAmount
(
total
);
err
!=
nil
{
return
nil
,
types
.
ErrAmount
}
totalInt64
:=
int64
(
math
.
Trunc
((
total
+
0.0000001
)
*
1e4
))
*
1e4
autonomy
:=
&
pty
.
autonomyCreate
{
StartTime
:
startTs
,
AssetExec
:
exec
,
AssetSymbol
:
symbol
,
TotalCount
:
totalInt64
,
Beneficiary
:
beneficiary
,
Means
:
""
,
}
return
autonomy
,
nil
}
func
fixAmountCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"fix_amount"
,
Short
:
"create fix amount means autonomy construct"
,
Run
:
fixAmount
,
}
cmd
=
createFlag
(
cmd
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
0
,
"amount every period"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Int64P
(
"period"
,
"p"
,
0
,
"period in second"
)
cmd
.
MarkFlagRequired
(
"period"
)
return
cmd
}
func
fixAmount
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
create
,
err
:=
getCreateFlags
(
cmd
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
if
err
=
checkAmount
(
amount
);
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
amountInt64
:=
int64
(
math
.
Trunc
((
amount
+
0.0000001
)
*
1e4
))
*
1e4
period
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"period"
)
if
period
<=
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"period must be positive integer"
)
return
}
if
create
.
TotalCount
<=
amountInt64
{
fmt
.
Fprintf
(
os
.
Stderr
,
"total must bigger than amount"
)
return
}
create
.
Means
=
pty
.
FixAmountX
create
.
MeansOpt
=
&
pty
.
autonomyCreate_FixAmount
{
FixAmount
:
&
pty
.
FixAmount
{
Period
:
period
,
Amount
:
amountInt64
}}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
autonomyX
),
ActionName
:
"createautonomy"
,
Payload
:
types
.
MustPBToJSON
(
create
),
}
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
leftCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"left_proportion"
,
Short
:
"create left proportion means autonomy construct"
,
Run
:
left
,
}
cmd
=
createFlag
(
cmd
)
cmd
.
Flags
()
.
Int64P
(
"ten_thousandth"
,
""
,
0
,
"input/10000 of total"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Int64P
(
"period"
,
"p"
,
0
,
"period in second"
)
cmd
.
MarkFlagRequired
(
"period"
)
return
cmd
}
func
left
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
create
,
err
:=
getCreateFlags
(
cmd
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
tenThousandth
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"ten_thousandth"
)
period
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"period"
)
create
.
Means
=
pty
.
LeftProportionX
create
.
MeansOpt
=
&
pty
.
autonomyCreate_LeftProportion
{
LeftProportion
:
&
pty
.
LeftProportion
{
Period
:
period
,
TenThousandth
:
tenThousandth
}}
if
period
<=
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"period must be positive interge"
)
return
}
if
tenThousandth
<=
0
||
tenThousandth
>=
10000
{
fmt
.
Fprintf
(
os
.
Stderr
,
"tenThousandth must be 0~10000"
)
return
}
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
autonomyX
),
ActionName
:
pty
.
Action_Createautonomy
,
Payload
:
types
.
MustPBToJSON
(
create
),
}
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
withdrawCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"withdraw"
,
Short
:
"withdraw asset from construct"
,
Run
:
withdraw
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"autonomy construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
terminateCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"terminate"
,
Short
:
"terminate construct"
,
Run
:
terminate
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"autonomy construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
showCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"show"
,
Short
:
"show construct"
,
Run
:
show
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"autonomy construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
queryWithdrawCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"show_withdraw"
,
Short
:
"show available withdraw amount of one autonomy construct"
,
Run
:
queryWithdraw
,
}
cmd
.
Flags
()
.
StringP
(
"id"
,
""
,
""
,
"autonomy construct id"
)
cmd
.
MarkFlagRequired
(
"id"
)
return
cmd
}
func
withdraw
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
autonomyX
),
ActionName
:
pty
.
Action_Withdrawautonomy
,
Payload
:
types
.
MustPBToJSON
(
&
pty
.
autonomyWithdraw
{
autonomyID
:
id
}),
}
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
terminate
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
autonomyX
),
ActionName
:
pty
.
Action_Terminateautonomy
,
Payload
:
types
.
MustPBToJSON
(
&
pty
.
autonomyTerminate
{
autonomyID
:
id
}),
}
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
queryWithdraw
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
cli
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
param
:=
&
rpctypes
.
Query4Jrpc
{
Execer
:
getRealExecName
(
paraName
,
pty
.
autonomyX
),
FuncName
:
"GetautonomyWithdraw"
,
Payload
:
types
.
MustPBToJSON
(
&
types
.
ReqString
{
Data
:
id
}),
}
var
resp
pty
.
ReplyQueryautonomyWithdraw
err
=
cli
.
Call
(
"Chain33.Query"
,
param
,
&
resp
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
jsonOutput
(
&
resp
)
}
func
show
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
cli
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
param
:=
&
rpctypes
.
Query4Jrpc
{
Execer
:
getRealExecName
(
paraName
,
pty
.
autonomyX
),
FuncName
:
"Getautonomy"
,
Payload
:
types
.
MustPBToJSON
(
&
types
.
ReqString
{
Data
:
id
}),
}
var
resp
pty
.
autonomy
err
=
cli
.
Call
(
"Chain33.Query"
,
param
,
&
resp
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
jsonOutput
(
&
resp
)
}
func
getRealExecName
(
paraName
string
,
name
string
)
string
{
if
strings
.
HasPrefix
(
name
,
"user.p."
)
{
return
name
}
return
paraName
+
name
}
func
jsonOutput
(
resp
types
.
Message
)
{
data
,
err
:=
types
.
PBToJSON
(
resp
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
var
buf
bytes
.
Buffer
err
=
json
.
Indent
(
&
buf
,
data
,
""
,
" "
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
fmt
.
Println
(
buf
.
String
())
}
func
listautonomyCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"list"
,
Short
:
"list autonomy"
,
Run
:
listautonomy
,
}
cmd
.
Flags
()
.
StringP
(
"last_key"
,
"l"
,
""
,
"last key"
)
cmd
.
Flags
()
.
Int32P
(
"count"
,
""
,
10
,
"list count"
)
cmd
.
Flags
()
.
Int32P
(
"direction"
,
"d"
,
0
,
"list direction: 0/1"
)
cmd
.
Flags
()
.
StringP
(
"create"
,
"c"
,
""
,
"list by creator"
)
cmd
.
Flags
()
.
StringP
(
"beneficiary"
,
"b"
,
""
,
"list by beneficiary"
)
return
cmd
}
func
listautonomy
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
create
,
_
:=
cmd
.
Flags
()
.
GetString
(
"create"
)
beneficiary
,
_
:=
cmd
.
Flags
()
.
GetString
(
"beneficiary"
)
if
(
len
(
create
)
==
0
&&
len
(
beneficiary
)
==
0
)
||
(
len
(
create
)
>
0
&&
len
(
beneficiary
)
>
0
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"must assign one of create or beneficiary"
)
return
}
funcName
:=
"ListautonomyByBeneficiary"
if
len
(
create
)
>
0
{
funcName
=
"ListautonomyByCreator"
}
direction
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"direction"
)
count
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"count"
)
last_key
,
_
:=
cmd
.
Flags
()
.
GetString
(
"last_key"
)
req
:=
&
pty
.
Reqautonomys
{
Direction
:
direction
,
Count
:
count
,
FromKey
:
last_key
,
Initiator
:
create
,
Beneficiary
:
beneficiary
,
}
param
:=
&
rpctypes
.
Query4Jrpc
{
Execer
:
getRealExecName
(
paraName
,
pty
.
autonomyX
),
FuncName
:
funcName
,
Payload
:
types
.
MustPBToJSON
(
req
),
}
cli
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
var
resp
pty
.
Replyautonomys
err
=
cli
.
Call
(
"Chain33.Query"
,
param
,
&
resp
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
jsonOutput
(
&
resp
)
}
plugin/dapp/autonomy/commands/proposal_project.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
commands
plugin/dapp/autonomy/commands/proposal_rule.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
commands
plugin/dapp/autonomy/doc.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//Chain33投票治理系统旨在为chain33链提供一种社区发展自治的系统,可以由利益相关者制定规则。
//Chain33投票治理系统中参与投票治理主要由董事会以及全体持票人。
//董事会主要参与日常项目的执行决策;董事会的产生由提案人提案董事会成员(暂定30),由全体持票人投票,超过50%的持票进行投票,其中得票率超过50%
//即可认为该提案的董事会成员合法;董事会行使投票权利:针对某一提案,需要全体董事会成员三分之二以上成员参与,且需要参与成员中三分之二以上投赞成票,说明该提案通过董事会投票。
//根据提案示项目大小(金额,这个金额可以由全体持票人投票来定)来决定是否需要公示期:
//(1)对于小项目,则不需要进入公示期,董事会通过之后即可以进行项目开发。
//(2)对于大项目,则董事会成员通过之后,进入公示期,公示期期间(大约一周的区块高度),全体持票人可以对该项目投否决票,超过三分之一的全体持票人投否决票,则该提案视为不通过(后台服务提供消息注册提醒功能)
//全体持票人指全体持有比特元票的人。全体持票人主要负责:
//(1)选举董事会成员,对于提案的董事会成员进行投票
//(2)对于重大项目的否决权利,即对通过董事会成员投票进入公示期的重大项目有否决权利。
//(3)可以重新对董事会成员进行提案投票,一旦通过,则原有董事会成员权利自动失效。
//(4)可以重新对提案投票自治系统某些参数进行修改,一旦通过,则投票的判断以新参数为准。
//
//
//任何人可以消耗一定数量的费用(如1000)进行提案,提案的费用转入到发展基金中,提案的种类包括三种:
//(1)提案董事会成员,即提案董事会成员后投票形成董事会;
//1)提案董事会成员数目在[3 30]范围
//2)提案需要指定参与有效投票的区块高度区间。
//3)需全体持票50%进行投票且得票率超过50%即可认为该提案的董事会成员合法。
//
//(2)提案项目方案,提案后投票确定是否执行该项目;
//1)提案人跟具体线下承包方具有一定的绑定关系:
//a 承包商可以将营业执照、收款地址、身份证信息等注册到钱包或者其它的服务器上面;
//b 在某个承包商提交一个提案后,客户端获得(钱包或者服务器可以主动将该提案推送给董事会成员)该提案,并且与保存在钱包服务器中的承包商信息想匹配,给出参与投票人相关的提示;
//2)提案需要指定参与有效投票的区块高度区间
//3)需要按照要求在填入项目相关信息,包括项目地址、第一阶段提案hash(针对项目多阶段提案)、上一阶段提案hash(针对项目多阶段提案)、项目阶段性简述(md格式)、承包人、项目经费、经费细则(md格式)、收款地址。
//4)提案通过董事会之后,根据项目金额大小来决定是否进入公示期,公示期周期固定为1周的区块高度,从董事会实际投票结束的高度向后推算一周区块高度。有超过30%的否决票,则该提案不通过。
//5)根据每个不同阶段,完成的情况,追缴上一阶段的金额,开始阶段预付一定金额,最后一个阶段支付尾款,尾款的控制由董事会进行把控。
//6)董事会成员可以对提案进行评论,评论将以交易的形式提出并且与提案相关联,显示到提案区,参与评论的截止时间以实际提案结束投票高度为准。
//
//(3)提案投票自治系统参数修改,如达成董事会投票的参与率/通过率,全体持票人重大项目的否决率,提案费用,重大项目金额阈值的修改。
package
autonomy
plugin/dapp/autonomy/executor/autonomy.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
log
"github.com/33cn/chain33/common/log/log15"
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
var
alog
=
log
.
New
(
"module"
,
"execs.autonomy"
)
var
driverName
=
auty
.
AutonomyX
func
init
()
{
ety
:=
types
.
LoadExecutorType
(
driverName
)
ety
.
InitFuncList
(
types
.
ListMethod
(
&
Autonomy
{}))
}
// Init 重命名执行器名称
func
Init
(
name
string
,
sub
[]
byte
)
{
drivers
.
Register
(
GetName
(),
newAutonomy
,
types
.
GetDappFork
(
driverName
,
"Enable"
))
}
// Autonomy 执行器结构体
type
Autonomy
struct
{
drivers
.
DriverBase
}
func
newAutonomy
()
drivers
.
Driver
{
t
:=
&
Autonomy
{}
t
.
SetChild
(
t
)
t
.
SetExecutorType
(
types
.
LoadExecutorType
(
driverName
))
return
t
}
// GetName 获得执行器名字
func
GetName
()
string
{
return
newAutonomy
()
.
GetName
()
}
// GetDriverName 获得驱动名字
func
(
u
*
Autonomy
)
GetDriverName
()
string
{
return
driverName
}
plugin/dapp/autonomy/executor/board.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
func
(
a
*
Autonomy
)
execLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
var
set
[]
*
types
.
KeyValue
for
_
,
log
:=
range
receiptData
.
Logs
{
switch
log
.
Ty
{
case
auty
.
TyLogPropBoard
,
auty
.
TyLogRvkPropBoard
,
auty
.
TyLogVotePropBoard
,
auty
.
TyLogTmintPropBoard
:
{
var
receipt
auty
.
ReceiptProposalBoard
err
:=
types
.
Decode
(
log
.
Log
,
&
receipt
)
if
err
!=
nil
{
return
nil
,
err
}
kv
:=
a
.
saveHeightIndex
(
&
receipt
)
set
=
append
(
set
,
kv
...
)
}
default
:
break
}
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
set
...
)
return
dbSet
,
nil
}
func
(
c
*
Autonomy
)
saveHeightIndex
(
res
*
auty
.
ReceiptProposalBoard
)
(
kvs
[]
*
types
.
KeyValue
)
{
// 先将之前的状态删除掉,再做更新
if
res
.
Current
.
Status
>
1
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcBoardKey4StatusHeight
(
res
.
Prev
.
Status
,
dapp
.
HeightIndexStr
(
res
.
Prev
.
Height
,
int64
(
res
.
Prev
.
Index
)))
kv
.
Value
=
nil
kvs
=
append
(
kvs
,
kv
)
}
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcBoardKey4StatusHeight
(
res
.
Current
.
Status
,
dapp
.
HeightIndexStr
(
res
.
Current
.
Height
,
int64
(
res
.
Current
.
Index
)))
kv
.
Value
=
types
.
Encode
(
res
.
Current
)
kvs
=
append
(
kvs
,
kv
)
return
kvs
}
func
(
a
*
Autonomy
)
execDelLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
var
set
[]
*
types
.
KeyValue
for
_
,
log
:=
range
receiptData
.
Logs
{
switch
log
.
Ty
{
case
auty
.
TyLogPropBoard
,
auty
.
TyLogRvkPropBoard
,
auty
.
TyLogVotePropBoard
,
auty
.
TyLogTmintPropBoard
:
{
var
receipt
auty
.
ReceiptProposalBoard
err
:=
types
.
Decode
(
log
.
Log
,
&
receipt
)
if
err
!=
nil
{
return
nil
,
err
}
kv
:=
a
.
delHeightIndex
(
&
receipt
)
set
=
append
(
set
,
kv
...
)
}
default
:
break
}
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
set
...
)
return
dbSet
,
nil
}
func
(
c
*
Autonomy
)
delHeightIndex
(
res
*
auty
.
ReceiptProposalBoard
)
(
kvs
[]
*
types
.
KeyValue
)
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcBoardKey4StatusHeight
(
res
.
Current
.
Status
,
dapp
.
HeightIndexStr
(
res
.
Current
.
Height
,
int64
(
res
.
Current
.
Index
)))
kv
.
Value
=
nil
kvs
=
append
(
kvs
,
kv
)
if
res
.
Current
.
Status
>
1
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcBoardKey4StatusHeight
(
res
.
Prev
.
Status
,
dapp
.
HeightIndexStr
(
res
.
Prev
.
Height
,
int64
(
res
.
Prev
.
Index
)))
kv
.
Value
=
types
.
Encode
(
res
.
Prev
)
kvs
=
append
(
kvs
,
kv
)
}
return
kvs
}
\ No newline at end of file
plugin/dapp/autonomy/executor/boardaction.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/client"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
const
(
minBoards
=
3
maxBoards
=
30
lockAmount
int64
=
types
.
Coin
*
1000
//创建者消耗金额
ticketPrice
=
types
.
Coin
*
3000
// 单张票价
participationRate
=
float32
(
2
)
/
float32
(
3
)
//参与率
approveRate
=
float32
(
2
)
/
float32
(
3
)
//赞成率
)
type
action
struct
{
api
client
.
QueueProtocolAPI
coinsAccount
*
account
.
DB
db
dbm
.
KV
txhash
[]
byte
fromaddr
string
blocktime
int64
height
int64
index
int32
execaddr
string
}
func
newAction
(
a
*
Autonomy
,
tx
*
types
.
Transaction
,
index
int32
)
*
action
{
hash
:=
tx
.
Hash
()
fromaddr
:=
tx
.
From
()
return
&
action
{
a
.
GetAPI
(),
a
.
GetCoinsAccount
(),
a
.
GetStateDB
(),
hash
,
fromaddr
,
a
.
GetBlockTime
(),
a
.
GetHeight
(),
index
,
dapp
.
ExecAddress
(
string
(
tx
.
Execer
))}
}
func
(
a
*
action
)
propBoard
(
prob
*
auty
.
ProposalBoard
)
(
*
types
.
Receipt
,
error
)
{
if
len
(
prob
.
Boards
)
>
maxBoards
||
len
(
prob
.
Boards
)
<
minBoards
{
return
nil
,
types
.
ErrInvalidParam
}
if
prob
.
StartBlockHeight
<
a
.
height
||
prob
.
EndBlockHeight
<
a
.
height
{
return
nil
,
types
.
ErrInvalidParam
}
receipt
,
err
:=
a
.
coinsAccount
.
ExecFrozen
(
a
.
fromaddr
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"propBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecFrozen amount"
,
lockAmount
)
return
nil
,
err
}
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
cur
:=
&
auty
.
AutonomyProposalBoard
{
PropBoard
:
prob
,
Res
:
&
auty
.
VotesResult
{},
Status
:
auty
.
AutonomyStatusProposalBoard
,
Address
:
a
.
fromaddr
,
Height
:
a
.
height
,
Index
:
a
.
index
,
}
key
:=
propBoardID
(
common
.
ToHex
(
a
.
txhash
))
value
:=
types
.
Encode
(
cur
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
value
})
receiptLog
:=
a
.
GetReceiptLog
(
nil
,
cur
,
auty
.
TyLogPropBoard
)
logs
=
append
(
logs
,
receiptLog
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
a
*
action
)
rvkPropBoard
(
rvkProb
*
auty
.
RevokeProposalBoard
)
(
*
types
.
Receipt
,
error
)
{
// 获取GameID
value
,
err
:=
a
.
db
.
Get
(
propBoardID
(
rvkProb
.
ProposalID
))
if
err
!=
nil
{
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"get round failed"
,
rvkProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
var
cur
auty
.
AutonomyProposalBoard
err
=
types
.
Decode
(
value
,
&
cur
)
if
err
!=
nil
{
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"decode round failed"
,
rvkProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
pre
:=
copyAutonomyProposalBoard
(
&
cur
)
// 检查当前状态
if
cur
.
Status
!=
auty
.
AutonomyStatusProposalBoard
{
err
:=
auty
.
ErrProposalStatus
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"status"
,
cur
.
Status
,
"status is not match"
,
rvkProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
if
a
.
height
>
start
{
err
:=
auty
.
ErrRevokeProposalPeriod
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ProposalID"
,
rvkProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
if
a
.
fromaddr
!=
cur
.
Address
{
err
:=
auty
.
ErrRevokeProposalPower
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ProposalID"
,
rvkProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
receipt
,
err
:=
a
.
coinsAccount
.
ExecActive
(
a
.
fromaddr
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"rvkPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecActive amount"
,
lockAmount
,
"err"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
cur
.
Status
=
auty
.
AutonomyStatusRvkPropBoard
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
propBoardID
(
rvkProb
.
ProposalID
),
Value
:
types
.
Encode
(
&
cur
)})
a
.
GetReceiptLog
(
pre
,
&
cur
,
auty
.
TyLogRvkPropBoard
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
a
*
action
)
votePropBoard
(
voteProb
*
auty
.
VoteProposalBoard
)
(
*
types
.
Receipt
,
error
)
{
// 获取GameID
value
,
err
:=
a
.
db
.
Get
(
propBoardID
(
voteProb
.
ProposalID
))
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"get propBoardID failed"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
var
cur
auty
.
AutonomyProposalBoard
err
=
types
.
Decode
(
value
,
&
cur
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"decode AutonomyProposalBoard failed"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
pre
:=
copyAutonomyProposalBoard
(
&
cur
)
start
:=
cur
.
GetPropBoard
()
.
StartBlockHeight
end
:=
cur
.
GetPropBoard
()
.
EndBlockHeight
real
:=
cur
.
GetPropBoard
()
.
RealEndBlockHeight
if
start
<
a
.
height
||
end
<
a
.
height
||
(
real
!=
0
&&
real
<
a
.
height
)
{
err
:=
auty
.
ErrVotePeriod
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ProposalID"
,
voteProb
.
ProposalID
,
"err"
,
err
)
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
))
if
err
==
nil
{
err
=
types
.
Decode
(
value
,
&
votes
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"decode VotesRecord failed"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
}
// 检查是否有重复
for
_
,
addr
:=
range
votes
.
Address
{
if
addr
==
a
.
fromaddr
{
err
:=
auty
.
ErrRepeatVoteAddr
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"repeat address GameID"
,
voteProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
}
// 加入已经投票的
votes
.
Address
=
append
(
votes
.
Address
,
a
.
fromaddr
)
if
cur
.
GetRes
()
.
TotalVotes
==
0
{
//需要统计票数
addr
:=
"16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account
,
err
:=
a
.
getStartHeightVoteAccount
(
addr
,
start
)
if
err
!=
nil
{
return
nil
,
err
}
cur
.
Res
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
}
account
,
err
:=
a
.
getStartHeightVoteAccount
(
a
.
fromaddr
,
start
)
if
err
!=
nil
{
return
nil
,
err
}
if
voteProb
.
Approve
{
cur
.
Res
.
ApproveVotes
+=
int32
(
account
.
Balance
/
ticketPrice
)
}
else
{
cur
.
Res
.
OpposeVotes
+=
int32
(
account
.
Balance
/
ticketPrice
)
}
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
if
float32
(
cur
.
Res
.
ApproveVotes
+
cur
.
Res
.
OpposeVotes
)
/
float32
(
cur
.
Res
.
TotalVotes
)
>=
participationRate
&&
float32
(
cur
.
Res
.
ApproveVotes
)
/
float32
(
cur
.
Res
.
ApproveVotes
+
cur
.
Res
.
OpposeVotes
)
>=
approveRate
{
cur
.
Res
.
Pass
=
true
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
auty
.
AutonomyX
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"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
))
cur
.
Status
=
auty
.
AutonomyStatusVotePropBoard
if
cur
.
Res
.
Pass
{
cur
.
Status
=
auty
.
AutonomyStatusTmintPropBoard
}
value
=
types
.
Encode
(
&
cur
)
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
value
})
// 更新VotesRecord
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
VotesRecord
(
voteProb
.
ProposalID
),
Value
:
types
.
Encode
(
&
votes
)})
ty
:=
auty
.
TyLogVotePropBoard
if
cur
.
Res
.
Pass
{
ty
=
auty
.
TyLogTmintPropBoard
}
receiptLog
:=
a
.
GetReceiptLog
(
pre
,
&
cur
,
int32
(
ty
))
logs
=
append
(
logs
,
receiptLog
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
a
*
action
)
tmintPropBoard
(
tmintProb
*
auty
.
TerminateProposalBoard
)
(
*
types
.
Receipt
,
error
)
{
// 获取GameID
value
,
err
:=
a
.
db
.
Get
(
propBoardID
(
tmintProb
.
ProposalID
))
if
err
!=
nil
{
alog
.
Error
(
"tmintPropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"get round 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 round 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"
,
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"
,
tmintProb
.
ProposalID
,
"err"
,
err
)
return
nil
,
err
}
if
cur
.
GetRes
()
.
TotalVotes
==
0
{
//需要统计票数
addr
:=
"16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account
,
err
:=
a
.
getStartHeightVoteAccount
(
addr
,
start
)
if
err
!=
nil
{
return
nil
,
err
}
cur
.
Res
.
TotalVotes
=
int32
(
account
.
Balance
/
ticketPrice
)
}
if
float32
(
cur
.
Res
.
ApproveVotes
+
cur
.
Res
.
OpposeVotes
)
/
float32
(
cur
.
Res
.
TotalVotes
)
>=
participationRate
&&
float32
(
cur
.
Res
.
ApproveVotes
)
/
float32
(
cur
.
Res
.
ApproveVotes
+
cur
.
Res
.
OpposeVotes
)
>=
approveRate
{
cur
.
Res
.
Pass
=
true
}
else
{
cur
.
Res
.
Pass
=
false
}
cur
.
PropBoard
.
RealEndBlockHeight
=
a
.
height
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
receipt
,
err
:=
a
.
coinsAccount
.
ExecTransferFrozen
(
cur
.
Address
,
auty
.
AutonomyX
,
a
.
execaddr
,
lockAmount
)
if
err
!=
nil
{
alog
.
Error
(
"votePropBoard "
,
"addr"
,
a
.
fromaddr
,
"execaddr"
,
a
.
execaddr
,
"ExecTransferFrozen amount fail"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
cur
.
Status
=
auty
.
AutonomyStatusTmintPropBoard
kv
=
append
(
kv
,
&
types
.
KeyValue
{
Key
:
propBoardID
(
tmintProb
.
ProposalID
),
Value
:
types
.
Encode
(
&
cur
)})
a
.
GetReceiptLog
(
pre
,
&
cur
,
auty
.
TyLogTmintPropBoard
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
a
*
action
)
getStartHeightVoteAccount
(
addr
string
,
height
int64
)
(
*
types
.
Account
,
error
)
{
param
:=
&
types
.
ReqBlocks
{
Start
:
height
,
End
:
height
,
}
head
,
err
:=
a
.
api
.
GetHeaders
(
param
)
if
err
!=
nil
||
len
(
head
.
Items
)
==
0
{
alog
.
Error
(
"GetStartVoteAccount "
,
"addr"
,
addr
,
"height"
,
height
,
"get headers failed"
,
err
)
return
nil
,
err
}
stateHash
:=
common
.
ToHex
(
head
.
Items
[
0
]
.
StateHash
)
account
,
err
:=
a
.
coinsAccount
.
GetBalance
(
a
.
api
,
&
types
.
ReqBalance
{
Addresses
:
[]
string
{
addr
},
StateHash
:
stateHash
,
})
if
err
!=
nil
||
len
(
account
)
==
0
{
alog
.
Error
(
"GetStartVoteAccount "
,
"addr"
,
addr
,
"height"
,
height
,
"GetBalance failed"
,
err
)
return
nil
,
err
}
return
account
[
0
],
nil
}
// GetReceiptLog 根据提案信息获取log
// 状态变化:
func
(
a
*
action
)
GetReceiptLog
(
pre
,
cur
*
auty
.
AutonomyProposalBoard
,
ty
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
ty
r
:=
&
auty
.
ReceiptProposalBoard
{
Prev
:
pre
,
Current
:
cur
}
log
.
Log
=
types
.
Encode
(
r
)
return
log
}
func
copyAutonomyProposalBoard
(
cur
*
auty
.
AutonomyProposalBoard
)
*
auty
.
AutonomyProposalBoard
{
newAut
:=
*
cur
newBoard
:=
*
cur
.
GetPropBoard
()
newRes
:=
*
cur
.
GetRes
()
newAut
.
PropBoard
=
&
newBoard
newAut
.
Res
=
&
newRes
return
&
newAut
}
plugin/dapp/autonomy/executor/exec.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// Exec_PropBoard 创建提案
func
(
a
*
Autonomy
)
Exec_PropBoard
(
payload
*
auty
.
ProposalBoard
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newAction
(
a
,
tx
,
int32
(
index
))
return
action
.
propBoard
(
payload
)
}
// Exec_RvkPropBoard 撤销提案
func
(
a
*
Autonomy
)
Exec_RvkPropBoard
(
payload
*
auty
.
RevokeProposalBoard
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newAction
(
a
,
tx
,
int32
(
index
))
return
action
.
rvkPropBoard
(
payload
)
}
// Exec_VotePropBoard 投票提案
func
(
a
*
Autonomy
)
Exec_VotePropBoard
(
payload
*
auty
.
VoteProposalBoard
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newAction
(
a
,
tx
,
int32
(
index
))
return
action
.
votePropBoard
(
payload
)
}
// Exec_TmintPropBoard 终止提案
func
(
a
*
Autonomy
)
Exec_TmintPropBoard
(
payload
*
auty
.
TerminateProposalBoard
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newAction
(
a
,
tx
,
int32
(
index
))
return
action
.
tmintPropBoard
(
payload
)
}
\ No newline at end of file
plugin/dapp/autonomy/executor/exec_del_local.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// ExecDelLocal_PropBoard 创建提案
func
(
a
*
Autonomy
)
ExecDelLocal_PropBoard
(
payload
*
auty
.
ProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execDelLocalBoard
(
receiptData
)
}
// ExecDelLocal_RvkPropBoard 撤销提案
func
(
a
*
Autonomy
)
ExecDelLocal_RvkPropBoard
(
payload
*
auty
.
RevokeProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
){
return
a
.
execDelLocalBoard
(
receiptData
)
}
// ExecDelLocal_VotePropBoard 投票提案
func
(
a
*
Autonomy
)
ExecDelLocal_VotePropBoard
(
payload
*
auty
.
VoteProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execDelLocalBoard
(
receiptData
)
}
// ExecDelLocal_TmintPropBoard 终止提案
func
(
a
*
Autonomy
)
ExecDelLocal_TmintPropBoard
(
payload
*
auty
.
TerminateProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execDelLocalBoard
(
receiptData
)
}
plugin/dapp/autonomy/executor/exec_local.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// ExecLocal_PropBoard 创建提案
func
(
a
*
Autonomy
)
ExecLocal_PropBoard
(
payload
*
auty
.
ProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execLocalBoard
(
receiptData
)
}
// ExecLocal_RvkPropBoard 撤销提案
func
(
a
*
Autonomy
)
ExecLocal_RvkPropBoard
(
payload
*
auty
.
RevokeProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
){
return
a
.
execLocalBoard
(
receiptData
)
}
// ExecLocal_VotePropBoard 投票提案
func
(
a
*
Autonomy
)
ExecLocal_VotePropBoard
(
payload
*
auty
.
VoteProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execLocalBoard
(
receiptData
)
}
// ExecLocal_TmintPropBoard 终止提案
func
(
a
*
Autonomy
)
ExecLocal_TmintPropBoard
(
payload
*
auty
.
TerminateProposalBoard
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
a
.
execLocalBoard
(
receiptData
)
}
plugin/dapp/autonomy/executor/exec_test.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"testing"
"github.com/stretchr/testify/assert"
"encoding/hex"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
pty
"github.com/33cn/plugin/plugin/dapp/unfreeze/types"
)
type
execEnv
struct
{
blockTime
int64
blockHeight
int64
difficulty
uint64
}
var
(
Symbol
=
"TEST"
AssetExecToken
=
"token"
AssetExecPara
=
"paracross"
PrivKeyA
=
"0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
// 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyB
=
"0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4"
// 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
PrivKeyC
=
"0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115"
// 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k
PrivKeyD
=
"0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71"
// 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs
Nodes
=
[][]
byte
{
[]
byte
(
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
),
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
[]
byte
(
"1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
),
[]
byte
(
"1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
),
}
)
func
TestUnfreeze
(
t
*
testing
.
T
)
{
types
.
SetTitleOnlyForTest
(
"chain33"
)
total
:=
int64
(
100000
)
accountA
:=
types
.
Account
{
Balance
:
total
,
Frozen
:
0
,
Addr
:
string
(
Nodes
[
0
]),
}
accountB
:=
types
.
Account
{
Balance
:
total
,
Frozen
:
0
,
Addr
:
string
(
Nodes
[
1
]),
}
execAddr
:=
address
.
ExecAddress
(
pty
.
UnfreezeX
)
stateDB
,
_
:=
dbm
.
NewGoMemDB
(
"1"
,
"2"
,
100
)
_
,
ldb
,
kvdb
:=
util
.
CreateTestDB
()
accA
,
_
:=
account
.
NewAccountDB
(
AssetExecPara
,
Symbol
,
stateDB
)
accA
.
SaveExecAccount
(
execAddr
,
&
accountA
)
accB
,
_
:=
account
.
NewAccountDB
(
AssetExecPara
,
Symbol
,
stateDB
)
accB
.
SaveExecAccount
(
execAddr
,
&
accountB
)
env
:=
execEnv
{
10
,
types
.
GetDappFork
(
pty
.
UnfreezeX
,
pty
.
ForkUnfreezeIDX
),
1539918074
,
}
ty
:=
pty
.
UnfreezeType
{}
// 创建
opt
:=
&
pty
.
FixAmount
{
Period
:
10
,
Amount
:
2
}
p1
:=
&
pty
.
UnfreezeCreate
{
StartTime
:
10
,
AssetExec
:
AssetExecPara
,
AssetSymbol
:
Symbol
,
TotalCount
:
10000
,
Beneficiary
:
string
(
Nodes
[
1
]),
Means
:
"FixAmount"
,
MeansOpt
:
&
pty
.
UnfreezeCreate_FixAmount
{
FixAmount
:
opt
},
}
createTx
,
err
:=
ty
.
RPC_UnfreezeCreateTx
(
p1
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeCreateTx"
,
"err"
,
err
)
}
createTx
,
err
=
signTx
(
createTx
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeCreateTx sign"
,
"err"
,
err
)
}
exec
:=
newUnfreeze
()
exec
.
SetStateDB
(
stateDB
)
exec
.
SetLocalDB
(
kvdb
)
exec
.
SetEnv
(
env
.
blockHeight
,
env
.
blockTime
,
env
.
difficulty
)
receipt
,
err
:=
exec
.
Exec
(
createTx
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
accTmp
:=
accA
.
LoadExecAccount
(
accountA
.
Addr
,
execAddr
)
assert
.
Equal
(
t
,
total
-
p1
.
TotalCount
,
accTmp
.
Balance
)
assert
.
Equal
(
t
,
p1
.
TotalCount
,
accTmp
.
Frozen
)
receiptDate
:=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
:=
exec
.
ExecLocal
(
createTx
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
req1
:=
&
pty
.
ReqUnfreezes
{
Beneficiary
:
p1
.
Beneficiary
,
}
reply
,
err
:=
exec
.
Query
(
"ListUnfreezeByBeneficiary"
,
types
.
Encode
(
req1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
reply
)
resp
,
ok
:=
reply
.
(
*
pty
.
ReplyUnfreezes
)
assert
.
True
(
t
,
ok
)
assert
.
Equal
(
t
,
1
,
len
(
resp
.
Unfreeze
))
assert
.
Equal
(
t
,
string
(
unfreezeID
(
createTx
.
Hash
())),
resp
.
Unfreeze
[
0
]
.
UnfreezeID
)
// 提币
p2
:=
&
pty
.
UnfreezeWithdraw
{
UnfreezeID
:
hex
.
EncodeToString
(
createTx
.
Hash
()),
}
withdrawTx
,
err
:=
ty
.
RPC_UnfreezeWithdrawTx
(
p2
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx"
,
"err"
,
err
)
}
withdrawTx
,
err
=
signTx
(
withdrawTx
,
PrivKeyB
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx sign"
,
"err"
,
err
)
}
blockTime
:=
int64
(
10
)
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
blockTime
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
withdrawTx
,
1
)
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
accATmp
:=
accA
.
LoadExecAccount
(
accountA
.
Addr
,
execAddr
)
accBTmp
:=
accB
.
LoadExecAccount
(
accountB
.
Addr
,
execAddr
)
assert
.
Equal
(
t
,
total
-
p1
.
TotalCount
,
accATmp
.
Balance
)
u
:=
pty
.
Unfreeze
{}
e
:=
types
.
Decode
(
receipt
.
KV
[
2
]
.
Value
,
&
u
)
assert
.
Nil
(
t
,
e
)
assert
.
Equal
(
t
,
u
.
Remaining
,
accATmp
.
Frozen
)
assert
.
Equal
(
t
,
accountB
.
Balance
+
p1
.
TotalCount
-
u
.
Remaining
,
accBTmp
.
Balance
)
receiptDate2
:=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
=
exec
.
ExecLocal
(
withdrawTx
,
receiptDate2
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
// 不是受益人提币
{
p2
:=
&
pty
.
UnfreezeWithdraw
{
UnfreezeID
:
hex
.
EncodeToString
(
createTx
.
Hash
()),
}
withdrawTx
,
err
:=
ty
.
RPC_UnfreezeWithdrawTx
(
p2
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx"
,
"err"
,
err
)
}
withdrawTx
,
err
=
signTx
(
withdrawTx
,
PrivKeyC
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx sign"
,
"err"
,
err
)
}
blockTime
:=
int64
(
10
)
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
blockTime
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
withdrawTx
,
1
)
assert
.
Equal
(
t
,
pty
.
ErrNoPrivilege
,
err
)
assert
.
Nil
(
t
,
receipt
)
}
// 不是创建者终止
{
p3
:=
&
pty
.
UnfreezeTerminate
{
UnfreezeID
:
hex
.
EncodeToString
(
createTx
.
Hash
()),
}
terminateTx
,
err
:=
ty
.
RPC_UnfreezeTerminateTx
(
p3
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeTerminateTx"
,
"err"
,
err
)
}
terminateTx
,
err
=
signTx
(
terminateTx
,
PrivKeyC
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeTerminateTx sign"
,
"err"
,
err
)
}
receipt
,
err
=
exec
.
Exec
(
terminateTx
,
1
)
assert
.
Equal
(
t
,
pty
.
ErrNoPrivilege
,
err
)
assert
.
Nil
(
t
,
receipt
)
}
// 终止
p3
:=
&
pty
.
UnfreezeTerminate
{
UnfreezeID
:
hex
.
EncodeToString
(
createTx
.
Hash
()),
}
terminateTx
,
err
:=
ty
.
RPC_UnfreezeTerminateTx
(
p3
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeTerminateTx"
,
"err"
,
err
)
}
terminateTx
,
err
=
signTx
(
terminateTx
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeTerminateTx sign"
,
"err"
,
err
)
}
exec
.
SetEnv
(
env
.
blockHeight
+
2
,
env
.
blockTime
+
blockTime
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
terminateTx
,
1
)
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
accATmp
=
accA
.
LoadExecAccount
(
accountA
.
Addr
,
execAddr
)
assert
.
Equal
(
t
,
total
+
total
,
accATmp
.
Balance
+
accBTmp
.
Balance
)
assert
.
Equal
(
t
,
int64
(
0
),
accATmp
.
Frozen
)
receiptDate3
:=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
=
exec
.
ExecLocal
(
terminateTx
,
receiptDate3
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
// 终止后不能继续提币
{
p2
:=
&
pty
.
UnfreezeWithdraw
{
UnfreezeID
:
hex
.
EncodeToString
(
createTx
.
Hash
()),
}
withdrawTx
,
err
:=
ty
.
RPC_UnfreezeWithdrawTx
(
p2
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx"
,
"err"
,
err
)
}
withdrawTx
,
err
=
signTx
(
withdrawTx
,
PrivKeyB
)
if
err
!=
nil
{
t
.
Error
(
"RPC_UnfreezeWithdrawTx sign"
,
"err"
,
err
)
}
blockTime
:=
int64
(
10
)
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
blockTime
+
blockTime
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
withdrawTx
,
1
)
assert
.
Equal
(
t
,
pty
.
ErrUnfreezeEmptied
,
err
)
assert
.
Nil
(
t
,
receipt
)
}
req
:=
types
.
ReqString
{
Data
:
hex
.
EncodeToString
(
createTx
.
Hash
())}
_
,
err
=
exec
.
Query
(
"GetUnfreeze"
,
types
.
Encode
(
&
req
))
assert
.
Nil
(
t
,
err
)
_
,
err
=
exec
.
Query
(
"GetUnfreezeWithdraw"
,
types
.
Encode
(
&
req
))
assert
.
Nil
(
t
,
err
)
_
,
err
=
exec
.
ExecDelLocal
(
terminateTx
,
receiptDate3
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
blockTime
,
env
.
difficulty
)
_
,
err
=
exec
.
ExecDelLocal
(
withdrawTx
,
receiptDate2
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
exec
.
SetEnv
(
env
.
blockHeight
,
env
.
blockTime
+
blockTime
,
env
.
difficulty
)
_
,
err
=
exec
.
ExecDelLocal
(
createTx
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
ldb
.
Close
()
}
func
signTx
(
tx
*
types
.
Transaction
,
hexPrivKey
string
)
(
*
types
.
Transaction
,
error
)
{
signType
:=
types
.
SECP256K1
c
,
err
:=
crypto
.
New
(
types
.
GetSignName
(
pty
.
UnfreezeX
,
signType
))
if
err
!=
nil
{
return
tx
,
err
}
bytes
,
err
:=
common
.
FromHex
(
hexPrivKey
[
:
])
if
err
!=
nil
{
return
tx
,
err
}
privKey
,
err
:=
c
.
PrivKeyFromBytes
(
bytes
)
if
err
!=
nil
{
return
tx
,
err
}
tx
.
Sign
(
int32
(
signType
),
privKey
)
return
tx
,
nil
}
plugin/dapp/autonomy/executor/kv.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"fmt"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
var
(
idPrefix
=
"mavl-"
+
auty
.
AutonomyX
+
"-"
votesRecordPrefix
=
idPrefix
+
"vote"
+
"-"
localPrefix
=
"LOCDB"
+
auty
.
AutonomyX
+
"-"
)
var
(
// board
boardPrefix
=
idPrefix
+
"board"
+
"-"
)
func
propBoardID
(
txHash
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s%s"
,
boardPrefix
,
txHash
))
}
func
VotesRecord
(
txHash
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s%s"
,
votesRecordPrefix
,
txHash
))
}
func
calcBoardKey4StatusHeight
(
status
int32
,
heightindex
string
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
localPrefix
+
"%d-"
+
"%s"
,
status
,
heightindex
)
return
[]
byte
(
key
)
}
plugin/dapp/autonomy/executor/query.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"time"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// Query_GetUnfreezeWithdraw 查询合约可提币量
func
(
u
*
Unfreeze
)
Query_GetUnfreezeWithdraw
(
in
*
types
.
ReqString
)
(
types
.
Message
,
error
)
{
return
QueryWithdraw
(
u
.
GetStateDB
(),
in
.
GetData
())
}
\ No newline at end of file
plugin/dapp/autonomy/plugin.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
autonomy
import
(
"github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/autonomy/commands"
"github.com/33cn/plugin/plugin/dapp/autonomy/executor"
"github.com/33cn/plugin/plugin/dapp/autonomy/rpc"
ptypes
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
func
init
()
{
pluginmgr
.
Register
(
&
pluginmgr
.
PluginBase
{
Name
:
ptypes
.
PackageName
,
ExecName
:
executor
.
GetName
(),
Exec
:
executor
.
Init
,
Cmd
:
commands
.
Cmd
,
RPC
:
rpc
.
Init
,
})
}
plugin/dapp/autonomy/proto/Makefile
0 → 100644
View file @
af694733
all
:
./create_protobuf.sh
plugin/dapp/autonomy/proto/autonomy.proto
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax
=
"proto3"
;
//import "common.proto";
import
"board.proto"
;
import
"project.proto"
;
import
"rule.proto"
;
package
types
;
// message for execs.Autonomy
message
AutonomyAction
{
oneof
value
{
// 提案董事会相关
ProposalBoard
propBoard
=
1
;
RevokeProposalBoard
rvkPropBoard
=
2
;
VoteProposalBoard
votePropBoard
=
3
;
TerminateProposalBoard
tmintPropBoard
=
4
;
// 提案项目相关
ProposalProject
propProject
=
5
;
RevokeProposalProject
rvkPropProject
=
6
;
VoteProposalBoard
votePropProject
=
7
;
TerminateProposalProject
tmintPropProject
=
8
;
// 提案规则修改相关
ProposalRule
propRule
=
9
;
RevokeProposalRule
rvkPropRule
=
10
;
VoteProposalBoard
votePropRule
=
11
;
TerminateProposalRule
tmintPropRule
=
12
;
}
int32
ty
=
13
;
}
service
autonomy
{
rpc
QueryProposalBoard
(
ReplyQueryProposalBoard
)
returns
(
ReplyProposalBoard
)
{}
rpc
QueryProposalProject
(
ReplyQueryProposalProject
)
returns
(
ReplyProposalProject
)
{}
rpc
QueryProposalRule
(
ReplyQueryProposalRule
)
returns
(
ReplyProposalRule
)
{}
}
\ No newline at end of file
plugin/dapp/autonomy/proto/board.proto
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax
=
"proto3"
;
import
"lcommon.proto"
;
package
types
;
message
AutonomyProposalBoard
{
ProposalBoard
propBoard
=
1
;
// 全体持票人投票结果
VotesResult
res
=
2
;
// 状态
int32
status
=
3
;
string
address
=
4
;
int64
height
=
5
;
int32
index
=
6
;
}
// action
message
ProposalBoard
{
// 提案时间
int32
year
=
1
;
int32
month
=
2
;
int32
day
=
3
;
// 提案董事会成员
repeated
string
boards
=
4
;
// 投票相关
int64
startBlockHeight
=
5
;
// 提案开始投票高度
int64
endBlockHeight
=
6
;
// 提案结束投票高度
int64
realEndBlockHeight
=
7
;
// 实际提案结束投票高度
}
message
RevokeProposalBoard
{
string
proposalID
=
1
;
}
message
VoteProposalBoard
{
string
proposalID
=
1
;
bool
approve
=
2
;
}
message
TerminateProposalBoard
{
string
proposalID
=
1
;
}
// receipt
message
ReceiptProposalBoard
{
AutonomyProposalBoard
prev
=
1
;
AutonomyProposalBoard
current
=
2
;
}
message
LocalProposalBoard
{
AutonomyProposalBoard
propBd
=
1
;
repeated
string
comments
=
2
;
}
// query
message
ReplyQueryProposalBoard
{
string
proposalID
=
1
;
}
message
ReplyProposalBoard
{
repeated
LocalProposalBoard
propBoards
=
1
;
}
\ No newline at end of file
plugin/dapp/autonomy/proto/create_protobuf.sh
0 → 100755
View file @
af694733
#!/bin/sh
protoc
--go_out
=
plugins
=
grpc:../types ./
*
.proto
--proto_path
=
.
--proto_path
=
"
$GOPATH
/src/github.com/33cn/chain33/types/proto/"
plugin/dapp/autonomy/proto/lcommon.proto
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax
=
"proto3"
;
package
types
;
message
VotesResult
{
// 总票数
int32
totalVotes
=
1
;
// 赞成票
int32
approveVotes
=
2
;
// 反对票
int32
opposeVotes
=
3
;
// 是否通过
bool
pass
=
4
;
}
message
VotesRecord
{
repeated
string
address
=
1
;
}
\ No newline at end of file
plugin/dapp/autonomy/proto/project.proto
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax
=
"proto3"
;
import
"lcommon.proto"
;
package
types
;
message
AutonomyProposalProject
{
ProposalProject
propProject
=
1
;
// 董事会投票结果
VotesResult
boardResult
=
2
;
// 是否需要公示
bool
publicity
=
3
;
// 全体持票人反对票
int32
opposeVotes
=
4
;
// 是否通过
bool
pubPass
=
5
;
// 状态
int32
status
=
6
;
}
message
ProposalProject
{
// 提案时间
int32
year
=
1
;
int32
month
=
2
;
int32
day
=
3
;
// 项目相关
string
firstStage
=
4
;
// 第一阶段提案项目hash
string
lastStage
=
5
;
// 上一阶段提案项目hash
string
production
=
6
;
// 项目地址
string
description
=
7
;
// 项目阶段性简述
string
contractor
=
8
;
// 承包人
int32
amount
=
9
;
// 项目经费
string
amountDetail
=
10
;
// 经费细则
// 支付相关
string
toAddr
=
11
;
// 收款地址
// 投票相关
int64
startBlockHeight
=
12
;
// 提案开始投票高度
int64
endBlockHeight
=
13
;
// 提案结束投票高度
int64
realEndBlockHeight
=
14
;
// 实际提案结束投票高度
int32
projectNeedBlockNum
=
15
;
// 以提案结束投票高度为准,需要项目需要消耗的区块数目所对应的时间
}
message
RevokeProposalProject
{
string
proposalID
=
1
;
}
message
TerminateProposalProject
{
string
proposalID
=
1
;
}
// receipt
message
ReceiptProposalProject
{
AutonomyProposalProject
prev
=
1
;
AutonomyProposalProject
current
=
2
;
}
message
LocalProposalProject
{
AutonomyProposalProject
propPrj
=
1
;
repeated
string
comments
=
2
;
}
// query
message
ReplyQueryProposalProject
{
string
proposalID
=
1
;
}
message
ReplyProposalProject
{
repeated
LocalProposalProject
propProjects
=
1
;
}
\ No newline at end of file
plugin/dapp/autonomy/proto/rule.proto
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax
=
"proto3"
;
import
"lcommon.proto"
;
package
types
;
message
AutonomyProposalRule
{
ProposalRule
propRule
=
1
;
// 全体持票人投票结果
VotesResult
res
=
2
;
// 状态
int32
status
=
3
;
}
message
ProposalRule
{
// 提案时间
int32
year
=
1
;
int32
month
=
2
;
int32
day
=
3
;
// 可修改项
int32
boardAttendProb
=
4
;
//参与率,以%为单位,只保留整数部分
int32
boardPassProb
=
5
;
//通过率
int32
opposeProb
=
6
;
//否决率
int32
proposalAmount
=
7
;
//提案金额
int32
pubAmountThreshold
=
8
;
//公示金额阈值
// 投票相关
int64
startBlockHeight
=
9
;
// 提案开始投票高度
int64
endBlockHeight
=
10
;
// 提案结束投票高度
int64
realEndBlockHeight
=
11
;
// 实际提案结束投票高度
}
message
RevokeProposalRule
{
string
proposalID
=
1
;
}
message
TerminateProposalRule
{
string
proposalID
=
1
;
}
// receipt
message
ReceiptProposalRule
{
AutonomyProposalRule
prev
=
1
;
AutonomyProposalRule
current
=
2
;
}
message
LocalProposalRule
{
AutonomyProposalRule
propRule
=
1
;
repeated
string
comments
=
2
;
}
// query
message
ReplyQueryProposalRule
{
string
proposalID
=
1
;
}
message
ReplyProposalRule
{
repeated
LocalProposalRule
propRules
=
1
;
}
\ No newline at end of file
plugin/dapp/autonomy/rpc/jrpc.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"context"
"encoding/hex"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// PropBoardTx 提案董事会成员RPC接口
func
(
c
*
Jrpc
)
PropBoardTx
(
parm
*
auty
.
ProposalBoard
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
reply
,
err
:=
c
.
cli
.
propBoard
(
context
.
Background
(),
parm
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
// RevokeProposalBoardTx 撤销提案董事会成员的RPC接口
func
(
c
*
Jrpc
)
RevokeProposalBoardTx
(
parm
*
auty
.
RevokeProposalBoard
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
reply
,
err
:=
c
.
cli
.
revokeProposalBoard
(
context
.
Background
(),
parm
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
// TerminateProposalBoardTx 终止提案董事会成员的RPC接口
func
(
c
*
Jrpc
)
TerminateProposalBoardTx
(
parm
*
auty
.
TerminateProposalBoard
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
reply
,
err
:=
c
.
cli
.
terminateProposalBoard
(
context
.
Background
(),
parm
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
\ No newline at end of file
plugin/dapp/autonomy/rpc/jrpc_channel_test.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc_test
import
(
"strings"
"testing"
commonlog
"github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
pty
"github.com/33cn/plugin/plugin/dapp/blackwhite/types"
"github.com/stretchr/testify/assert"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/plugin/plugin"
)
func
init
()
{
commonlog
.
SetLogLevel
(
"error"
)
}
func
TestJRPCChannel
(
t
*
testing
.
T
)
{
// 启动RPCmocker
mocker
:=
testnode
.
New
(
"--notset--"
,
nil
)
defer
func
()
{
mocker
.
Close
()
}()
mocker
.
Listen
()
jrpcClient
:=
mocker
.
GetJSONC
()
assert
.
NotNil
(
t
,
jrpcClient
)
testCases
:=
[]
struct
{
fn
func
(
*
testing
.
T
,
*
jsonclient
.
JSONClient
)
error
}{
{
fn
:
testCreateRawTxCmd
},
{
fn
:
testPlayRawTxCmd
},
{
fn
:
testShowRawTxCmd
},
{
fn
:
testTimeoutDoneTxCmd
},
{
fn
:
testRoundInfoCmd
},
{
fn
:
testRoundListCmd
},
{
fn
:
testLoopResultCmd
},
}
for
index
,
testCase
:=
range
testCases
{
err
:=
testCase
.
fn
(
t
,
jrpcClient
)
if
err
==
nil
{
continue
}
assert
.
NotEqualf
(
t
,
err
,
types
.
ErrActionNotSupport
,
"test index %d"
,
index
)
if
strings
.
Contains
(
err
.
Error
(),
"rpc: can't find"
)
{
assert
.
FailNowf
(
t
,
err
.
Error
(),
"test index %d"
,
index
)
}
}
}
func
testCreateRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
&
pty
.
BlackwhiteCreateTxReq
{}
var
res
string
return
jrpc
.
Call
(
"blackwhite.BlackwhiteCreateTx"
,
params
,
&
res
)
}
func
testPlayRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
&
pty
.
BlackwhitePlayTxReq
{}
var
res
string
return
jrpc
.
Call
(
"blackwhite.BlackwhitePlayTx"
,
params
,
&
res
)
}
func
testShowRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
&
pty
.
BlackwhiteShowTxReq
{}
var
res
string
return
jrpc
.
Call
(
"blackwhite.BlackwhiteShowTx"
,
params
,
&
res
)
}
func
testTimeoutDoneTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
&
pty
.
BlackwhiteTimeoutDoneTxReq
{}
var
res
string
return
jrpc
.
Call
(
"blackwhite.BlackwhiteTimeoutDoneTx"
,
params
,
&
res
)
}
func
testRoundInfoCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqBlackwhiteRoundInfo
{}
params
.
FuncName
=
pty
.
GetBlackwhiteRoundInfo
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
rep
=
&
pty
.
ReplyBlackwhiteRoundInfo
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
func
testRoundListCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqBlackwhiteRoundList
{}
params
.
FuncName
=
pty
.
GetBlackwhiteByStatusAndAddr
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
rep
=
&
pty
.
ReplyBlackwhiteRoundList
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
func
testLoopResultCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqLoopResult
{}
params
.
FuncName
=
pty
.
GetBlackwhiteloopResult
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
rep
=
&
pty
.
ReplyLoopResults
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
plugin/dapp/autonomy/rpc/rpc.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"golang.org/x/net/context"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// Proposal Board 相关的接口
func
(
c
*
channelClient
)
propBoard
(
ctx
context
.
Context
,
head
*
auty
.
ProposalBoard
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
auty
.
AutonomyAction
{
Ty
:
auty
.
AutonomyActionPropBoard
,
Value
:
&
auty
.
AutonomyAction_PropBoard
{
PropBoard
:
head
},
}
tx
:=
&
types
.
Transaction
{
Payload
:
types
.
Encode
(
val
),
}
data
,
err
:=
types
.
FormatTxEncode
(
types
.
ExecName
(
auty
.
AutonomyX
),
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
revokeProposalBoard
(
ctx
context
.
Context
,
head
*
auty
.
RevokeProposalBoard
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
auty
.
AutonomyAction
{
Ty
:
auty
.
AutonomyActionRvkPropBoard
,
Value
:
&
auty
.
AutonomyAction_RvkPropBoard
{
RvkPropBoard
:
head
},
}
tx
:=
&
types
.
Transaction
{
Payload
:
types
.
Encode
(
val
),
}
data
,
err
:=
types
.
FormatTxEncode
(
types
.
ExecName
(
auty
.
AutonomyX
),
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
terminateProposalBoard
(
ctx
context
.
Context
,
head
*
auty
.
TerminateProposalBoard
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
auty
.
AutonomyAction
{
Ty
:
auty
.
AutonomyActionTmintPropBoard
,
Value
:
&
auty
.
AutonomyAction_TmintPropBoard
{
TmintPropBoard
:
head
},
}
tx
:=
&
types
.
Transaction
{
Payload
:
types
.
Encode
(
val
),
}
data
,
err
:=
types
.
FormatTxEncode
(
types
.
ExecName
(
auty
.
AutonomyX
),
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
plugin/dapp/autonomy/rpc/types.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"github.com/33cn/chain33/rpc/types"
)
// Jrpc json rpc struct
type
Jrpc
struct
{
cli
*
channelClient
}
// Grpc grpc struct
type
Grpc
struct
{
*
channelClient
}
type
channelClient
struct
{
types
.
ChannelClient
}
// Init init grpc param
func
Init
(
name
string
,
s
types
.
RPCServer
)
{
cli
:=
&
channelClient
{}
grpc
:=
&
Grpc
{
channelClient
:
cli
}
cli
.
Init
(
name
,
s
,
&
Jrpc
{
cli
:
cli
},
grpc
)
}
plugin/dapp/autonomy/types/autonomy.pb.go
0 → 100644
View file @
af694733
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: autonomy.proto
/*
Package types is a generated protocol buffer package.
It is generated from these files:
autonomy.proto
board.proto
lcommon.proto
project.proto
rule.proto
It has these top-level messages:
AutonomyAction
AutonomyProposalBoard
ProposalBoard
RevokeProposalBoard
VoteProposalBoard
TerminateProposalBoard
ReceiptProposalBoard
LocalProposalBoard
ReplyQueryProposalBoard
ReplyProposalBoard
VotesResult
VotesRecord
AutonomyProposalProject
ProposalProject
RevokeProposalProject
TerminateProposalProject
ReceiptProposalProject
LocalProposalProject
ReplyQueryProposalProject
ReplyProposalProject
AutonomyProposalRule
ProposalRule
RevokeProposalRule
TerminateProposalRule
ReceiptProposalRule
LocalProposalRule
ReplyQueryProposalRule
ReplyProposalRule
*/
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
import
(
context
"golang.org/x/net/context"
grpc
"google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const
_
=
proto
.
ProtoPackageIsVersion2
// please upgrade the proto package
// message for execs.Autonomy
type
AutonomyAction
struct
{
// Types that are valid to be assigned to Value:
// *AutonomyAction_PropBoard
// *AutonomyAction_RvkPropBoard
// *AutonomyAction_VotePropBoard
// *AutonomyAction_TmintPropBoard
// *AutonomyAction_PropProject
// *AutonomyAction_RvkPropProject
// *AutonomyAction_VotePropProject
// *AutonomyAction_TmintPropProject
// *AutonomyAction_PropRule
// *AutonomyAction_RvkPropRule
// *AutonomyAction_VotePropRule
// *AutonomyAction_TmintPropRule
Value
isAutonomyAction_Value
`protobuf_oneof:"value"`
Ty
int32
`protobuf:"varint,13,opt,name=ty" json:"ty,omitempty"`
}
func
(
m
*
AutonomyAction
)
Reset
()
{
*
m
=
AutonomyAction
{}
}
func
(
m
*
AutonomyAction
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
AutonomyAction
)
ProtoMessage
()
{}
func
(
*
AutonomyAction
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor0
,
[]
int
{
0
}
}
type
isAutonomyAction_Value
interface
{
isAutonomyAction_Value
()
}
type
AutonomyAction_PropBoard
struct
{
PropBoard
*
ProposalBoard
`protobuf:"bytes,1,opt,name=propBoard,oneof"`
}
type
AutonomyAction_RvkPropBoard
struct
{
RvkPropBoard
*
RevokeProposalBoard
`protobuf:"bytes,2,opt,name=rvkPropBoard,oneof"`
}
type
AutonomyAction_VotePropBoard
struct
{
VotePropBoard
*
VoteProposalBoard
`protobuf:"bytes,3,opt,name=votePropBoard,oneof"`
}
type
AutonomyAction_TmintPropBoard
struct
{
TmintPropBoard
*
TerminateProposalBoard
`protobuf:"bytes,4,opt,name=tmintPropBoard,oneof"`
}
type
AutonomyAction_PropProject
struct
{
PropProject
*
ProposalProject
`protobuf:"bytes,5,opt,name=propProject,oneof"`
}
type
AutonomyAction_RvkPropProject
struct
{
RvkPropProject
*
RevokeProposalProject
`protobuf:"bytes,6,opt,name=rvkPropProject,oneof"`
}
type
AutonomyAction_VotePropProject
struct
{
VotePropProject
*
VoteProposalBoard
`protobuf:"bytes,7,opt,name=votePropProject,oneof"`
}
type
AutonomyAction_TmintPropProject
struct
{
TmintPropProject
*
TerminateProposalProject
`protobuf:"bytes,8,opt,name=tmintPropProject,oneof"`
}
type
AutonomyAction_PropRule
struct
{
PropRule
*
ProposalRule
`protobuf:"bytes,9,opt,name=propRule,oneof"`
}
type
AutonomyAction_RvkPropRule
struct
{
RvkPropRule
*
RevokeProposalRule
`protobuf:"bytes,10,opt,name=rvkPropRule,oneof"`
}
type
AutonomyAction_VotePropRule
struct
{
VotePropRule
*
VoteProposalBoard
`protobuf:"bytes,11,opt,name=votePropRule,oneof"`
}
type
AutonomyAction_TmintPropRule
struct
{
TmintPropRule
*
TerminateProposalRule
`protobuf:"bytes,12,opt,name=tmintPropRule,oneof"`
}
func
(
*
AutonomyAction_PropBoard
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_RvkPropBoard
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_VotePropBoard
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_TmintPropBoard
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_PropProject
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_RvkPropProject
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_VotePropProject
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_TmintPropProject
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_PropRule
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_RvkPropRule
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_VotePropRule
)
isAutonomyAction_Value
()
{}
func
(
*
AutonomyAction_TmintPropRule
)
isAutonomyAction_Value
()
{}
func
(
m
*
AutonomyAction
)
GetValue
()
isAutonomyAction_Value
{
if
m
!=
nil
{
return
m
.
Value
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetPropBoard
()
*
ProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_PropBoard
);
ok
{
return
x
.
PropBoard
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetRvkPropBoard
()
*
RevokeProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_RvkPropBoard
);
ok
{
return
x
.
RvkPropBoard
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetVotePropBoard
()
*
VoteProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_VotePropBoard
);
ok
{
return
x
.
VotePropBoard
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetTmintPropBoard
()
*
TerminateProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_TmintPropBoard
);
ok
{
return
x
.
TmintPropBoard
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetPropProject
()
*
ProposalProject
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_PropProject
);
ok
{
return
x
.
PropProject
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetRvkPropProject
()
*
RevokeProposalProject
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_RvkPropProject
);
ok
{
return
x
.
RvkPropProject
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetVotePropProject
()
*
VoteProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_VotePropProject
);
ok
{
return
x
.
VotePropProject
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetTmintPropProject
()
*
TerminateProposalProject
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_TmintPropProject
);
ok
{
return
x
.
TmintPropProject
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetPropRule
()
*
ProposalRule
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_PropRule
);
ok
{
return
x
.
PropRule
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetRvkPropRule
()
*
RevokeProposalRule
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_RvkPropRule
);
ok
{
return
x
.
RvkPropRule
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetVotePropRule
()
*
VoteProposalBoard
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_VotePropRule
);
ok
{
return
x
.
VotePropRule
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetTmintPropRule
()
*
TerminateProposalRule
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
AutonomyAction_TmintPropRule
);
ok
{
return
x
.
TmintPropRule
}
return
nil
}
func
(
m
*
AutonomyAction
)
GetTy
()
int32
{
if
m
!=
nil
{
return
m
.
Ty
}
return
0
}
// XXX_OneofFuncs is for the internal use of the proto package.
func
(
*
AutonomyAction
)
XXX_OneofFuncs
()
(
func
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
,
func
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
),
func
(
msg
proto
.
Message
)
(
n
int
),
[]
interface
{})
{
return
_AutonomyAction_OneofMarshaler
,
_AutonomyAction_OneofUnmarshaler
,
_AutonomyAction_OneofSizer
,
[]
interface
{}{
(
*
AutonomyAction_PropBoard
)(
nil
),
(
*
AutonomyAction_RvkPropBoard
)(
nil
),
(
*
AutonomyAction_VotePropBoard
)(
nil
),
(
*
AutonomyAction_TmintPropBoard
)(
nil
),
(
*
AutonomyAction_PropProject
)(
nil
),
(
*
AutonomyAction_RvkPropProject
)(
nil
),
(
*
AutonomyAction_VotePropProject
)(
nil
),
(
*
AutonomyAction_TmintPropProject
)(
nil
),
(
*
AutonomyAction_PropRule
)(
nil
),
(
*
AutonomyAction_RvkPropRule
)(
nil
),
(
*
AutonomyAction_VotePropRule
)(
nil
),
(
*
AutonomyAction_TmintPropRule
)(
nil
),
}
}
func
_AutonomyAction_OneofMarshaler
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
{
m
:=
msg
.
(
*
AutonomyAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
AutonomyAction_PropBoard
:
b
.
EncodeVarint
(
1
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
PropBoard
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_RvkPropBoard
:
b
.
EncodeVarint
(
2
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
RvkPropBoard
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_VotePropBoard
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
VotePropBoard
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_TmintPropBoard
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
TmintPropBoard
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_PropProject
:
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
PropProject
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_RvkPropProject
:
b
.
EncodeVarint
(
6
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
RvkPropProject
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_VotePropProject
:
b
.
EncodeVarint
(
7
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
VotePropProject
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_TmintPropProject
:
b
.
EncodeVarint
(
8
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
TmintPropProject
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_PropRule
:
b
.
EncodeVarint
(
9
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
PropRule
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_RvkPropRule
:
b
.
EncodeVarint
(
10
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
RvkPropRule
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_VotePropRule
:
b
.
EncodeVarint
(
11
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
VotePropRule
);
err
!=
nil
{
return
err
}
case
*
AutonomyAction_TmintPropRule
:
b
.
EncodeVarint
(
12
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
TmintPropRule
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"AutonomyAction.Value has unexpected type %T"
,
x
)
}
return
nil
}
func
_AutonomyAction_OneofUnmarshaler
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
)
{
m
:=
msg
.
(
*
AutonomyAction
)
switch
tag
{
case
1
:
// value.propBoard
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
ProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_PropBoard
{
msg
}
return
true
,
err
case
2
:
// value.rvkPropBoard
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
RevokeProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_RvkPropBoard
{
msg
}
return
true
,
err
case
3
:
// value.votePropBoard
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
VoteProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_VotePropBoard
{
msg
}
return
true
,
err
case
4
:
// value.tmintPropBoard
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
TerminateProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_TmintPropBoard
{
msg
}
return
true
,
err
case
5
:
// value.propProject
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
ProposalProject
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_PropProject
{
msg
}
return
true
,
err
case
6
:
// value.rvkPropProject
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
RevokeProposalProject
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_RvkPropProject
{
msg
}
return
true
,
err
case
7
:
// value.votePropProject
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
VoteProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_VotePropProject
{
msg
}
return
true
,
err
case
8
:
// value.tmintPropProject
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
TerminateProposalProject
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_TmintPropProject
{
msg
}
return
true
,
err
case
9
:
// value.propRule
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
ProposalRule
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_PropRule
{
msg
}
return
true
,
err
case
10
:
// value.rvkPropRule
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
RevokeProposalRule
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_RvkPropRule
{
msg
}
return
true
,
err
case
11
:
// value.votePropRule
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
VoteProposalBoard
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_VotePropRule
{
msg
}
return
true
,
err
case
12
:
// value.tmintPropRule
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
TerminateProposalRule
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
AutonomyAction_TmintPropRule
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
}
func
_AutonomyAction_OneofSizer
(
msg
proto
.
Message
)
(
n
int
)
{
m
:=
msg
.
(
*
AutonomyAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
AutonomyAction_PropBoard
:
s
:=
proto
.
Size
(
x
.
PropBoard
)
n
+=
proto
.
SizeVarint
(
1
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_RvkPropBoard
:
s
:=
proto
.
Size
(
x
.
RvkPropBoard
)
n
+=
proto
.
SizeVarint
(
2
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_VotePropBoard
:
s
:=
proto
.
Size
(
x
.
VotePropBoard
)
n
+=
proto
.
SizeVarint
(
3
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_TmintPropBoard
:
s
:=
proto
.
Size
(
x
.
TmintPropBoard
)
n
+=
proto
.
SizeVarint
(
4
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_PropProject
:
s
:=
proto
.
Size
(
x
.
PropProject
)
n
+=
proto
.
SizeVarint
(
5
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_RvkPropProject
:
s
:=
proto
.
Size
(
x
.
RvkPropProject
)
n
+=
proto
.
SizeVarint
(
6
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_VotePropProject
:
s
:=
proto
.
Size
(
x
.
VotePropProject
)
n
+=
proto
.
SizeVarint
(
7
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_TmintPropProject
:
s
:=
proto
.
Size
(
x
.
TmintPropProject
)
n
+=
proto
.
SizeVarint
(
8
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_PropRule
:
s
:=
proto
.
Size
(
x
.
PropRule
)
n
+=
proto
.
SizeVarint
(
9
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_RvkPropRule
:
s
:=
proto
.
Size
(
x
.
RvkPropRule
)
n
+=
proto
.
SizeVarint
(
10
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_VotePropRule
:
s
:=
proto
.
Size
(
x
.
VotePropRule
)
n
+=
proto
.
SizeVarint
(
11
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
AutonomyAction_TmintPropRule
:
s
:=
proto
.
Size
(
x
.
TmintPropRule
)
n
+=
proto
.
SizeVarint
(
12
<<
3
|
proto
.
WireBytes
)
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
}
return
n
}
func
init
()
{
proto
.
RegisterType
((
*
AutonomyAction
)(
nil
),
"types.AutonomyAction"
)
}
// Reference imports to suppress errors if they are not otherwise used.
var
_
context
.
Context
var
_
grpc
.
ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const
_
=
grpc
.
SupportPackageIsVersion4
// Client API for Autonomy service
type
AutonomyClient
interface
{
QueryProposalBoard
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalBoard
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalBoard
,
error
)
QueryProposalProject
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalProject
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalProject
,
error
)
QueryProposalRule
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalRule
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalRule
,
error
)
}
type
autonomyClient
struct
{
cc
*
grpc
.
ClientConn
}
func
NewAutonomyClient
(
cc
*
grpc
.
ClientConn
)
AutonomyClient
{
return
&
autonomyClient
{
cc
}
}
func
(
c
*
autonomyClient
)
QueryProposalBoard
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalBoard
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalBoard
,
error
)
{
out
:=
new
(
ReplyProposalBoard
)
err
:=
grpc
.
Invoke
(
ctx
,
"/types.autonomy/QueryProposalBoard"
,
in
,
out
,
c
.
cc
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
autonomyClient
)
QueryProposalProject
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalProject
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalProject
,
error
)
{
out
:=
new
(
ReplyProposalProject
)
err
:=
grpc
.
Invoke
(
ctx
,
"/types.autonomy/QueryProposalProject"
,
in
,
out
,
c
.
cc
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
autonomyClient
)
QueryProposalRule
(
ctx
context
.
Context
,
in
*
ReplyQueryProposalRule
,
opts
...
grpc
.
CallOption
)
(
*
ReplyProposalRule
,
error
)
{
out
:=
new
(
ReplyProposalRule
)
err
:=
grpc
.
Invoke
(
ctx
,
"/types.autonomy/QueryProposalRule"
,
in
,
out
,
c
.
cc
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
// Server API for Autonomy service
type
AutonomyServer
interface
{
QueryProposalBoard
(
context
.
Context
,
*
ReplyQueryProposalBoard
)
(
*
ReplyProposalBoard
,
error
)
QueryProposalProject
(
context
.
Context
,
*
ReplyQueryProposalProject
)
(
*
ReplyProposalProject
,
error
)
QueryProposalRule
(
context
.
Context
,
*
ReplyQueryProposalRule
)
(
*
ReplyProposalRule
,
error
)
}
func
RegisterAutonomyServer
(
s
*
grpc
.
Server
,
srv
AutonomyServer
)
{
s
.
RegisterService
(
&
_Autonomy_serviceDesc
,
srv
)
}
func
_Autonomy_QueryProposalBoard_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ReplyQueryProposalBoard
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalBoard
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.autonomy/QueryProposalBoard"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalBoard
(
ctx
,
req
.
(
*
ReplyQueryProposalBoard
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Autonomy_QueryProposalProject_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ReplyQueryProposalProject
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalProject
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.autonomy/QueryProposalProject"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalProject
(
ctx
,
req
.
(
*
ReplyQueryProposalProject
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Autonomy_QueryProposalRule_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ReplyQueryProposalRule
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalRule
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.autonomy/QueryProposalRule"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
AutonomyServer
)
.
QueryProposalRule
(
ctx
,
req
.
(
*
ReplyQueryProposalRule
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
var
_Autonomy_serviceDesc
=
grpc
.
ServiceDesc
{
ServiceName
:
"types.autonomy"
,
HandlerType
:
(
*
AutonomyServer
)(
nil
),
Methods
:
[]
grpc
.
MethodDesc
{
{
MethodName
:
"QueryProposalBoard"
,
Handler
:
_Autonomy_QueryProposalBoard_Handler
,
},
{
MethodName
:
"QueryProposalProject"
,
Handler
:
_Autonomy_QueryProposalProject_Handler
,
},
{
MethodName
:
"QueryProposalRule"
,
Handler
:
_Autonomy_QueryProposalRule_Handler
,
},
},
Streams
:
[]
grpc
.
StreamDesc
{},
Metadata
:
"autonomy.proto"
,
}
func
init
()
{
proto
.
RegisterFile
(
"autonomy.proto"
,
fileDescriptor0
)
}
var
fileDescriptor0
=
[]
byte
{
// 436 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x94
,
0xcf
,
0xae
,
0xd2
,
0x40
,
0x14
,
0xc6
,
0x4b
,
0xb5
,
0x5c
,
0xee
,
0x29
,
0xad
,
0x7a
,
0xbc
,
0x31
,
0xbd
,
0xd5
,
0xab
,
0xa4
,
0x2b
,
0x56
,
0x24
,
0xa2
,
0x2b
,
0x13
,
0x0d
,
0x10
,
0xa2
,
0x6c
,
0x34
,
0xd0
,
0x18
,
0x5d
,
0x17
,
0x9c
,
0x05
,
0x52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09
,
0x61
,
0x99
,
0x72
,
0x22
,
0x7c
,
0x5b
,
0x76
,
0x8d
,
0xc3
,
0xac
,
0x9d
,
0xbb
,
0xf7
,
0xf5
,
0x5c
,
0x89
,
0x3c
,
0x0d
,
0x7f
,
0xc3
,
0x9d
,
0x82
,
0x14
,
0x17
,
0x31
,
0xba
,
0x28
,
0x95
,
0x13
,
0xee
,
0xeb
,
0x2e
,
0xad
,
0x0c
,
0x3d
,
0x0d
,
0x7f
,
0xc0
,
0x0b
,
0x05
,
0x13
,
0x35
,
0x1f
,
0x2e
,
0x5a
,
0xf3
,
0xd8
,
0x75
,
0xba
,
0x94
,
0x79
,
0xe2
,
0x69
,
0xdb
,
0xbe
,
0xf8
,
0x9e
,
0x7c
,
0x78
,
0x0c
,
0x00
,
0x00
,
0xff
,
0xff
,
0x9d
,
0xc2
,
0xca
,
0x38
,
0x90
,
0x04
,
0x00
,
0x00
,
}
plugin/dapp/autonomy/types/board.pb.go
0 → 100644
View file @
af694733
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: board.proto
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
type
AutonomyProposalBoard
struct
{
PropBoard
*
ProposalBoard
`protobuf:"bytes,1,opt,name=propBoard" json:"propBoard,omitempty"`
// 全体持票人投票结果
Res
*
VotesResult
`protobuf:"bytes,2,opt,name=res" json:"res,omitempty"`
// 状态
Status
int32
`protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
Address
string
`protobuf:"bytes,4,opt,name=address" json:"address,omitempty"`
Height
int64
`protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
Index
int32
`protobuf:"varint,6,opt,name=index" json:"index,omitempty"`
}
func
(
m
*
AutonomyProposalBoard
)
Reset
()
{
*
m
=
AutonomyProposalBoard
{}
}
func
(
m
*
AutonomyProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
AutonomyProposalBoard
)
ProtoMessage
()
{}
func
(
*
AutonomyProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
0
}
}
func
(
m
*
AutonomyProposalBoard
)
GetPropBoard
()
*
ProposalBoard
{
if
m
!=
nil
{
return
m
.
PropBoard
}
return
nil
}
func
(
m
*
AutonomyProposalBoard
)
GetRes
()
*
VotesResult
{
if
m
!=
nil
{
return
m
.
Res
}
return
nil
}
func
(
m
*
AutonomyProposalBoard
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
AutonomyProposalBoard
)
GetAddress
()
string
{
if
m
!=
nil
{
return
m
.
Address
}
return
""
}
func
(
m
*
AutonomyProposalBoard
)
GetHeight
()
int64
{
if
m
!=
nil
{
return
m
.
Height
}
return
0
}
func
(
m
*
AutonomyProposalBoard
)
GetIndex
()
int32
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
// action
type
ProposalBoard
struct
{
// 提案时间
Year
int32
`protobuf:"varint,1,opt,name=year" json:"year,omitempty"`
Month
int32
`protobuf:"varint,2,opt,name=month" json:"month,omitempty"`
Day
int32
`protobuf:"varint,3,opt,name=day" json:"day,omitempty"`
// 提案董事会成员
Boards
[]
string
`protobuf:"bytes,4,rep,name=boards" json:"boards,omitempty"`
// 投票相关
StartBlockHeight
int64
`protobuf:"varint,5,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"`
EndBlockHeight
int64
`protobuf:"varint,6,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"`
RealEndBlockHeight
int64
`protobuf:"varint,7,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"`
}
func
(
m
*
ProposalBoard
)
Reset
()
{
*
m
=
ProposalBoard
{}
}
func
(
m
*
ProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ProposalBoard
)
ProtoMessage
()
{}
func
(
*
ProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
1
}
}
func
(
m
*
ProposalBoard
)
GetYear
()
int32
{
if
m
!=
nil
{
return
m
.
Year
}
return
0
}
func
(
m
*
ProposalBoard
)
GetMonth
()
int32
{
if
m
!=
nil
{
return
m
.
Month
}
return
0
}
func
(
m
*
ProposalBoard
)
GetDay
()
int32
{
if
m
!=
nil
{
return
m
.
Day
}
return
0
}
func
(
m
*
ProposalBoard
)
GetBoards
()
[]
string
{
if
m
!=
nil
{
return
m
.
Boards
}
return
nil
}
func
(
m
*
ProposalBoard
)
GetStartBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
StartBlockHeight
}
return
0
}
func
(
m
*
ProposalBoard
)
GetEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
EndBlockHeight
}
return
0
}
func
(
m
*
ProposalBoard
)
GetRealEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
RealEndBlockHeight
}
return
0
}
type
RevokeProposalBoard
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
RevokeProposalBoard
)
Reset
()
{
*
m
=
RevokeProposalBoard
{}
}
func
(
m
*
RevokeProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RevokeProposalBoard
)
ProtoMessage
()
{}
func
(
*
RevokeProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
2
}
}
func
(
m
*
RevokeProposalBoard
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
VoteProposalBoard
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
Approve
bool
`protobuf:"varint,2,opt,name=approve" json:"approve,omitempty"`
}
func
(
m
*
VoteProposalBoard
)
Reset
()
{
*
m
=
VoteProposalBoard
{}
}
func
(
m
*
VoteProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VoteProposalBoard
)
ProtoMessage
()
{}
func
(
*
VoteProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
3
}
}
func
(
m
*
VoteProposalBoard
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
func
(
m
*
VoteProposalBoard
)
GetApprove
()
bool
{
if
m
!=
nil
{
return
m
.
Approve
}
return
false
}
type
TerminateProposalBoard
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
TerminateProposalBoard
)
Reset
()
{
*
m
=
TerminateProposalBoard
{}
}
func
(
m
*
TerminateProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TerminateProposalBoard
)
ProtoMessage
()
{}
func
(
*
TerminateProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
4
}
}
func
(
m
*
TerminateProposalBoard
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
// receipt
type
ReceiptProposalBoard
struct
{
Prev
*
AutonomyProposalBoard
`protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"`
Current
*
AutonomyProposalBoard
`protobuf:"bytes,2,opt,name=current" json:"current,omitempty"`
}
func
(
m
*
ReceiptProposalBoard
)
Reset
()
{
*
m
=
ReceiptProposalBoard
{}
}
func
(
m
*
ReceiptProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptProposalBoard
)
ProtoMessage
()
{}
func
(
*
ReceiptProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
5
}
}
func
(
m
*
ReceiptProposalBoard
)
GetPrev
()
*
AutonomyProposalBoard
{
if
m
!=
nil
{
return
m
.
Prev
}
return
nil
}
func
(
m
*
ReceiptProposalBoard
)
GetCurrent
()
*
AutonomyProposalBoard
{
if
m
!=
nil
{
return
m
.
Current
}
return
nil
}
type
LocalProposalBoard
struct
{
PropBd
*
AutonomyProposalBoard
`protobuf:"bytes,1,opt,name=propBd" json:"propBd,omitempty"`
Comments
[]
string
`protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"`
}
func
(
m
*
LocalProposalBoard
)
Reset
()
{
*
m
=
LocalProposalBoard
{}
}
func
(
m
*
LocalProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
LocalProposalBoard
)
ProtoMessage
()
{}
func
(
*
LocalProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
6
}
}
func
(
m
*
LocalProposalBoard
)
GetPropBd
()
*
AutonomyProposalBoard
{
if
m
!=
nil
{
return
m
.
PropBd
}
return
nil
}
func
(
m
*
LocalProposalBoard
)
GetComments
()
[]
string
{
if
m
!=
nil
{
return
m
.
Comments
}
return
nil
}
// query
type
ReplyQueryProposalBoard
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
ReplyQueryProposalBoard
)
Reset
()
{
*
m
=
ReplyQueryProposalBoard
{}
}
func
(
m
*
ReplyQueryProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyQueryProposalBoard
)
ProtoMessage
()
{}
func
(
*
ReplyQueryProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
7
}
}
func
(
m
*
ReplyQueryProposalBoard
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
ReplyProposalBoard
struct
{
PropBoards
[]
*
LocalProposalBoard
`protobuf:"bytes,1,rep,name=propBoards" json:"propBoards,omitempty"`
}
func
(
m
*
ReplyProposalBoard
)
Reset
()
{
*
m
=
ReplyProposalBoard
{}
}
func
(
m
*
ReplyProposalBoard
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyProposalBoard
)
ProtoMessage
()
{}
func
(
*
ReplyProposalBoard
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor1
,
[]
int
{
8
}
}
func
(
m
*
ReplyProposalBoard
)
GetPropBoards
()
[]
*
LocalProposalBoard
{
if
m
!=
nil
{
return
m
.
PropBoards
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
AutonomyProposalBoard
)(
nil
),
"types.AutonomyProposalBoard"
)
proto
.
RegisterType
((
*
ProposalBoard
)(
nil
),
"types.ProposalBoard"
)
proto
.
RegisterType
((
*
RevokeProposalBoard
)(
nil
),
"types.RevokeProposalBoard"
)
proto
.
RegisterType
((
*
VoteProposalBoard
)(
nil
),
"types.VoteProposalBoard"
)
proto
.
RegisterType
((
*
TerminateProposalBoard
)(
nil
),
"types.TerminateProposalBoard"
)
proto
.
RegisterType
((
*
ReceiptProposalBoard
)(
nil
),
"types.ReceiptProposalBoard"
)
proto
.
RegisterType
((
*
LocalProposalBoard
)(
nil
),
"types.LocalProposalBoard"
)
proto
.
RegisterType
((
*
ReplyQueryProposalBoard
)(
nil
),
"types.ReplyQueryProposalBoard"
)
proto
.
RegisterType
((
*
ReplyProposalBoard
)(
nil
),
"types.ReplyProposalBoard"
)
}
func
init
()
{
proto
.
RegisterFile
(
"board.proto"
,
fileDescriptor1
)
}
var
fileDescriptor1
=
[]
byte
{
// 467 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x94
,
0x53
,
0x5d
,
0x8b
,
0xd4
,
0x30
,
0x14
,
0xa5
,
0x76
,
0xda
,
0xd9
,
0xb9
,
0xc3
,
0xca
,
0x1a
,
0xc7
,
0xb5
,
0x2e
,
0x22
,
0xa5
,
0x88
,
0x14
,
0x1f
,
0x06
,
0x19
,
0x3f
,
0x70
,
0x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76
,
0x28
,
0x7c
,
0x04
,
0x23
,
0xa5
,
0x71
,
0xe3
,
0x73
,
0x77
,
0xd7
,
0x27
,
0x69
,
0x6f
,
0x50
,
0x39
,
0x31
,
0xd9
,
0x33
,
0x18
,
0x17
,
0xad
,
0xd6
,
0xd8
,
0x58
,
0x1f
,
0xbf
,
0x7f
,
0x8b
,
0xb6
,
0xe4
,
0xec
,
0x0b
,
0xb0
,
0xb7
,
0xb2
,
0x10
,
0xd5
,
0xf0
,
0xfe
,
0x27
,
0x10
,
0x53
,
0xaa
,
0xcb
,
0xff
,
0x72
,
0xe0
,
0xb9
,
0xec
,
0x0c
,
0x8e
,
0xdc
,
0x70
,
0x61
,
0x63
,
0xdd
,
0x0c
,
0xb8
,
0xb0
,
0xfc
,
0xc6
,
0xd9
,
0x39
,
0xdc
,
0xe6
,
0xa8
,
0xaa
,
0xee
,
0x63
,
0x8b
,
0xba
,
0x3b
,
0xec
,
0x95
,
0xde
,
0x03
,
0x23
,
0xe9
,
0x50
,
0x75
,
0xde
,
0xab
,
0x96
,
0x7d
,
0x36
,
0x83
,
0x34
,
0xcc
,
0xa7
,
0x8b
,
0x3b
,
0xde
,
0xe6
,
0xd5
,
0x8e
,
0xf8
,
0x0e
,
0xf9
,
0x22
,
0xa6
,
0xd9
,
0x7f
,
0xfc
,
0x2b
,
0x00
,
0x00
,
0xff
,
0xff
,
0x3b
,
0xd3
,
0xb7
,
0x34
,
0x20
,
0x04
,
0x00
,
0x00
,
}
plugin/dapp/autonomy/types/const.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
// autonomy action ty
const
(
AutonomyActionPropBoard
=
iota
+
1
AutonomyActionRvkPropBoard
AutonomyActionVotePropBoard
AutonomyActionTmintPropBoard
AutonomyActionPropProject
AutonomyActionRvkPropProject
AutonomyActionVotePropProject
AutonomyActionTmintPropProject
AutonomyActionPropRule
AutonomyActionRvkPropRule
AutonomyActionVotePropRule
AutonomyActionTmintPropRule
//log for autonomy
TyLogPropBoard
=
2101
TyLogRvkPropBoard
=
2102
TyLogVotePropBoard
=
2103
TyLogTmintPropBoard
=
2104
TyLogPropProject
=
2111
TyLogRvkPropProject
=
2112
TyLogVotePropProject
=
2113
TyLogTmintPropProject
=
2114
TyLogPropRule
=
2121
TyLogRvkPropRule
=
2122
TyLogVotePropRule
=
2123
TyLogTmintPropRule
=
2124
)
const
(
// Action_PropBoard Action 名字
Action_PropBoard
=
"propBoard"
// Action_RvkPropBoard Action 名字
Action_RvkPropBoard
=
"rvkPropBoard"
// Action_TmintPropBoard Action 名字
Action_TmintPropBoard
=
"tmintPropBoard"
// Action_PropProject Action 名字
Action_PropProject
=
"propProject"
// Action_RvkPropProject Action 名字
Action_RvkPropProject
=
"rvkPropProject"
// Action_TmintPropProject Action 名字
Action_TmintPropProject
=
"tmintPropProject"
// Action_PropRule Action 名字
Action_PropRule
=
"propRule"
// Action_RvkPropRule Action 名字
Action_RvkPropRule
=
"rvkPropRule"
// Action_TmintPropRule Action 名字
Action_TmintPropRule
=
"tmintPropRule"
)
// status
const
(
AutonomyStatusProposalBoard
=
iota
+
1
AutonomyStatusRvkPropBoard
AutonomyStatusVotePropBoard
AutonomyStatusTmintPropBoard
)
const
(
// FuncNameQueryProposalBoard 查询方法名
FuncNameQueryProposalBoard
=
"QueryProposalBoard"
FuncNameQueryProposalProject
=
"QueryProposalProject"
FuncNameQueryProposalRule
=
"QueryProposalRule"
)
//包的名字可以通过配置文件来配置
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//如果发生重名,可以通过配置文件修改这些名字
var
(
PackageName
=
"chain33.autonomy"
RPCName
=
"Chain33.Autonomy"
AutonomyX
=
"autonomy"
ExecerAutonomy
=
[]
byte
(
AutonomyX
)
)
plugin/dapp/autonomy/types/errors.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
import
"errors"
var
(
// ErrVotePeriod 非投票期间
ErrVotePeriod
=
errors
.
New
(
"ErrVotePeriod"
)
// ErrProposalStatus 状态错误
ErrProposalStatus
=
errors
.
New
(
"ErrProposalStatus"
)
// ErrRepeatVoteAddr 重复投票地址
ErrRepeatVoteAddr
=
errors
.
New
(
"ErrRepeatVoteAddr"
)
// ErrRevokePeriod 非取消提案期间
ErrRevokeProposalPeriod
=
errors
.
New
(
"ErrRevokeProposalPeriod"
)
// ErrRevokeProposalPower 不能取消
ErrRevokeProposalPower
=
errors
.
New
(
"ErrRevokeProposalPower"
)
// ErrRevokeProposal 不能取消
//ErrRevokeProposal = errors.New("ErrRevokeProposal")
)
plugin/dapp/autonomy/types/lcommon.pb.go
0 → 100644
View file @
af694733
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: lcommon.proto
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
type
VotesResult
struct
{
// 总票数
TotalVotes
int32
`protobuf:"varint,1,opt,name=totalVotes" json:"totalVotes,omitempty"`
// 赞成票
ApproveVotes
int32
`protobuf:"varint,2,opt,name=approveVotes" json:"approveVotes,omitempty"`
// 反对票
OpposeVotes
int32
`protobuf:"varint,3,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
Pass
bool
`protobuf:"varint,4,opt,name=pass" json:"pass,omitempty"`
}
func
(
m
*
VotesResult
)
Reset
()
{
*
m
=
VotesResult
{}
}
func
(
m
*
VotesResult
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VotesResult
)
ProtoMessage
()
{}
func
(
*
VotesResult
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
0
}
}
func
(
m
*
VotesResult
)
GetTotalVotes
()
int32
{
if
m
!=
nil
{
return
m
.
TotalVotes
}
return
0
}
func
(
m
*
VotesResult
)
GetApproveVotes
()
int32
{
if
m
!=
nil
{
return
m
.
ApproveVotes
}
return
0
}
func
(
m
*
VotesResult
)
GetOpposeVotes
()
int32
{
if
m
!=
nil
{
return
m
.
OpposeVotes
}
return
0
}
func
(
m
*
VotesResult
)
GetPass
()
bool
{
if
m
!=
nil
{
return
m
.
Pass
}
return
false
}
type
VotesRecord
struct
{
Address
[]
string
`protobuf:"bytes,1,rep,name=address" json:"address,omitempty"`
}
func
(
m
*
VotesRecord
)
Reset
()
{
*
m
=
VotesRecord
{}
}
func
(
m
*
VotesRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VotesRecord
)
ProtoMessage
()
{}
func
(
*
VotesRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
1
}
}
func
(
m
*
VotesRecord
)
GetAddress
()
[]
string
{
if
m
!=
nil
{
return
m
.
Address
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
VotesResult
)(
nil
),
"types.VotesResult"
)
proto
.
RegisterType
((
*
VotesRecord
)(
nil
),
"types.VotesRecord"
)
}
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor2
)
}
var
fileDescriptor2
=
[]
byte
{
// 161 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x54
,
0x8f
,
0xbd
,
0xae
,
0xc2
,
0x30
,
0x0c
,
0x46
,
0x95
,
0xdb
,
0xf6
,
0x02
,
0x2e
,
0x2c
,
0x9e
,
0x3a
,
0xa1
,
0xaa
,
0x0b
,
0x99
,
0x58
,
0x78
,
0x93
,
0x0c
,
0xec
,
0xa1
,
0xc9
,
0x96
,
0x62
,
0x2b
,
0x36
,
0x48
,
0x3c
,
0x01
,
0xaf
,
0x8d
,
0x08
,
0x3f
,
0x2a
,
0x9b
,
0x7d
,
0x74
,
0x86
,
0xf3
,
0xc1
,
0x26
,
0x8d
,
0x34
,
0x4d
,
0x74
,
0xde
,
0x73
,
0x26
,
0x25
,
0x6c
,
0xf4
,
0xc6
,
0x51
,
0x86
,
0xbb
,
0x81
,
0xf6
,
0x48
,
0x1a
,
0xc5
,
0x45
,
0xb9
,
0x24
,
0xc5
,
0x2d
,
0x80
,
0x92
,
0xfa
,
0x54
,
0x58
,
0x67
,
0x7a
,
0x63
,
0x1b
,
0x37
,
0x23
,
0x38
,
0xc0
,
0xda
,
0x33
,
0x67
,
0xba
,
0xc6
,
0x97
,
0xf1
,
0x57
,
0x8c
,
0x1f
,
0x86
,
0x3d
,
0xb4
,
0xc4
,
0x4c
,
0xf2
,
0x56
,
0xaa
,
0xa2
,
0xcc
,
0x11
,
0x22
,
0xd4
,
0xec
,
0x45
,
0xba
,
0xba
,
0x37
,
0x76
,
0xe9
,
0xca
,
0x3d
,
0xec
,
0xbe
,
0x21
,
0x23
,
0xe5
,
0x80
,
0x1d
,
0x2c
,
0x7c
,
0x08
,
0x39
,
0xca
,
0xb3
,
0xa2
,
0xb2
,
0x2b
,
0xf7
,
0x79
,
0x4f
,
0xff
,
0x65
,
0xc0
,
0xe1
,
0x11
,
0x00
,
0x00
,
0xff
,
0xff
,
0x6b
,
0x42
,
0x8d
,
0xc4
,
0xd1
,
0x00
,
0x00
,
0x00
,
}
plugin/dapp/autonomy/types/project.pb.go
0 → 100644
View file @
af694733
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: project.proto
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
type
AutonomyProposalProject
struct
{
PropProject
*
ProposalProject
`protobuf:"bytes,1,opt,name=propProject" json:"propProject,omitempty"`
// 董事会投票结果
BoardResult
*
VotesResult
`protobuf:"bytes,2,opt,name=boardResult" json:"boardResult,omitempty"`
// 是否需要公示
Publicity
bool
`protobuf:"varint,3,opt,name=publicity" json:"publicity,omitempty"`
// 全体持票人反对票
OpposeVotes
int32
`protobuf:"varint,4,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
PubPass
bool
`protobuf:"varint,5,opt,name=pubPass" json:"pubPass,omitempty"`
// 状态
Status
int32
`protobuf:"varint,6,opt,name=status" json:"status,omitempty"`
}
func
(
m
*
AutonomyProposalProject
)
Reset
()
{
*
m
=
AutonomyProposalProject
{}
}
func
(
m
*
AutonomyProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
AutonomyProposalProject
)
ProtoMessage
()
{}
func
(
*
AutonomyProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
0
}
}
func
(
m
*
AutonomyProposalProject
)
GetPropProject
()
*
ProposalProject
{
if
m
!=
nil
{
return
m
.
PropProject
}
return
nil
}
func
(
m
*
AutonomyProposalProject
)
GetBoardResult
()
*
VotesResult
{
if
m
!=
nil
{
return
m
.
BoardResult
}
return
nil
}
func
(
m
*
AutonomyProposalProject
)
GetPublicity
()
bool
{
if
m
!=
nil
{
return
m
.
Publicity
}
return
false
}
func
(
m
*
AutonomyProposalProject
)
GetOpposeVotes
()
int32
{
if
m
!=
nil
{
return
m
.
OpposeVotes
}
return
0
}
func
(
m
*
AutonomyProposalProject
)
GetPubPass
()
bool
{
if
m
!=
nil
{
return
m
.
PubPass
}
return
false
}
func
(
m
*
AutonomyProposalProject
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
type
ProposalProject
struct
{
// 提案时间
Year
int32
`protobuf:"varint,1,opt,name=year" json:"year,omitempty"`
Month
int32
`protobuf:"varint,2,opt,name=month" json:"month,omitempty"`
Day
int32
`protobuf:"varint,3,opt,name=day" json:"day,omitempty"`
// 项目相关
FirstStage
string
`protobuf:"bytes,4,opt,name=firstStage" json:"firstStage,omitempty"`
LastStage
string
`protobuf:"bytes,5,opt,name=lastStage" json:"lastStage,omitempty"`
Production
string
`protobuf:"bytes,6,opt,name=production" json:"production,omitempty"`
Description
string
`protobuf:"bytes,7,opt,name=description" json:"description,omitempty"`
Contractor
string
`protobuf:"bytes,8,opt,name=contractor" json:"contractor,omitempty"`
Amount
int32
`protobuf:"varint,9,opt,name=amount" json:"amount,omitempty"`
AmountDetail
string
`protobuf:"bytes,10,opt,name=amountDetail" json:"amountDetail,omitempty"`
// 支付相关
ToAddr
string
`protobuf:"bytes,11,opt,name=toAddr" json:"toAddr,omitempty"`
// 投票相关
StartBlockHeight
int64
`protobuf:"varint,12,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"`
EndBlockHeight
int64
`protobuf:"varint,13,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"`
RealEndBlockHeight
int64
`protobuf:"varint,14,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"`
ProjectNeedBlockNum
int32
`protobuf:"varint,15,opt,name=projectNeedBlockNum" json:"projectNeedBlockNum,omitempty"`
}
func
(
m
*
ProposalProject
)
Reset
()
{
*
m
=
ProposalProject
{}
}
func
(
m
*
ProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ProposalProject
)
ProtoMessage
()
{}
func
(
*
ProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
1
}
}
func
(
m
*
ProposalProject
)
GetYear
()
int32
{
if
m
!=
nil
{
return
m
.
Year
}
return
0
}
func
(
m
*
ProposalProject
)
GetMonth
()
int32
{
if
m
!=
nil
{
return
m
.
Month
}
return
0
}
func
(
m
*
ProposalProject
)
GetDay
()
int32
{
if
m
!=
nil
{
return
m
.
Day
}
return
0
}
func
(
m
*
ProposalProject
)
GetFirstStage
()
string
{
if
m
!=
nil
{
return
m
.
FirstStage
}
return
""
}
func
(
m
*
ProposalProject
)
GetLastStage
()
string
{
if
m
!=
nil
{
return
m
.
LastStage
}
return
""
}
func
(
m
*
ProposalProject
)
GetProduction
()
string
{
if
m
!=
nil
{
return
m
.
Production
}
return
""
}
func
(
m
*
ProposalProject
)
GetDescription
()
string
{
if
m
!=
nil
{
return
m
.
Description
}
return
""
}
func
(
m
*
ProposalProject
)
GetContractor
()
string
{
if
m
!=
nil
{
return
m
.
Contractor
}
return
""
}
func
(
m
*
ProposalProject
)
GetAmount
()
int32
{
if
m
!=
nil
{
return
m
.
Amount
}
return
0
}
func
(
m
*
ProposalProject
)
GetAmountDetail
()
string
{
if
m
!=
nil
{
return
m
.
AmountDetail
}
return
""
}
func
(
m
*
ProposalProject
)
GetToAddr
()
string
{
if
m
!=
nil
{
return
m
.
ToAddr
}
return
""
}
func
(
m
*
ProposalProject
)
GetStartBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
StartBlockHeight
}
return
0
}
func
(
m
*
ProposalProject
)
GetEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
EndBlockHeight
}
return
0
}
func
(
m
*
ProposalProject
)
GetRealEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
RealEndBlockHeight
}
return
0
}
func
(
m
*
ProposalProject
)
GetProjectNeedBlockNum
()
int32
{
if
m
!=
nil
{
return
m
.
ProjectNeedBlockNum
}
return
0
}
type
RevokeProposalProject
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
RevokeProposalProject
)
Reset
()
{
*
m
=
RevokeProposalProject
{}
}
func
(
m
*
RevokeProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RevokeProposalProject
)
ProtoMessage
()
{}
func
(
*
RevokeProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
2
}
}
func
(
m
*
RevokeProposalProject
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
TerminateProposalProject
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
TerminateProposalProject
)
Reset
()
{
*
m
=
TerminateProposalProject
{}
}
func
(
m
*
TerminateProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TerminateProposalProject
)
ProtoMessage
()
{}
func
(
*
TerminateProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
3
}
}
func
(
m
*
TerminateProposalProject
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
// receipt
type
ReceiptProposalProject
struct
{
Prev
*
AutonomyProposalProject
`protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"`
Current
*
AutonomyProposalProject
`protobuf:"bytes,2,opt,name=current" json:"current,omitempty"`
}
func
(
m
*
ReceiptProposalProject
)
Reset
()
{
*
m
=
ReceiptProposalProject
{}
}
func
(
m
*
ReceiptProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptProposalProject
)
ProtoMessage
()
{}
func
(
*
ReceiptProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
4
}
}
func
(
m
*
ReceiptProposalProject
)
GetPrev
()
*
AutonomyProposalProject
{
if
m
!=
nil
{
return
m
.
Prev
}
return
nil
}
func
(
m
*
ReceiptProposalProject
)
GetCurrent
()
*
AutonomyProposalProject
{
if
m
!=
nil
{
return
m
.
Current
}
return
nil
}
type
LocalProposalProject
struct
{
PropPrj
*
AutonomyProposalProject
`protobuf:"bytes,1,opt,name=propPrj" json:"propPrj,omitempty"`
Comments
[]
string
`protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"`
}
func
(
m
*
LocalProposalProject
)
Reset
()
{
*
m
=
LocalProposalProject
{}
}
func
(
m
*
LocalProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
LocalProposalProject
)
ProtoMessage
()
{}
func
(
*
LocalProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
5
}
}
func
(
m
*
LocalProposalProject
)
GetPropPrj
()
*
AutonomyProposalProject
{
if
m
!=
nil
{
return
m
.
PropPrj
}
return
nil
}
func
(
m
*
LocalProposalProject
)
GetComments
()
[]
string
{
if
m
!=
nil
{
return
m
.
Comments
}
return
nil
}
// query
type
ReplyQueryProposalProject
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
ReplyQueryProposalProject
)
Reset
()
{
*
m
=
ReplyQueryProposalProject
{}
}
func
(
m
*
ReplyQueryProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyQueryProposalProject
)
ProtoMessage
()
{}
func
(
*
ReplyQueryProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
6
}
}
func
(
m
*
ReplyQueryProposalProject
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
ReplyProposalProject
struct
{
PropProjects
[]
*
LocalProposalProject
`protobuf:"bytes,1,rep,name=propProjects" json:"propProjects,omitempty"`
}
func
(
m
*
ReplyProposalProject
)
Reset
()
{
*
m
=
ReplyProposalProject
{}
}
func
(
m
*
ReplyProposalProject
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyProposalProject
)
ProtoMessage
()
{}
func
(
*
ReplyProposalProject
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor3
,
[]
int
{
7
}
}
func
(
m
*
ReplyProposalProject
)
GetPropProjects
()
[]
*
LocalProposalProject
{
if
m
!=
nil
{
return
m
.
PropProjects
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
AutonomyProposalProject
)(
nil
),
"types.AutonomyProposalProject"
)
proto
.
RegisterType
((
*
ProposalProject
)(
nil
),
"types.ProposalProject"
)
proto
.
RegisterType
((
*
RevokeProposalProject
)(
nil
),
"types.RevokeProposalProject"
)
proto
.
RegisterType
((
*
TerminateProposalProject
)(
nil
),
"types.TerminateProposalProject"
)
proto
.
RegisterType
((
*
ReceiptProposalProject
)(
nil
),
"types.ReceiptProposalProject"
)
proto
.
RegisterType
((
*
LocalProposalProject
)(
nil
),
"types.LocalProposalProject"
)
proto
.
RegisterType
((
*
ReplyQueryProposalProject
)(
nil
),
"types.ReplyQueryProposalProject"
)
proto
.
RegisterType
((
*
ReplyProposalProject
)(
nil
),
"types.ReplyProposalProject"
)
}
func
init
()
{
proto
.
RegisterFile
(
"project.proto"
,
fileDescriptor3
)
}
var
fileDescriptor3
=
[]
byte
{
// 579 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x94
,
0x94
,
0x4f
,
0x6f
,
0xd4
,
0x3c
,
0x10
,
0xc6
,
0x95
,
0x6e
,
0xd3
,
0xed
,
0xce
,
0xf6
,
0x9f
,
0xfc
,
0xf6
,
0x2d
,
0xa6
,
0xa0
,
0x2a
,
0xca
,
0x01
,
0x45
,
0x1c
,
0x56
,
0xa8
,
0x20
,
0x51
,
0xc1
,
0x01
,
0x15
,
0x15
,
0x09
,
0x24
,
0x54
,
0x15
,
0x83
,
0xe0
,
0xec
,
0x4d
,
0x4c
,
0x9b
,
0x36
,
0x89
,
0x2d
,
0x7b
,
0x52
,
0x29
,
0x5f
,
0x80
,
0xaf
,
0xcc
,
0x81
,
0x0b
,
0xca
,
0x38
,
0x4b
,
0xd3
,
0xb0
,
0x08
,
0x7a
,
0xf3
,
0x3c
,
0xf3
,
0xfc
,
0xac
,
0x19
,
0xdb
,
0x63
,
0xd8
,
0x34
,
0x56
,
0x5f
,
0xaa
,
0x14
,
0x67
,
0xc6
,
0x6a
,
0xd4
,
0x2c
,
0xc4
,
0xc6
,
0x28
,
0xb7
,
0xbf
,
0x59
,
0xa4
,
0xba
,
0x2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x00
,
0x00
,
0xff
,
0xff
,
0xe1
,
0xe0
,
0x86
,
0xbb
,
0x27
,
0x05
,
0x00
,
0x00
,
}
plugin/dapp/autonomy/types/rule.pb.go
0 → 100644
View file @
af694733
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: rule.proto
package
types
import
proto
"github.com/golang/protobuf/proto"
import
fmt
"fmt"
import
math
"math"
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
type
AutonomyProposalRule
struct
{
PropRule
*
ProposalRule
`protobuf:"bytes,1,opt,name=propRule" json:"propRule,omitempty"`
// 全体持票人投票结果
Res
*
VotesResult
`protobuf:"bytes,2,opt,name=res" json:"res,omitempty"`
// 状态
Status
int32
`protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
}
func
(
m
*
AutonomyProposalRule
)
Reset
()
{
*
m
=
AutonomyProposalRule
{}
}
func
(
m
*
AutonomyProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
AutonomyProposalRule
)
ProtoMessage
()
{}
func
(
*
AutonomyProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
0
}
}
func
(
m
*
AutonomyProposalRule
)
GetPropRule
()
*
ProposalRule
{
if
m
!=
nil
{
return
m
.
PropRule
}
return
nil
}
func
(
m
*
AutonomyProposalRule
)
GetRes
()
*
VotesResult
{
if
m
!=
nil
{
return
m
.
Res
}
return
nil
}
func
(
m
*
AutonomyProposalRule
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
type
ProposalRule
struct
{
// 提案时间
Year
int32
`protobuf:"varint,1,opt,name=year" json:"year,omitempty"`
Month
int32
`protobuf:"varint,2,opt,name=month" json:"month,omitempty"`
Day
int32
`protobuf:"varint,3,opt,name=day" json:"day,omitempty"`
// 可修改项
BoardAttendProb
int32
`protobuf:"varint,4,opt,name=boardAttendProb" json:"boardAttendProb,omitempty"`
BoardPassProb
int32
`protobuf:"varint,5,opt,name=boardPassProb" json:"boardPassProb,omitempty"`
OpposeProb
int32
`protobuf:"varint,6,opt,name=opposeProb" json:"opposeProb,omitempty"`
ProposalAmount
int32
`protobuf:"varint,7,opt,name=proposalAmount" json:"proposalAmount,omitempty"`
PubAmountThreshold
int32
`protobuf:"varint,8,opt,name=pubAmountThreshold" json:"pubAmountThreshold,omitempty"`
// 投票相关
StartBlockHeight
int64
`protobuf:"varint,9,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"`
EndBlockHeight
int64
`protobuf:"varint,10,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"`
RealEndBlockHeight
int64
`protobuf:"varint,11,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"`
}
func
(
m
*
ProposalRule
)
Reset
()
{
*
m
=
ProposalRule
{}
}
func
(
m
*
ProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ProposalRule
)
ProtoMessage
()
{}
func
(
*
ProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
1
}
}
func
(
m
*
ProposalRule
)
GetYear
()
int32
{
if
m
!=
nil
{
return
m
.
Year
}
return
0
}
func
(
m
*
ProposalRule
)
GetMonth
()
int32
{
if
m
!=
nil
{
return
m
.
Month
}
return
0
}
func
(
m
*
ProposalRule
)
GetDay
()
int32
{
if
m
!=
nil
{
return
m
.
Day
}
return
0
}
func
(
m
*
ProposalRule
)
GetBoardAttendProb
()
int32
{
if
m
!=
nil
{
return
m
.
BoardAttendProb
}
return
0
}
func
(
m
*
ProposalRule
)
GetBoardPassProb
()
int32
{
if
m
!=
nil
{
return
m
.
BoardPassProb
}
return
0
}
func
(
m
*
ProposalRule
)
GetOpposeProb
()
int32
{
if
m
!=
nil
{
return
m
.
OpposeProb
}
return
0
}
func
(
m
*
ProposalRule
)
GetProposalAmount
()
int32
{
if
m
!=
nil
{
return
m
.
ProposalAmount
}
return
0
}
func
(
m
*
ProposalRule
)
GetPubAmountThreshold
()
int32
{
if
m
!=
nil
{
return
m
.
PubAmountThreshold
}
return
0
}
func
(
m
*
ProposalRule
)
GetStartBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
StartBlockHeight
}
return
0
}
func
(
m
*
ProposalRule
)
GetEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
EndBlockHeight
}
return
0
}
func
(
m
*
ProposalRule
)
GetRealEndBlockHeight
()
int64
{
if
m
!=
nil
{
return
m
.
RealEndBlockHeight
}
return
0
}
type
RevokeProposalRule
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
RevokeProposalRule
)
Reset
()
{
*
m
=
RevokeProposalRule
{}
}
func
(
m
*
RevokeProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RevokeProposalRule
)
ProtoMessage
()
{}
func
(
*
RevokeProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
2
}
}
func
(
m
*
RevokeProposalRule
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
TerminateProposalRule
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
TerminateProposalRule
)
Reset
()
{
*
m
=
TerminateProposalRule
{}
}
func
(
m
*
TerminateProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TerminateProposalRule
)
ProtoMessage
()
{}
func
(
*
TerminateProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
3
}
}
func
(
m
*
TerminateProposalRule
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
// receipt
type
ReceiptProposalRule
struct
{
Prev
*
AutonomyProposalRule
`protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"`
Current
*
AutonomyProposalRule
`protobuf:"bytes,2,opt,name=current" json:"current,omitempty"`
}
func
(
m
*
ReceiptProposalRule
)
Reset
()
{
*
m
=
ReceiptProposalRule
{}
}
func
(
m
*
ReceiptProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptProposalRule
)
ProtoMessage
()
{}
func
(
*
ReceiptProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
4
}
}
func
(
m
*
ReceiptProposalRule
)
GetPrev
()
*
AutonomyProposalRule
{
if
m
!=
nil
{
return
m
.
Prev
}
return
nil
}
func
(
m
*
ReceiptProposalRule
)
GetCurrent
()
*
AutonomyProposalRule
{
if
m
!=
nil
{
return
m
.
Current
}
return
nil
}
type
LocalProposalRule
struct
{
PropRule
*
AutonomyProposalRule
`protobuf:"bytes,1,opt,name=propRule" json:"propRule,omitempty"`
Comments
[]
string
`protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"`
}
func
(
m
*
LocalProposalRule
)
Reset
()
{
*
m
=
LocalProposalRule
{}
}
func
(
m
*
LocalProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
LocalProposalRule
)
ProtoMessage
()
{}
func
(
*
LocalProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
5
}
}
func
(
m
*
LocalProposalRule
)
GetPropRule
()
*
AutonomyProposalRule
{
if
m
!=
nil
{
return
m
.
PropRule
}
return
nil
}
func
(
m
*
LocalProposalRule
)
GetComments
()
[]
string
{
if
m
!=
nil
{
return
m
.
Comments
}
return
nil
}
// query
type
ReplyQueryProposalRule
struct
{
ProposalID
string
`protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"`
}
func
(
m
*
ReplyQueryProposalRule
)
Reset
()
{
*
m
=
ReplyQueryProposalRule
{}
}
func
(
m
*
ReplyQueryProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyQueryProposalRule
)
ProtoMessage
()
{}
func
(
*
ReplyQueryProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
6
}
}
func
(
m
*
ReplyQueryProposalRule
)
GetProposalID
()
string
{
if
m
!=
nil
{
return
m
.
ProposalID
}
return
""
}
type
ReplyProposalRule
struct
{
PropRules
[]
*
LocalProposalRule
`protobuf:"bytes,1,rep,name=propRules" json:"propRules,omitempty"`
}
func
(
m
*
ReplyProposalRule
)
Reset
()
{
*
m
=
ReplyProposalRule
{}
}
func
(
m
*
ReplyProposalRule
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyProposalRule
)
ProtoMessage
()
{}
func
(
*
ReplyProposalRule
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor4
,
[]
int
{
7
}
}
func
(
m
*
ReplyProposalRule
)
GetPropRules
()
[]
*
LocalProposalRule
{
if
m
!=
nil
{
return
m
.
PropRules
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
AutonomyProposalRule
)(
nil
),
"types.AutonomyProposalRule"
)
proto
.
RegisterType
((
*
ProposalRule
)(
nil
),
"types.ProposalRule"
)
proto
.
RegisterType
((
*
RevokeProposalRule
)(
nil
),
"types.RevokeProposalRule"
)
proto
.
RegisterType
((
*
TerminateProposalRule
)(
nil
),
"types.TerminateProposalRule"
)
proto
.
RegisterType
((
*
ReceiptProposalRule
)(
nil
),
"types.ReceiptProposalRule"
)
proto
.
RegisterType
((
*
LocalProposalRule
)(
nil
),
"types.LocalProposalRule"
)
proto
.
RegisterType
((
*
ReplyQueryProposalRule
)(
nil
),
"types.ReplyQueryProposalRule"
)
proto
.
RegisterType
((
*
ReplyProposalRule
)(
nil
),
"types.ReplyProposalRule"
)
}
func
init
()
{
proto
.
RegisterFile
(
"rule.proto"
,
fileDescriptor4
)
}
var
fileDescriptor4
=
[]
byte
{
// 479 bytes of a gzipped FileDescriptor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ff
,
0xff
,
0x32
,
0x78
,
0xa2
,
0x76
,
0x2a
,
0x04
,
0x00
,
0x00
,
}
plugin/dapp/autonomy/types/types.go
0 → 100644
View file @
af694733
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
import
(
"reflect"
log
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
)
var
name
string
var
tlog
=
log
.
New
(
"module"
,
name
)
func
init
()
{
name
=
AutonomyX
types
.
AllowUserExec
=
append
(
types
.
AllowUserExec
,
[]
byte
(
AutonomyX
))
// init executor type
types
.
RegistorExecutor
(
name
,
NewType
())
}
//getRealExecName
func
getRealExecName
(
paraName
string
)
string
{
return
types
.
ExecName
(
paraName
+
AutonomyX
)
}
// NewType 生成新的基础类型
func
NewType
()
*
AutonomyType
{
c
:=
&
AutonomyType
{}
c
.
SetChild
(
c
)
return
c
}
// AutonomyType 基础类型结构体
type
AutonomyType
struct
{
types
.
ExecTypeBase
}
// GetName 获取执行器名称
func
(
a
*
AutonomyType
)
GetName
()
string
{
return
AutonomyX
}
// GetLogMap 获得日志类型列表
func
(
a
*
AutonomyType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogPropBoard
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalBoard
{}),
Name
:
"LogPropBoard"
},
TyLogRvkPropBoard
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalBoard
{}),
Name
:
"LogRvkPropBoard"
},
TyLogVotePropBoard
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalBoard
{}),
Name
:
"LogVotePropBoard"
},
TyLogTmintPropBoard
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalBoard
{}),
Name
:
"LogTmintPropBoard"
},
TyLogPropProject
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalProject
{}),
Name
:
"LogPropProject"
},
TyLogRvkPropProject
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalProject
{}),
Name
:
"LogRvkPropProject"
},
TyLogVotePropProject
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalProject
{}),
Name
:
"LogVotePropProject"
},
TyLogTmintPropProject
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalProject
{}),
Name
:
"LogTmintPropProject"
},
TyLogPropRule
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalRule
{}),
Name
:
"LogPropRule"
},
TyLogRvkPropRule
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalRule
{}),
Name
:
"LogRvkPropRule"
},
TyLogVotePropRule
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalRule
{}),
Name
:
"LogVotePropRule"
},
TyLogTmintPropRule
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptProposalRule
{}),
Name
:
"LogTmintPropRule"
},
}
}
// GetPayload 获得空的Unfreeze 的 Payload
func
(
a
*
AutonomyType
)
GetPayload
()
types
.
Message
{
return
&
AutonomyAction
{}
}
// GetTypeMap 获得Action 方法列表
func
(
a
*
AutonomyType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"PropBoard"
:
AutonomyActionPropBoard
,
"RvkPropBoard"
:
AutonomyActionRvkPropBoard
,
"VotePropBoard"
:
AutonomyActionVotePropBoard
,
"TmintPropBoard"
:
AutonomyActionTmintPropBoard
,
"PropProject"
:
AutonomyActionPropProject
,
"RvkPropProject"
:
AutonomyActionRvkPropProject
,
"VotePropProject"
:
AutonomyActionVotePropProject
,
"TmintPropProject"
:
AutonomyActionTmintPropProject
,
"PropRule"
:
AutonomyActionPropRule
,
"RvkPropRule"
:
AutonomyActionRvkPropRule
,
"VotePropRule"
:
AutonomyActionVotePropRule
,
"TmintPropRule"
:
AutonomyActionTmintPropRule
,
}
}
\ No newline at end of file
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