Commit cf9a539d authored by vipwzw's avatar vipwzw Committed by 33cn

auto ci

parent 8c44c577
...@@ -10,11 +10,10 @@ import ( ...@@ -10,11 +10,10 @@ import (
jsonrpc "github.com/33cn/chain33/rpc/jsonclient" jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/spf13/cobra"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
) )
// AutonomyCmd 自治系统命令行 // AutonomyCmd 自治系统命令行
func AutonomyCmd() *cobra.Command { func AutonomyCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
...@@ -97,12 +96,12 @@ func proposalBoard(cmd *cobra.Command, args []string) { ...@@ -97,12 +96,12 @@ func proposalBoard(cmd *cobra.Command, args []string) {
boards := strings.Split(boardstr, "-") boards := strings.Split(boardstr, "-")
params := &auty.ProposalBoard{ params := &auty.ProposalBoard{
Year: year, Year: year,
Month: month, Month: month,
Day: day, Day: day,
Boards: boards, Boards: boards,
StartBlockHeight: startBlock, StartBlockHeight: startBlock,
EndBlockHeight: endBlock, EndBlockHeight: endBlock,
} }
var res string var res string
...@@ -131,7 +130,7 @@ func revokeProposalBoard(cmd *cobra.Command, args []string) { ...@@ -131,7 +130,7 @@ func revokeProposalBoard(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalBoard{ params := &auty.RevokeProposalBoard{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalBoardTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalBoardTx", params, &res)
...@@ -167,8 +166,8 @@ func voteProposalBoard(cmd *cobra.Command, args []string) { ...@@ -167,8 +166,8 @@ func voteProposalBoard(cmd *cobra.Command, args []string) {
} }
params := &auty.VoteProposalBoard{ params := &auty.VoteProposalBoard{
ProposalID: ID, ProposalID: ID,
Approve: isapp, Approve: isapp,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalBoardTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalBoardTx", params, &res)
...@@ -196,7 +195,7 @@ func terminateProposalBoard(cmd *cobra.Command, args []string) { ...@@ -196,7 +195,7 @@ func terminateProposalBoard(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalBoard{ params := &auty.RevokeProposalBoard{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalBoardTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalBoardTx", params, &res)
...@@ -228,7 +227,7 @@ func addShowProposalBoardflags(cmd *cobra.Command) { ...@@ -228,7 +227,7 @@ func addShowProposalBoardflags(cmd *cobra.Command) {
func showProposalBoard(cmd *cobra.Command, args []string) { func showProposalBoard(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type") typ, _ := cmd.Flags().GetUint32("type")
propID, _:= cmd.Flags().GetString("proposalID") propID, _ := cmd.Flags().GetString("proposalID")
status, _ := cmd.Flags().GetUint32("status") status, _ := cmd.Flags().GetUint32("status")
count, _ := cmd.Flags().GetInt32("count") count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction") direction, _ := cmd.Flags().GetInt32("direction")
...@@ -239,7 +238,7 @@ func showProposalBoard(cmd *cobra.Command, args []string) { ...@@ -239,7 +238,7 @@ func showProposalBoard(cmd *cobra.Command, args []string) {
params.Execer = auty.AutonomyX params.Execer = auty.AutonomyX
if 0 == typ { if 0 == typ {
req := types.ReqString{ req := types.ReqString{
Data: propID, Data: propID,
} }
params.FuncName = auty.GetProposalBoard params.FuncName = auty.GetProposalBoard
params.Payload = types.MustPBToJSON(&req) params.Payload = types.MustPBToJSON(&req)
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
package commands package commands
import ( import (
"github.com/spf13/cobra"
"github.com/33cn/chain33/types"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient" jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
) )
// ProposalProjectCmd 创建提案命令 // ProposalProjectCmd 创建提案命令
...@@ -70,20 +70,20 @@ func proposalProject(cmd *cobra.Command, args []string) { ...@@ -70,20 +70,20 @@ func proposalProject(cmd *cobra.Command, args []string) {
projectNeedBlockNum, _ := cmd.Flags().GetInt32("projectNeedBlockNum") projectNeedBlockNum, _ := cmd.Flags().GetInt32("projectNeedBlockNum")
params := &auty.ProposalProject{ params := &auty.ProposalProject{
Year: year, Year: year,
Month: month, Month: month,
Day: day, Day: day,
FirstStage: firstStage, FirstStage: firstStage,
LastStage: lastStage, LastStage: lastStage,
Production: production, Production: production,
Description: description, Description: description,
Contractor: contractor, Contractor: contractor,
Amount: amount*types.Coin, Amount: amount * types.Coin,
AmountDetail: amountDetail, AmountDetail: amountDetail,
ToAddr: toAddr, ToAddr: toAddr,
StartBlockHeight: startBlock, StartBlockHeight: startBlock,
EndBlockHeight: endBlock, EndBlockHeight: endBlock,
ProjectNeedBlockNum:projectNeedBlockNum, ProjectNeedBlockNum: projectNeedBlockNum,
} }
var res string var res string
...@@ -112,7 +112,7 @@ func revokeProposalProject(cmd *cobra.Command, args []string) { ...@@ -112,7 +112,7 @@ func revokeProposalProject(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalProject{ params := &auty.RevokeProposalProject{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalProjectTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalProjectTx", params, &res)
...@@ -148,8 +148,8 @@ func voteProposalProject(cmd *cobra.Command, args []string) { ...@@ -148,8 +148,8 @@ func voteProposalProject(cmd *cobra.Command, args []string) {
} }
params := &auty.VoteProposalProject{ params := &auty.VoteProposalProject{
ProposalID: ID, ProposalID: ID,
Approve: isapp, Approve: isapp,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalProjectTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalProjectTx", params, &res)
...@@ -186,15 +186,14 @@ func pubVoteProposalProject(cmd *cobra.Command, args []string) { ...@@ -186,15 +186,14 @@ func pubVoteProposalProject(cmd *cobra.Command, args []string) {
} }
params := &auty.PubVoteProposalProject{ params := &auty.PubVoteProposalProject{
ProposalID: ID, ProposalID: ID,
Oppose: isopp, Oppose: isopp,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.PubVoteProposalProjectTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.PubVoteProposalProjectTx", params, &res)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
// TerminateProposalProject 终止提案 // TerminateProposalProject 终止提案
func TerminateProposalProjectCmd() *cobra.Command { func TerminateProposalProjectCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
...@@ -216,7 +215,7 @@ func terminateProposalProject(cmd *cobra.Command, args []string) { ...@@ -216,7 +215,7 @@ func terminateProposalProject(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalProject{ params := &auty.RevokeProposalProject{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalProjectTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalProjectTx", params, &res)
...@@ -248,7 +247,7 @@ func addShowProposalProjectflags(cmd *cobra.Command) { ...@@ -248,7 +247,7 @@ func addShowProposalProjectflags(cmd *cobra.Command) {
func showProposalProject(cmd *cobra.Command, args []string) { func showProposalProject(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type") typ, _ := cmd.Flags().GetUint32("type")
propID, _:= cmd.Flags().GetString("proposalID") propID, _ := cmd.Flags().GetString("proposalID")
status, _ := cmd.Flags().GetUint32("status") status, _ := cmd.Flags().GetUint32("status")
count, _ := cmd.Flags().GetInt32("count") count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction") direction, _ := cmd.Flags().GetInt32("direction")
...@@ -259,7 +258,7 @@ func showProposalProject(cmd *cobra.Command, args []string) { ...@@ -259,7 +258,7 @@ func showProposalProject(cmd *cobra.Command, args []string) {
params.Execer = auty.AutonomyX params.Execer = auty.AutonomyX
if 0 == typ { if 0 == typ {
req := types.ReqString{ req := types.ReqString{
Data: propID, Data: propID,
} }
params.FuncName = auty.GetProposalProject params.FuncName = auty.GetProposalProject
params.Payload = types.MustPBToJSON(&req) params.Payload = types.MustPBToJSON(&req)
...@@ -278,4 +277,4 @@ func showProposalProject(cmd *cobra.Command, args []string) { ...@@ -278,4 +277,4 @@ func showProposalProject(cmd *cobra.Command, args []string) {
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, rep) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, rep)
ctx.Run() ctx.Run()
} }
\ No newline at end of file
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
jsonrpc "github.com/33cn/chain33/rpc/jsonclient" jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/spf13/cobra"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/spf13/cobra"
) )
// ProposalRuleCmd 创建提案命令 // ProposalRuleCmd 创建提案命令
...@@ -61,17 +61,17 @@ func proposalRule(cmd *cobra.Command, args []string) { ...@@ -61,17 +61,17 @@ func proposalRule(cmd *cobra.Command, args []string) {
params := &auty.ProposalRule{ params := &auty.ProposalRule{
Year: year, Year: year,
Month: month, Month: month,
Day: day, Day: day,
RuleCfg: &auty.RuleConfig{ RuleCfg: &auty.RuleConfig{
BoardAttendRatio: boardAttendRatio, BoardAttendRatio: boardAttendRatio,
BoardApproveRatio: boardApproveRatio, BoardApproveRatio: boardApproveRatio,
PubOpposeRatio: pubOpposeRatio, PubOpposeRatio: pubOpposeRatio,
ProposalAmount: proposalAmount * types.Coin, ProposalAmount: proposalAmount * types.Coin,
LargeProjectAmount: largeProjectAmount * types.Coin, LargeProjectAmount: largeProjectAmount * types.Coin,
PublicPeriod: publicPeriod, PublicPeriod: publicPeriod,
}, },
StartBlockHeight: startBlock, StartBlockHeight: startBlock,
EndBlockHeight: endBlock, EndBlockHeight: endBlock,
} }
var res string var res string
...@@ -100,7 +100,7 @@ func revokeProposalRule(cmd *cobra.Command, args []string) { ...@@ -100,7 +100,7 @@ func revokeProposalRule(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalRule{ params := &auty.RevokeProposalRule{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalRuleTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalRuleTx", params, &res)
...@@ -136,8 +136,8 @@ func voteProposalRule(cmd *cobra.Command, args []string) { ...@@ -136,8 +136,8 @@ func voteProposalRule(cmd *cobra.Command, args []string) {
} }
params := &auty.VoteProposalRule{ params := &auty.VoteProposalRule{
ProposalID: ID, ProposalID: ID,
Approve: isapp, Approve: isapp,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalRuleTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalRuleTx", params, &res)
...@@ -165,7 +165,7 @@ func terminateProposalRule(cmd *cobra.Command, args []string) { ...@@ -165,7 +165,7 @@ func terminateProposalRule(cmd *cobra.Command, args []string) {
ID, _ := cmd.Flags().GetString("proposalID") ID, _ := cmd.Flags().GetString("proposalID")
params := &auty.RevokeProposalRule{ params := &auty.RevokeProposalRule{
ProposalID: ID, ProposalID: ID,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalRuleTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalRuleTx", params, &res)
...@@ -197,7 +197,7 @@ func addShowProposalRuleflags(cmd *cobra.Command) { ...@@ -197,7 +197,7 @@ func addShowProposalRuleflags(cmd *cobra.Command) {
func showProposalRule(cmd *cobra.Command, args []string) { func showProposalRule(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type") typ, _ := cmd.Flags().GetUint32("type")
propID, _:= cmd.Flags().GetString("proposalID") propID, _ := cmd.Flags().GetString("proposalID")
status, _ := cmd.Flags().GetUint32("status") status, _ := cmd.Flags().GetUint32("status")
count, _ := cmd.Flags().GetInt32("count") count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction") direction, _ := cmd.Flags().GetInt32("direction")
...@@ -208,7 +208,7 @@ func showProposalRule(cmd *cobra.Command, args []string) { ...@@ -208,7 +208,7 @@ func showProposalRule(cmd *cobra.Command, args []string) {
params.Execer = auty.AutonomyX params.Execer = auty.AutonomyX
if 0 == typ { if 0 == typ {
req := types.ReqString{ req := types.ReqString{
Data: propID, Data: propID,
} }
params.FuncName = auty.GetProposalRule params.FuncName = auty.GetProposalRule
params.Payload = types.MustPBToJSON(&req) params.Payload = types.MustPBToJSON(&req)
...@@ -248,11 +248,11 @@ func addTransferFundflags(cmd *cobra.Command) { ...@@ -248,11 +248,11 @@ func addTransferFundflags(cmd *cobra.Command) {
func transferFund(cmd *cobra.Command, args []string) { func transferFund(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
amount, _ := cmd.Flags().GetInt64("amount") amount, _ := cmd.Flags().GetInt64("amount")
note, _:= cmd.Flags().GetString("note") note, _ := cmd.Flags().GetString("note")
params := &auty.TransferFund{ params := &auty.TransferFund{
Amount: amount*types.Coin, Amount: amount * types.Coin,
Note: note, Note: note,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TransferFundTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TransferFundTx", params, &res)
...@@ -280,14 +280,14 @@ func addCommentProposalflags(cmd *cobra.Command) { ...@@ -280,14 +280,14 @@ func addCommentProposalflags(cmd *cobra.Command) {
func commentProposal(cmd *cobra.Command, args []string) { func commentProposal(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
proposalID, _:= cmd.Flags().GetString("proposalID") proposalID, _ := cmd.Flags().GetString("proposalID")
repCmtHash, _:= cmd.Flags().GetString("repCmtHash") repCmtHash, _ := cmd.Flags().GetString("repCmtHash")
comment, _:= cmd.Flags().GetString("comment") comment, _ := cmd.Flags().GetString("comment")
params := &auty.Comment{ params := &auty.Comment{
ProposalID:proposalID, ProposalID: proposalID,
RepCmtHash:repCmtHash, RepCmtHash: repCmtHash,
Comment:comment, Comment: comment,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.CommentProposalTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.CommentProposalTx", params, &res)
...@@ -315,7 +315,7 @@ func addShowProposalCommentflags(cmd *cobra.Command) { ...@@ -315,7 +315,7 @@ func addShowProposalCommentflags(cmd *cobra.Command) {
func showProposalComment(cmd *cobra.Command, args []string) { func showProposalComment(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
propID, _:= cmd.Flags().GetString("proposalID") propID, _ := cmd.Flags().GetString("proposalID")
count, _ := cmd.Flags().GetInt32("count") count, _ := cmd.Flags().GetInt32("count")
direction, _ := cmd.Flags().GetInt32("direction") direction, _ := cmd.Flags().GetInt32("direction")
index, _ := cmd.Flags().GetInt64("index") index, _ := cmd.Flags().GetInt64("index")
...@@ -325,10 +325,10 @@ func showProposalComment(cmd *cobra.Command, args []string) { ...@@ -325,10 +325,10 @@ func showProposalComment(cmd *cobra.Command, args []string) {
params.Execer = auty.AutonomyX params.Execer = auty.AutonomyX
req := auty.ReqQueryProposalComment{ req := auty.ReqQueryProposalComment{
ProposalID: propID, ProposalID: propID,
Count: count, Count: count,
Direction: direction, Direction: direction,
Index: index, Index: index,
} }
params.FuncName = auty.ListProposalComment params.FuncName = auty.ListProposalComment
params.Payload = types.MustPBToJSON(&req) params.Payload = types.MustPBToJSON(&req)
......
...@@ -5,21 +5,20 @@ ...@@ -5,21 +5,20 @@
package executor package executor
import ( import (
"github.com/33cn/chain33/common/address"
log "github.com/33cn/chain33/common/log/log15" log "github.com/33cn/chain33/common/log/log15"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/33cn/chain33/common/address"
) )
var ( var (
alog = log.New("module", "execs.autonomy") alog = log.New("module", "execs.autonomy")
driverName = auty.AutonomyX driverName = auty.AutonomyX
autonomyAddr = address.ExecAddress(auty.AutonomyX) autonomyAddr = address.ExecAddress(auty.AutonomyX)
autonomyFundAddr = address.ExecAddress("autonomyfund") autonomyFundAddr = address.ExecAddress("autonomyfund")
) )
func init() { func init() {
ety := types.LoadExecutorType(driverName) ety := types.LoadExecutorType(driverName)
ety.InitFuncList(types.ListMethod(&Autonomy{})) ety.InitFuncList(types.ListMethod(&Autonomy{}))
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
package executor package executor
import ( import (
"fmt"
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"fmt"
) )
func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalDBSet, error) { func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalDBSet, error) {
...@@ -112,7 +113,7 @@ func (a *Autonomy) getProposalBoard(req *types.ReqString) (types.Message, error) ...@@ -112,7 +113,7 @@ func (a *Autonomy) getProposalBoard(req *types.ReqString) (types.Message, error)
return rep, nil return rep, nil
} }
func(a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Message, error) { func (a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Message, error) {
if req == nil { if req == nil {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
...@@ -125,7 +126,7 @@ func(a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mess ...@@ -125,7 +126,7 @@ func(a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mess
key = nil key = nil
} else { //翻页查找指定的txhash列表 } else { //翻页查找指定的txhash列表
heightstr := genHeightIndexStr(req.GetIndex()) heightstr := genHeightIndexStr(req.GetIndex())
key = calcBoardKey4StatusHeight(req.Status, heightstr) key = calcBoardKey4StatusHeight(req.Status, heightstr)
} }
prefix := calcBoardKey4StatusHeight(req.Status, "") prefix := calcBoardKey4StatusHeight(req.Status, "")
values, err = localDb.List(prefix, key, req.Count, req.GetDirection()) values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
...@@ -150,4 +151,4 @@ func(a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mess ...@@ -150,4 +151,4 @@ func(a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mess
func genHeightIndexStr(index int64) string { func genHeightIndexStr(index int64) string {
return fmt.Sprintf("%018d", index) return fmt.Sprintf("%018d", index)
} }
\ No newline at end of file
...@@ -6,32 +6,33 @@ package executor ...@@ -6,32 +6,33 @@ package executor
import ( import (
"testing" "testing"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/util"
) )
func TestExecLocalBoard(t *testing.T) { func TestExecLocalBoard(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropBoard //TyLogPropBoard
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{}, PropBoard: &auty.ProposalBoard{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptBoard := &auty.ReceiptProposalBoard{ receiptBoard := &auty.ReceiptProposalBoard{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropBoard, Log:types.Encode(receiptBoard)}, {Ty: auty.TyLogPropBoard, Log: types.Encode(receiptBoard)},
}, },
} }
set, err := au.execLocalBoard(receipt) set, err := au.execLocalBoard(receipt)
...@@ -46,12 +47,12 @@ func TestExecLocalBoard(t *testing.T) { ...@@ -46,12 +47,12 @@ func TestExecLocalBoard(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptBoard1 := &auty.ReceiptProposalBoard{ receiptBoard1 := &auty.ReceiptProposalBoard{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execLocalBoard(&types.ReceiptData{ set, err = au.execLocalBoard(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogRvkPropBoard, Log:types.Encode(receiptBoard1)}, {Ty: auty.TyLogRvkPropBoard, Log: types.Encode(receiptBoard1)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -71,12 +72,12 @@ func TestExecLocalBoard(t *testing.T) { ...@@ -71,12 +72,12 @@ func TestExecLocalBoard(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptBoard2 := &auty.ReceiptProposalBoard{ receiptBoard2 := &auty.ReceiptProposalBoard{
Prev: pre2, Prev: pre2,
Current: cur, Current: cur,
} }
set, err = au.execLocalBoard(&types.ReceiptData{ set, err = au.execLocalBoard(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropBoard, Log:types.Encode(receiptBoard2)}, {Ty: auty.TyLogVotePropBoard, Log: types.Encode(receiptBoard2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -92,21 +93,21 @@ func TestExecDelLocalBoard(t *testing.T) { ...@@ -92,21 +93,21 @@ func TestExecDelLocalBoard(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropBoard //TyLogPropBoard
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{}, PropBoard: &auty.ProposalBoard{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptBoard := &auty.ReceiptProposalBoard{ receiptBoard := &auty.ReceiptProposalBoard{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropBoard, Log:types.Encode(receiptBoard)}, {Ty: auty.TyLogPropBoard, Log: types.Encode(receiptBoard)},
}, },
} }
set, err := au.execDelLocalBoard(receipt) set, err := au.execDelLocalBoard(receipt)
...@@ -122,12 +123,12 @@ func TestExecDelLocalBoard(t *testing.T) { ...@@ -122,12 +123,12 @@ func TestExecDelLocalBoard(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptBoard2 := &auty.ReceiptProposalBoard{ receiptBoard2 := &auty.ReceiptProposalBoard{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execDelLocalBoard(&types.ReceiptData{ set, err = au.execDelLocalBoard(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropBoard, Log:types.Encode(receiptBoard2)}, {Ty: auty.TyLogVotePropBoard, Log: types.Encode(receiptBoard2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -148,7 +149,7 @@ func TestGetProposalBoard(t *testing.T) { ...@@ -148,7 +149,7 @@ func TestGetProposalBoard(t *testing.T) {
au.SetStateDB(storedb) au.SetStateDB(storedb)
tx := "1111111111111111111" tx := "1111111111111111111"
storedb.Set(propBoardID(tx), types.Encode(&auty.AutonomyProposalBoard{})) storedb.Set(propBoardID(tx), types.Encode(&auty.AutonomyProposalBoard{}))
rsp, err := au.getProposalBoard(&types.ReqString{Data:tx}) rsp, err := au.getProposalBoard(&types.ReqString{Data: tx})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, rsp) require.NotNil(t, rsp)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 1) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 1)
...@@ -181,13 +182,13 @@ func TestListProposalBoard(t *testing.T) { ...@@ -181,13 +182,13 @@ func TestListProposalBoard(t *testing.T) {
testcase = append(testcase, testcase1...) testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...) testcase = append(testcase, testcase2...)
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{}, PropBoard: &auty.ProposalBoard{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
for _, tcase := range testcase { for _, tcase := range testcase {
key := calcBoardKey4StatusHeight(tcase.status, key := calcBoardKey4StatusHeight(tcase.status,
...@@ -201,10 +202,10 @@ func TestListProposalBoard(t *testing.T) { ...@@ -201,10 +202,10 @@ func TestListProposalBoard(t *testing.T) {
// 反向查找 // 反向查找
req := &auty.ReqQueryProposalBoard{ req := &auty.ReqQueryProposalBoard{
Status:auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err := au.listProposalBoard(req) rsp, err := au.listProposalBoard(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -218,10 +219,10 @@ func TestListProposalBoard(t *testing.T) { ...@@ -218,10 +219,10 @@ func TestListProposalBoard(t *testing.T) {
// 正向查找 // 正向查找
req = &auty.ReqQueryProposalBoard{ req = &auty.ReqQueryProposalBoard{
Status:auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Count:10, Count: 10,
Direction:1, Direction: 1,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalBoard(req) rsp, err = au.listProposalBoard(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -233,10 +234,10 @@ func TestListProposalBoard(t *testing.T) { ...@@ -233,10 +234,10 @@ func TestListProposalBoard(t *testing.T) {
// 翻页查找 // 翻页查找
req = &auty.ReqQueryProposalBoard{ req = &auty.ReqQueryProposalBoard{
Status:auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Count:1, Count: 1,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalBoard(req) rsp, err = au.listProposalBoard(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -248,10 +249,10 @@ func TestListProposalBoard(t *testing.T) { ...@@ -248,10 +249,10 @@ func TestListProposalBoard(t *testing.T) {
// //
Index := height*types.MaxTxsPerBlock + int64(index) Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalBoard{ req = &auty.ReqQueryProposalBoard{
Status:auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: Index, Index: Index,
} }
rsp, err = au.listProposalBoard(req) rsp, err = au.listProposalBoard(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 2) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 2)
...@@ -259,4 +260,4 @@ func TestListProposalBoard(t *testing.T) { ...@@ -259,4 +260,4 @@ func TestListProposalBoard(t *testing.T) {
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Index, int32(testcase2[1].index)) require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Height, testcase2[0].height) require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Index, int32(testcase2[0].index)) require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Index, int32(testcase2[0].index))
} }
\ No newline at end of file
...@@ -6,28 +6,28 @@ package executor ...@@ -6,28 +6,28 @@ package executor
import ( import (
"github.com/33cn/chain33/account" "github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/chain33/client"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
) )
const ( const (
minBoards = 3 minBoards = 3
maxBoards = 30 maxBoards = 30
publicPeriod int32 = 120960 // 公示一周时间,以区块高度计算 publicPeriod int32 = 120960 // 公示一周时间,以区块高度计算
ticketPrice = types.Coin * 3000 // 单张票价 ticketPrice = types.Coin * 3000 // 单张票价
largeProjectAmount = types.Coin * 100 *10000 // 重大项目公示金额阈值 largeProjectAmount = types.Coin * 100 * 10000 // 重大项目公示金额阈值
proposalAmount = types.Coin * 1000 // 创建者消耗金额 proposalAmount = types.Coin * 1000 // 创建者消耗金额
boardAttendRatio int32 = 66 // 董事会成员参与率,以%计,可修改 boardAttendRatio int32 = 66 // 董事会成员参与率,以%计,可修改
boardApproveRatio int32 = 66 // 董事会成员赞成率,以%计,可修改 boardApproveRatio int32 = 66 // 董事会成员赞成率,以%计,可修改
pubAttendRatio int32 = 50 // 全体持票人参与率,以%计 pubAttendRatio int32 = 50 // 全体持票人参与率,以%计
pubApproveRatio int32 = 50 // 全体持票人赞成率,以%计 pubApproveRatio int32 = 50 // 全体持票人赞成率,以%计
pubOpposeRatio int32 = 33 // 全体持票人否决率,以%计 pubOpposeRatio int32 = 33 // 全体持票人否决率,以%计
) )
type action struct { type action struct {
...@@ -52,19 +52,19 @@ func newAction(a *Autonomy, tx *types.Transaction, index int32) *action { ...@@ -52,19 +52,19 @@ func newAction(a *Autonomy, tx *types.Transaction, index int32) *action {
func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) { func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
if len(prob.Boards) > maxBoards || len(prob.Boards) < minBoards { if len(prob.Boards) > maxBoards || len(prob.Boards) < minBoards {
alog.Error("propBoard ", "proposal boards number is invaild", len(prob.Boards)) alog.Error("propBoard ", "proposal boards number is invaild", len(prob.Boards))
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height { if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height {
alog.Error("propBoard height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight", alog.Error("propBoard height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight",
prob.EndBlockHeight, "height", a.height) prob.EndBlockHeight, "height", a.height)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
for _, board := range prob.Boards { for _, board := range prob.Boards {
if err := address.CheckAddress(board); err != nil { if err := address.CheckAddress(board); err != nil {
alog.Error("propBoard ", "addr", board, "check toAddr error", err) alog.Error("propBoard ", "addr", board, "check toAddr error", err)
return nil, types.ErrInvalidAddress return nil, types.ErrInvalidAddress
} }
} }
...@@ -88,13 +88,13 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) { ...@@ -88,13 +88,13 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard:prob, PropBoard: prob,
CurRule:rule, CurRule: rule,
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalBoard, Status: auty.AutonomyStatusProposalBoard,
Address: a.fromaddr, Address: a.fromaddr,
Height: a.height, Height: a.height,
Index: a.index, Index: a.index,
} }
kv = append(kv, &types.KeyValue{Key: propBoardID(common.ToHex(a.txhash)), Value: types.Encode(cur)}) kv = append(kv, &types.KeyValue{Key: propBoardID(common.ToHex(a.txhash)), Value: types.Encode(cur)})
...@@ -197,12 +197,12 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -197,12 +197,12 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
votes.Address = append(votes.Address, a.fromaddr) votes.Address = append(votes.Address, a.fromaddr)
if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数 if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数
addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp" addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account, err := a.getStartHeightVoteAccount(addr, start) account, err := a.getStartHeightVoteAccount(addr, start)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice) cur.VoteResult.TotalVotes = int32(account.Balance / ticketPrice)
} }
account, err := a.getStartHeightVoteAccount(a.fromaddr, start) account, err := a.getStartHeightVoteAccount(a.fromaddr, start)
...@@ -210,9 +210,9 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -210,9 +210,9 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
return nil, err return nil, err
} }
if voteProb.Approve { if voteProb.Approve {
cur.VoteResult.ApproveVotes += int32(account.Balance/ticketPrice) cur.VoteResult.ApproveVotes += int32(account.Balance / ticketPrice)
} else { } else {
cur.VoteResult.OpposeVotes += int32(account.Balance/ticketPrice) cur.VoteResult.OpposeVotes += int32(account.Balance / ticketPrice)
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
...@@ -230,9 +230,9 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -230,9 +230,9 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
} }
if cur.VoteResult.TotalVotes != 0 && if cur.VoteResult.TotalVotes != 0 &&
cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes != 0 && cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 &&
float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 && float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 { float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true cur.VoteResult.Pass = true
cur.PropBoard.RealEndBlockHeight = a.height cur.PropBoard.RealEndBlockHeight = a.height
} }
...@@ -249,7 +249,7 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt ...@@ -249,7 +249,7 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
// 更新当前具有权利的董事会成员 // 更新当前具有权利的董事会成员
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value:types.Encode(cur.PropBoard)}) kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.PropBoard)})
} }
ty := auty.TyLogVotePropBoard ty := auty.TyLogVotePropBoard
...@@ -295,11 +295,11 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types. ...@@ -295,11 +295,11 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice) cur.VoteResult.TotalVotes = int32(account.Balance / ticketPrice)
} }
if float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 && if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 { float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true cur.VoteResult.Pass = true
} else { } else {
cur.VoteResult.Pass = false cur.VoteResult.Pass = false
...@@ -326,7 +326,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types. ...@@ -326,7 +326,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
// 更新当前具有权利的董事会成员 // 更新当前具有权利的董事会成员
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value:types.Encode(cur.PropBoard)}) kv = append(kv, &types.KeyValue{Key: activeBoardID(), Value: types.Encode(cur.PropBoard)})
} }
receiptLog := getReceiptLog(pre, cur, auty.TyLogTmintPropBoard) receiptLog := getReceiptLog(pre, cur, auty.TyLogTmintPropBoard)
...@@ -338,7 +338,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types. ...@@ -338,7 +338,7 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
func (a *action) getStartHeightVoteAccount(addr string, height int64) (*types.Account, error) { func (a *action) getStartHeightVoteAccount(addr string, height int64) (*types.Account, error) {
param := &types.ReqBlocks{ param := &types.ReqBlocks{
Start: height, Start: height,
End:height, End: height,
} }
head, err := a.api.GetHeaders(param) head, err := a.api.GetHeaders(param)
if err != nil || len(head.Items) == 0 { if err != nil || len(head.Items) == 0 {
...@@ -381,13 +381,13 @@ func (a *action) getActiveRule() (*auty.RuleConfig, error) { ...@@ -381,13 +381,13 @@ func (a *action) getActiveRule() (*auty.RuleConfig, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
} else {// 载入系统默认值 } else { // 载入系统默认值
rule.BoardAttendRatio = boardAttendRatio rule.BoardAttendRatio = boardAttendRatio
rule.BoardApproveRatio = boardApproveRatio rule.BoardApproveRatio = boardApproveRatio
rule.PubOpposeRatio = pubOpposeRatio rule.PubOpposeRatio = pubOpposeRatio
rule.ProposalAmount = proposalAmount rule.ProposalAmount = proposalAmount
rule.LargeProjectAmount = largeProjectAmount rule.LargeProjectAmount = largeProjectAmount
rule.PublicPeriod = publicPeriod rule.PublicPeriod = publicPeriod
} }
return rule, nil return rule, nil
} }
...@@ -440,4 +440,3 @@ func copyAutonomyProposalBoard(cur *auty.AutonomyProposalBoard) *auty.AutonomyPr ...@@ -440,4 +440,3 @@ func copyAutonomyProposalBoard(cur *auty.AutonomyProposalBoard) *auty.AutonomyPr
} }
return &newAut return &newAut
} }
...@@ -7,21 +7,21 @@ package executor ...@@ -7,21 +7,21 @@ package executor
import ( import (
"testing" "testing"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" "github.com/33cn/chain33/account"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/types"
apimock "github.com/33cn/chain33/client/mocks" apimock "github.com/33cn/chain33/client/mocks"
dbmock "github.com/33cn/chain33/common/db/mocks"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
commonlog "github.com/33cn/chain33/common/log" "github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/account" dbmock "github.com/33cn/chain33/common/db/mocks"
commonlog "github.com/33cn/chain33/common/log"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/stretchr/testify/mock"
"github.com/33cn/chain33/common/address"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util" "github.com/33cn/chain33/util"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
) )
type execEnv struct { type execEnv struct {
...@@ -45,7 +45,7 @@ var ( ...@@ -45,7 +45,7 @@ var (
AddrD = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs" AddrD = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
boards = []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4", "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR", "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"} boards = []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4", "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR", "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"}
total = types.Coin * 30000 total = types.Coin * 30000
) )
func init() { func init() {
...@@ -78,17 +78,16 @@ func InitEnv() (*execEnv, drivers.Driver, dbm.KV, dbm.KVDB) { ...@@ -78,17 +78,16 @@ func InitEnv() (*execEnv, drivers.Driver, dbm.KV, dbm.KVDB) {
} }
env := &execEnv{ env := &execEnv{
blockTime: 1539918074, blockTime: 1539918074,
blockHeight: 10, blockHeight: 10,
index: 2, index: 2,
difficulty: 1539918074, difficulty: 1539918074,
txHash: "", txHash: "",
} }
stateDB, _ := dbm.NewGoMemDB("state", "state", 100) stateDB, _ := dbm.NewGoMemDB("state", "state", 100)
_, _, kvdb := util.CreateTestDB() _, _, kvdb := util.CreateTestDB()
accCoin := account.NewCoinsAccount() accCoin := account.NewCoinsAccount()
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
accCoin.SaveAccount(&accountA) accCoin.SaveAccount(&accountA)
...@@ -97,9 +96,9 @@ func InitEnv() (*execEnv, drivers.Driver, dbm.KV, dbm.KVDB) { ...@@ -97,9 +96,9 @@ func InitEnv() (*execEnv, drivers.Driver, dbm.KV, dbm.KVDB) {
accCoin.SaveAccount(&accountC) accCoin.SaveAccount(&accountC)
accCoin.SaveAccount(&accountD) accCoin.SaveAccount(&accountD)
//total ticket balance //total ticket balance
accCoin.SaveAccount(&types.Account{Balance: total*4, accCoin.SaveAccount(&types.Account{Balance: total * 4,
Frozen: 0, Frozen: 0,
Addr: "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"}) Addr: "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"})
exec := newAutonomy() exec := newAutonomy()
exec.SetStateDB(stateDB) exec.SetStateDB(stateDB)
...@@ -133,13 +132,13 @@ func TestTerminateProposalBoard(t *testing.T) { ...@@ -133,13 +132,13 @@ func TestTerminateProposalBoard(t *testing.T) {
} }
func testPropBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func testPropBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
opt1 := &auty.ProposalBoard{ opt1 := &auty.ProposalBoard{
Year: 2019, Year: 2019,
Month: 7, Month: 7,
Day: 10, Day: 10,
Boards: boards, Boards: boards,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + 10, EndBlockHeight: env.blockHeight + 10,
} }
pbtx, err := propBoardTx(opt1) pbtx, err := propBoardTx(opt1)
require.NoError(t, err) require.NoError(t, err)
...@@ -197,8 +196,8 @@ func propBoardTx(parm *auty.ProposalBoard) (*types.Transaction, error) { ...@@ -197,8 +196,8 @@ func propBoardTx(parm *auty.ProposalBoard) (*types.Transaction, error) {
func revokeProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func revokeProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
proposalID := env.txHash proposalID := env.txHash
opt2 := &auty.RevokeProposalBoard{ opt2 := &auty.RevokeProposalBoard{
ProposalID:proposalID, ProposalID: proposalID,
} }
rtx, err := revokeProposalBoardTx(opt2) rtx, err := revokeProposalBoardTx(opt2)
require.NoError(t, err) require.NoError(t, err)
...@@ -252,22 +251,22 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB ...@@ -252,22 +251,22 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
acc = &types.Account{ acc = &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val1 := types.Encode(acc) val1 := types.Encode(acc)
values1 := [][]byte{val1} values1 := [][]byte{val1}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values1}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values1}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
...@@ -284,9 +283,9 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB ...@@ -284,9 +283,9 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB
} }
for _, record := range records { for _, record := range records {
opt := &auty.VoteProposalBoard{ opt := &auty.VoteProposalBoard{
ProposalID:proposalID, ProposalID: proposalID,
Approve: record.appr, Approve: record.appr,
} }
tx, err := voteProposalBoardTx(opt) tx, err := voteProposalBoardTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -320,11 +319,11 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB ...@@ -320,11 +319,11 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB
// 每次需要重新设置 // 每次需要重新设置
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
} }
// check // check
...@@ -364,19 +363,19 @@ func terminateProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, sta ...@@ -364,19 +363,19 @@ func terminateProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, sta
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
opt := &auty.TerminateProposalBoard{ opt := &auty.TerminateProposalBoard{
ProposalID:proposalID, ProposalID: proposalID,
} }
tx, err := terminateProposalBoardTx(opt) tx, err := terminateProposalBoardTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -437,15 +436,15 @@ func TestGetStartHeightVoteAccount(t *testing.T) { ...@@ -437,15 +436,15 @@ func TestGetStartHeightVoteAccount(t *testing.T) {
api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil) api.On("GetLastHeader", mock.Anything).Return(&types.Header{StateHash: []byte("")}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: types.Coin, Balance: types.Coin,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil) api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil)
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
account, err := action.getStartHeightVoteAccount(addr, 0) account, err := action.getStartHeightVoteAccount(addr, 0)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, account) require.NotNil(t, account)
...@@ -454,16 +453,16 @@ func TestGetStartHeightVoteAccount(t *testing.T) { ...@@ -454,16 +453,16 @@ func TestGetStartHeightVoteAccount(t *testing.T) {
func TestGetReceiptLog(t *testing.T) { func TestGetReceiptLog(t *testing.T) {
pre := &auty.AutonomyProposalBoard{ pre := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1800, Month: 1}, PropBoard: &auty.ProposalBoard{Year: 1800, Month: 1},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 1, Status: 1,
Address:"121", Address: "121",
} }
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1}, PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
log := getReceiptLog(pre, cur, 2) log := getReceiptLog(pre, cur, 2)
require.Equal(t, int32(2), log.Ty) require.Equal(t, int32(2), log.Ty)
...@@ -477,11 +476,11 @@ func TestGetReceiptLog(t *testing.T) { ...@@ -477,11 +476,11 @@ func TestGetReceiptLog(t *testing.T) {
func TestCopyAutonomyProposalBoard(t *testing.T) { func TestCopyAutonomyProposalBoard(t *testing.T) {
require.Nil(t, copyAutonomyProposalBoard(nil)) require.Nil(t, copyAutonomyProposalBoard(nil))
cur := &auty.AutonomyProposalBoard{ cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1}, PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1},
CurRule: &auty.RuleConfig{BoardAttendRatio: 100}, CurRule: &auty.RuleConfig{BoardAttendRatio: 100},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
pre := copyAutonomyProposalBoard(cur) pre := copyAutonomyProposalBoard(cur)
cur.PropBoard.Year = 1800 cur.PropBoard.Year = 1800
...@@ -518,4 +517,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error ...@@ -518,4 +517,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error
tx.Sign(int32(signType), privKey) tx.Sign(int32(signType), privKey)
return tx, nil return tx, nil
} }
\ No newline at end of file
...@@ -100,4 +100,4 @@ func (a *Autonomy) Exec_Transfer(payload *auty.TransferFund, tx *types.Transacti ...@@ -100,4 +100,4 @@ func (a *Autonomy) Exec_Transfer(payload *auty.TransferFund, tx *types.Transacti
func (a *Autonomy) Exec_CommentProp(payload *auty.Comment, tx *types.Transaction, index int) (*types.Receipt, error) { func (a *Autonomy) Exec_CommentProp(payload *auty.Comment, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index)) action := newAction(a, tx, int32(index))
return action.commentProp(payload) return action.commentProp(payload)
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ func (a *Autonomy) ExecDelLocal_PropBoard(payload *auty.ProposalBoard, tx *types ...@@ -16,7 +16,7 @@ func (a *Autonomy) ExecDelLocal_PropBoard(payload *auty.ProposalBoard, tx *types
} }
// ExecDelLocal_RvkPropBoard 撤销提案 // ExecDelLocal_RvkPropBoard 撤销提案
func (a *Autonomy) ExecDelLocal_RvkPropBoard(payload *auty.RevokeProposalBoard, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecDelLocal_RvkPropBoard(payload *auty.RevokeProposalBoard, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execDelLocalBoard(receiptData) return a.execDelLocalBoard(receiptData)
} }
...@@ -37,7 +37,7 @@ func (a *Autonomy) ExecDelLocal_PropProject(payload *auty.ProposalProject, tx *t ...@@ -37,7 +37,7 @@ func (a *Autonomy) ExecDelLocal_PropProject(payload *auty.ProposalProject, tx *t
} }
// ExecDelLocal_RvkPropProject 撤销提案 // ExecDelLocal_RvkPropProject 撤销提案
func (a *Autonomy) ExecDelLocal_RvkPropProject(payload *auty.RevokeProposalProject, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecDelLocal_RvkPropProject(payload *auty.RevokeProposalProject, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execDelLocalProject(receiptData) return a.execDelLocalProject(receiptData)
} }
...@@ -63,7 +63,7 @@ func (a *Autonomy) ExecDelLocal_PropRule(payload *auty.ProposalRule, tx *types.T ...@@ -63,7 +63,7 @@ func (a *Autonomy) ExecDelLocal_PropRule(payload *auty.ProposalRule, tx *types.T
} }
// ExecDelLocal_RvkPropRule 撤销提案规则 // ExecDelLocal_RvkPropRule 撤销提案规则
func (a *Autonomy) ExecDelLocal_RvkPropRule(payload *auty.RevokeProposalRule, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecDelLocal_RvkPropRule(payload *auty.RevokeProposalRule, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execDelLocalRule(receiptData) return a.execDelLocalRule(receiptData)
} }
...@@ -80,4 +80,4 @@ func (a *Autonomy) ExecDelLocal_TmintPropRule(payload *auty.TerminateProposalRul ...@@ -80,4 +80,4 @@ func (a *Autonomy) ExecDelLocal_TmintPropRule(payload *auty.TerminateProposalRul
// ExecDelLocal_TmintPropRule 终止提案规则 // ExecDelLocal_TmintPropRule 终止提案规则
func (a *Autonomy) ExecDelLocal_CommentProp(payload *auty.Comment, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (a *Autonomy) ExecDelLocal_CommentProp(payload *auty.Comment, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execDelLocalCommentProp(receiptData) return a.execDelLocalCommentProp(receiptData)
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ func (a *Autonomy) ExecLocal_PropBoard(payload *auty.ProposalBoard, tx *types.Tr ...@@ -16,7 +16,7 @@ func (a *Autonomy) ExecLocal_PropBoard(payload *auty.ProposalBoard, tx *types.Tr
} }
// ExecLocal_RvkPropBoard 撤销提案 // ExecLocal_RvkPropBoard 撤销提案
func (a *Autonomy) ExecLocal_RvkPropBoard(payload *auty.RevokeProposalBoard, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecLocal_RvkPropBoard(payload *auty.RevokeProposalBoard, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execLocalBoard(receiptData) return a.execLocalBoard(receiptData)
} }
...@@ -37,7 +37,7 @@ func (a *Autonomy) ExecLocal_PropProject(payload *auty.ProposalProject, tx *type ...@@ -37,7 +37,7 @@ func (a *Autonomy) ExecLocal_PropProject(payload *auty.ProposalProject, tx *type
} }
// ExecLocal_RvkPropProject 撤销提案项目 // ExecLocal_RvkPropProject 撤销提案项目
func (a *Autonomy) ExecLocal_RvkPropProject(payload *auty.RevokeProposalProject, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecLocal_RvkPropProject(payload *auty.RevokeProposalProject, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execLocalProject(receiptData) return a.execLocalProject(receiptData)
} }
...@@ -63,7 +63,7 @@ func (a *Autonomy) ExecLocal_PropRule(payload *auty.ProposalRule, tx *types.Tran ...@@ -63,7 +63,7 @@ func (a *Autonomy) ExecLocal_PropRule(payload *auty.ProposalRule, tx *types.Tran
} }
// ExecLocal_RvkPropRule 撤销提案规则 // ExecLocal_RvkPropRule 撤销提案规则
func (a *Autonomy) ExecLocal_RvkPropRule(payload *auty.RevokeProposalRule, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error){ func (a *Autonomy) ExecLocal_RvkPropRule(payload *auty.RevokeProposalRule, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execLocalRule(receiptData) return a.execLocalRule(receiptData)
} }
...@@ -80,4 +80,4 @@ func (a *Autonomy) ExecLocal_TmintPropRule(payload *auty.TerminateProposalRule, ...@@ -80,4 +80,4 @@ func (a *Autonomy) ExecLocal_TmintPropRule(payload *auty.TerminateProposalRule,
// ExecLocal_Comment 评论提案 // ExecLocal_Comment 评论提案
func (a *Autonomy) ExecLocal_CommentProp(payload *auty.Comment, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (a *Autonomy) ExecLocal_CommentProp(payload *auty.Comment, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return a.execLocalCommentProp(receiptData) return a.execLocalCommentProp(receiptData)
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
) )
var ( var (
idPrefix = "mavl-" + auty.AutonomyX + "-" idPrefix = "mavl-" + auty.AutonomyX + "-"
votesRecordPrefix = idPrefix + "vote" + "-" votesRecordPrefix = idPrefix + "vote" + "-"
localPrefix = "LODB-" + auty.AutonomyX + "-" localPrefix = "LODB-" + auty.AutonomyX + "-"
...@@ -23,8 +23,8 @@ func votesRecord(txHash string) []byte { ...@@ -23,8 +23,8 @@ func votesRecord(txHash string) []byte {
var ( var (
// board // board
boardPrefix = idPrefix + "board" + "-" boardPrefix = idPrefix + "board" + "-"
localBoardPrefix = localPrefix + "board" + "-" localBoardPrefix = localPrefix + "board" + "-"
boardVotesRecordPrefix = boardPrefix + "vote" + "-" boardVotesRecordPrefix = boardPrefix + "vote" + "-"
) )
...@@ -41,13 +41,13 @@ func boardVotesRecord(txHash string) []byte { ...@@ -41,13 +41,13 @@ func boardVotesRecord(txHash string) []byte {
} }
func calcBoardKey4StatusHeight(status int32, heightindex string) []byte { func calcBoardKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localBoardPrefix + "%d-" +"%s", status, heightindex) key := fmt.Sprintf(localBoardPrefix+"%d-"+"%s", status, heightindex)
return []byte(key) return []byte(key)
} }
var ( var (
// project // project
projectPrefix = idPrefix + "project" + "-" projectPrefix = idPrefix + "project" + "-"
localProjectPrefix = localPrefix + "project" + "-" localProjectPrefix = localPrefix + "project" + "-"
) )
...@@ -56,13 +56,13 @@ func propProjectID(txHash string) []byte { ...@@ -56,13 +56,13 @@ func propProjectID(txHash string) []byte {
} }
func calcProjectKey4StatusHeight(status int32, heightindex string) []byte { func calcProjectKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localProjectPrefix + "%d-" +"%s", status, heightindex) key := fmt.Sprintf(localProjectPrefix+"%d-"+"%s", status, heightindex)
return []byte(key) return []byte(key)
} }
var ( var (
// rule // rule
rulePrefix = idPrefix + "rule" + "-" rulePrefix = idPrefix + "rule" + "-"
localRulePrefix = localPrefix + "rule" + "-" localRulePrefix = localPrefix + "rule" + "-"
) )
...@@ -75,7 +75,7 @@ func propRuleID(txHash string) []byte { ...@@ -75,7 +75,7 @@ func propRuleID(txHash string) []byte {
} }
func calcRuleKey4StatusHeight(status int32, heightindex string) []byte { func calcRuleKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localRulePrefix + "%d-" +"%s", status, heightindex) key := fmt.Sprintf(localRulePrefix+"%d-"+"%s", status, heightindex)
return []byte(key) return []byte(key)
} }
...@@ -85,6 +85,6 @@ var ( ...@@ -85,6 +85,6 @@ var (
) )
func calcCommentHeight(ID, heightindex string) []byte { func calcCommentHeight(ID, heightindex string) []byte {
key := fmt.Sprintf(localCommentPrefix + "%s-" +"%s", ID, heightindex) key := fmt.Sprintf(localCommentPrefix+"%s-"+"%s", ID, heightindex)
return []byte(key) return []byte(key)
} }
\ No newline at end of file
...@@ -126,7 +126,7 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types ...@@ -126,7 +126,7 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types
key = nil key = nil
} else { //翻页查找指定的txhash列表 } else { //翻页查找指定的txhash列表
heightstr := genHeightIndexStr(req.GetIndex()) heightstr := genHeightIndexStr(req.GetIndex())
key = calcProjectKey4StatusHeight(req.Status, heightstr) key = calcProjectKey4StatusHeight(req.Status, heightstr)
} }
prefix := calcProjectKey4StatusHeight(req.Status, "") prefix := calcProjectKey4StatusHeight(req.Status, "")
values, err = localDb.List(prefix, key, req.Count, req.GetDirection()) values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
...@@ -147,4 +147,4 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types ...@@ -147,4 +147,4 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types
rep.PropProjects = append(rep.PropProjects, prop) rep.PropProjects = append(rep.PropProjects, prop)
} }
return &rep, nil return &rep, nil
} }
\ No newline at end of file
...@@ -6,34 +6,35 @@ package executor ...@@ -6,34 +6,35 @@ package executor
import ( import (
"testing" "testing"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/util"
) )
func TestExecLocalProject(t *testing.T) { func TestExecLocalProject(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropProject //TyLogPropProject
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{}, PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"}, Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{}, BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{}, PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptProject := &auty.ReceiptProposalProject{ receiptProject := &auty.ReceiptProposalProject{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropProject, Log:types.Encode(receiptProject)}, {Ty: auty.TyLogPropProject, Log: types.Encode(receiptProject)},
}, },
} }
set, err := au.execLocalProject(receipt) set, err := au.execLocalProject(receipt)
...@@ -48,12 +49,12 @@ func TestExecLocalProject(t *testing.T) { ...@@ -48,12 +49,12 @@ func TestExecLocalProject(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptProject1 := &auty.ReceiptProposalProject{ receiptProject1 := &auty.ReceiptProposalProject{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execLocalProject(&types.ReceiptData{ set, err = au.execLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogRvkPropProject, Log:types.Encode(receiptProject1)}, {Ty: auty.TyLogRvkPropProject, Log: types.Encode(receiptProject1)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -73,12 +74,12 @@ func TestExecLocalProject(t *testing.T) { ...@@ -73,12 +74,12 @@ func TestExecLocalProject(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptProject2 := &auty.ReceiptProposalProject{ receiptProject2 := &auty.ReceiptProposalProject{
Prev: pre2, Prev: pre2,
Current: cur, Current: cur,
} }
set, err = au.execLocalProject(&types.ReceiptData{ set, err = au.execLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropProject, Log:types.Encode(receiptProject2)}, {Ty: auty.TyLogVotePropProject, Log: types.Encode(receiptProject2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -94,23 +95,23 @@ func TestExecDelLocalProject(t *testing.T) { ...@@ -94,23 +95,23 @@ func TestExecDelLocalProject(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropProject //TyLogPropProject
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{}, PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"}, Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{}, BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{}, PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptProject := &auty.ReceiptProposalProject{ receiptProject := &auty.ReceiptProposalProject{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropProject, Log:types.Encode(receiptProject)}, {Ty: auty.TyLogPropProject, Log: types.Encode(receiptProject)},
}, },
} }
set, err := au.execDelLocalProject(receipt) set, err := au.execDelLocalProject(receipt)
...@@ -126,12 +127,12 @@ func TestExecDelLocalProject(t *testing.T) { ...@@ -126,12 +127,12 @@ func TestExecDelLocalProject(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptProject2 := &auty.ReceiptProposalProject{ receiptProject2 := &auty.ReceiptProposalProject{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execDelLocalProject(&types.ReceiptData{ set, err = au.execDelLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropProject, Log:types.Encode(receiptProject2)}, {Ty: auty.TyLogVotePropProject, Log: types.Encode(receiptProject2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -152,7 +153,7 @@ func TestGetProposalProject(t *testing.T) { ...@@ -152,7 +153,7 @@ func TestGetProposalProject(t *testing.T) {
au.SetStateDB(storedb) au.SetStateDB(storedb)
tx := "1111111111111111111" tx := "1111111111111111111"
storedb.Set(propProjectID(tx), types.Encode(&auty.AutonomyProposalProject{})) storedb.Set(propProjectID(tx), types.Encode(&auty.AutonomyProposalProject{}))
rsp, err := au.getProposalProject(&types.ReqString{Data:tx}) rsp, err := au.getProposalProject(&types.ReqString{Data: tx})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, rsp) require.NotNil(t, rsp)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 1) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 1)
...@@ -185,15 +186,15 @@ func TestListProposalProject(t *testing.T) { ...@@ -185,15 +186,15 @@ func TestListProposalProject(t *testing.T) {
testcase = append(testcase, testcase1...) testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...) testcase = append(testcase, testcase2...)
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{}, PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"}, Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{}, BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{}, PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
for _, tcase := range testcase { for _, tcase := range testcase {
key := calcProjectKey4StatusHeight(tcase.status, key := calcProjectKey4StatusHeight(tcase.status,
...@@ -207,10 +208,10 @@ func TestListProposalProject(t *testing.T) { ...@@ -207,10 +208,10 @@ func TestListProposalProject(t *testing.T) {
// 反向查找 // 反向查找
req := &auty.ReqQueryProposalProject{ req := &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err := au.listProposalProject(req) rsp, err := au.listProposalProject(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -224,10 +225,10 @@ func TestListProposalProject(t *testing.T) { ...@@ -224,10 +225,10 @@ func TestListProposalProject(t *testing.T) {
// 正向查找 // 正向查找
req = &auty.ReqQueryProposalProject{ req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Count:10, Count: 10,
Direction:1, Direction: 1,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalProject(req) rsp, err = au.listProposalProject(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -239,10 +240,10 @@ func TestListProposalProject(t *testing.T) { ...@@ -239,10 +240,10 @@ func TestListProposalProject(t *testing.T) {
// 翻页查找 // 翻页查找
req = &auty.ReqQueryProposalProject{ req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Count:1, Count: 1,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalProject(req) rsp, err = au.listProposalProject(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -254,10 +255,10 @@ func TestListProposalProject(t *testing.T) { ...@@ -254,10 +255,10 @@ func TestListProposalProject(t *testing.T) {
// //
Index := height*types.MaxTxsPerBlock + int64(index) Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalProject{ req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: Index, Index: Index,
} }
rsp, err = au.listProposalProject(req) rsp, err = au.listProposalProject(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 2) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 2)
...@@ -265,4 +266,4 @@ func TestListProposalProject(t *testing.T) { ...@@ -265,4 +266,4 @@ func TestListProposalProject(t *testing.T) {
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Index, int32(testcase2[1].index)) require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Height, testcase2[0].height) require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Index, int32(testcase2[0].index)) require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Index, int32(testcase2[0].index))
} }
\ No newline at end of file
...@@ -12,17 +12,16 @@ import ( ...@@ -12,17 +12,16 @@ import (
"github.com/33cn/chain33/common/address" "github.com/33cn/chain33/common/address"
) )
func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error) { func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error) {
if err := address.CheckAddress(prob.ToAddr); err != nil { if err := address.CheckAddress(prob.ToAddr); err != nil {
alog.Error("propProject ", "addr", prob.ToAddr, "check toAddr error", err) alog.Error("propProject ", "addr", prob.ToAddr, "check toAddr error", err)
return nil, types.ErrInvalidAddress return nil, types.ErrInvalidAddress
} }
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height || prob.Amount <= 0 { if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height || prob.Amount <= 0 {
alog.Error("propProject height or amount invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight", alog.Error("propProject height or amount invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight",
prob.EndBlockHeight, "height", a.height, "amount", prob.Amount) prob.EndBlockHeight, "height", a.height, "amount", prob.Amount)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
// 获取董事会成员 // 获取董事会成员
...@@ -64,15 +63,15 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error) ...@@ -64,15 +63,15 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
isPubVote = true isPubVote = true
} }
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject:prob, PropProject: prob,
CurRule:rule, CurRule: rule,
Boards: pboard.Boards, Boards: pboard.Boards,
BoardVoteRes: &auty.VoteResult{TotalVotes: int32(len(pboard.Boards))}, BoardVoteRes: &auty.VoteResult{TotalVotes: int32(len(pboard.Boards))},
PubVote: &auty.PublicVote{Publicity:isPubVote}, PubVote: &auty.PublicVote{Publicity: isPubVote},
Status: auty.AutonomyStatusProposalProject, Status: auty.AutonomyStatusProposalProject,
Address: a.fromaddr, Address: a.fromaddr,
Height: a.height, Height: a.height,
Index: a.index, Index: a.index,
} }
kv = append(kv, &types.KeyValue{Key: propProjectID(common.ToHex(a.txhash)), Value: types.Encode(cur)}) kv = append(kv, &types.KeyValue{Key: propProjectID(common.ToHex(a.txhash)), Value: types.Encode(cur)})
receiptLog := getProjectReceiptLog(nil, cur, auty.TyLogPropProject) receiptLog := getProjectReceiptLog(nil, cur, auty.TyLogPropProject)
...@@ -154,7 +153,7 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec ...@@ -154,7 +153,7 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
pre := copyAutonomyProposalProject(cur) pre := copyAutonomyProposalProject(cur)
// 检查当前状态 // 检查当前状态
if cur.Status == auty.AutonomyStatusRvkPropProject || if cur.Status == auty.AutonomyStatusRvkPropProject ||
cur.Status == auty.AutonomyStatusPubVotePropProject || cur.Status == auty.AutonomyStatusPubVotePropProject ||
cur.Status == auty.AutonomyStatusTmintPropProject { cur.Status == auty.AutonomyStatusTmintPropProject {
err := auty.ErrProposalStatus err := auty.ErrProposalStatus
...@@ -220,9 +219,9 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec ...@@ -220,9 +219,9 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
} }
if cur.BoardVoteRes.TotalVotes != 0 && if cur.BoardVoteRes.TotalVotes != 0 &&
cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes != 0 && cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes != 0 &&
float32(cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes) / float32(cur.BoardVoteRes.TotalVotes) >= float32(cur.CurRule.BoardAttendRatio)/100.0 && float32(cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes)/float32(cur.BoardVoteRes.TotalVotes) >= float32(cur.CurRule.BoardAttendRatio)/100.0 &&
float32(cur.BoardVoteRes.ApproveVotes) / float32(cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 { float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 {
cur.BoardVoteRes.Pass = true cur.BoardVoteRes.Pass = true
cur.PropProject.RealEndBlockHeight = a.height cur.PropProject.RealEndBlockHeight = a.height
} }
...@@ -306,7 +305,7 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ ...@@ -306,7 +305,7 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.PubVote.TotalVotes = int32(account.Balance/ticketPrice) cur.PubVote.TotalVotes = int32(account.Balance / ticketPrice)
} }
// 获取该地址票数 // 获取该地址票数
...@@ -315,16 +314,16 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ ...@@ -315,16 +314,16 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ
return nil, err return nil, err
} }
if voteProb.Oppose { //投反对票 if voteProb.Oppose { //投反对票
cur.PubVote.OpposeVotes += int32(account.Balance/ticketPrice) cur.PubVote.OpposeVotes += int32(account.Balance / ticketPrice)
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
if cur.PubVote.TotalVotes != 0 && if cur.PubVote.TotalVotes != 0 &&
float32(cur.PubVote.OpposeVotes) / float32(cur.PubVote.TotalVotes) >= float32(cur.CurRule.PubOpposeRatio) / 100.0 { float32(cur.PubVote.OpposeVotes)/float32(cur.PubVote.TotalVotes) >= float32(cur.CurRule.PubOpposeRatio)/100.0 {
cur.PubVote.PubPass = false cur.PubVote.PubPass = false
cur.PropProject.RealEndBlockHeight = a.height cur.PropProject.RealEndBlockHeight = a.height
// 解冻项目金 // 解冻项目金
receiptPrj, err := a.coinsAccount.ExecActive(autonomyFundAddr, a.execaddr, cur.PropProject.Amount) receiptPrj, err := a.coinsAccount.ExecActive(autonomyFundAddr, a.execaddr, cur.PropProject.Amount)
...@@ -374,7 +373,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty ...@@ -374,7 +373,7 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
// 公示期间不能终止 // 公示期间不能终止
if cur.PubVote.Publicity && cur.PubVote.PubPass && if cur.PubVote.Publicity && cur.PubVote.PubPass &&
a.height <= cur.PropProject.RealEndBlockHeight + int64(cur.CurRule.PublicPeriod) { a.height <= cur.PropProject.RealEndBlockHeight+int64(cur.CurRule.PublicPeriod) {
err := auty.ErrTerminatePeriod err := auty.ErrTerminatePeriod
alog.Error("tmintPropProject ", "addr", a.fromaddr, "status", cur.Status, alog.Error("tmintPropProject ", "addr", a.fromaddr, "status", cur.Status,
"in publicity vote period can not terminate", tmintProb.ProposalID, "err", err) "in publicity vote period can not terminate", tmintProb.ProposalID, "err", err)
...@@ -392,9 +391,9 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty ...@@ -392,9 +391,9 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
} }
if cur.BoardVoteRes.TotalVotes != 0 && if cur.BoardVoteRes.TotalVotes != 0 &&
cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes != 0 && cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes != 0 &&
float32(cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes) / float32(cur.BoardVoteRes.TotalVotes) >= float32(cur.CurRule.BoardAttendRatio)/100.0 && float32(cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes)/float32(cur.BoardVoteRes.TotalVotes) >= float32(cur.CurRule.BoardAttendRatio)/100.0 &&
float32(cur.BoardVoteRes.ApproveVotes) / float32(cur.BoardVoteRes.ApproveVotes + cur.BoardVoteRes.OpposeVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 { float32(cur.BoardVoteRes.ApproveVotes)/float32(cur.BoardVoteRes.ApproveVotes+cur.BoardVoteRes.OpposeVotes) >= float32(cur.CurRule.BoardApproveRatio)/100.0 {
cur.BoardVoteRes.Pass = true cur.BoardVoteRes.Pass = true
} else { } else {
cur.BoardVoteRes.Pass = false cur.BoardVoteRes.Pass = false
...@@ -407,11 +406,11 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty ...@@ -407,11 +406,11 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.PubVote.TotalVotes = int32(account.Balance/ticketPrice) cur.PubVote.TotalVotes = int32(account.Balance / ticketPrice)
} }
if cur.PubVote.TotalVotes != 0 && if cur.PubVote.TotalVotes != 0 &&
float32(cur.PubVote.OpposeVotes) / float32(cur.PubVote.TotalVotes) >= float32(cur.CurRule.PubOpposeRatio)/ 100.0 { float32(cur.PubVote.OpposeVotes)/float32(cur.PubVote.TotalVotes) >= float32(cur.CurRule.PubOpposeRatio)/100.0 {
cur.PubVote.PubPass = false cur.PubVote.PubPass = false
} }
} }
...@@ -431,8 +430,8 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty ...@@ -431,8 +430,8 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
} }
if (cur.PubVote.Publicity && cur.PubVote.PubPass) || // 需要公示且公示通过 if (cur.PubVote.Publicity && cur.PubVote.PubPass) || // 需要公示且公示通过
(!cur.PubVote.Publicity && cur.BoardVoteRes.Pass) { // 不需要公示且董事会通过 (!cur.PubVote.Publicity && cur.BoardVoteRes.Pass) { // 不需要公示且董事会通过
// 提案通过,将工程金额从基金付款给承包商 // 提案通过,将工程金额从基金付款给承包商
receipt, err := a.coinsAccount.ExecTransferFrozen(autonomyFundAddr, cur.PropProject.ToAddr, a.execaddr, cur.PropProject.Amount) receipt, err := a.coinsAccount.ExecTransferFrozen(autonomyFundAddr, cur.PropProject.ToAddr, a.execaddr, cur.PropProject.Amount)
if err != nil { if err != nil {
...@@ -480,12 +479,12 @@ func (a *action) getActiveBoard() (*auty.ProposalBoard, error) { ...@@ -480,12 +479,12 @@ func (a *action) getActiveBoard() (*auty.ProposalBoard, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
pboard := &auty.ProposalBoard{} pboard := &auty.ProposalBoard{}
err = types.Decode(value, pboard) err = types.Decode(value, pboard)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if len(pboard.Boards) > maxBoards || len(pboard.Boards) < minBoards { if len(pboard.Boards) > maxBoards || len(pboard.Boards) < minBoards {
err = auty.ErrNoActiveBoard err = auty.ErrNoActiveBoard
return nil, err return nil, err
} }
...@@ -507,7 +506,7 @@ func copyAutonomyProposalProject(cur *auty.AutonomyProposalProject) *auty.Autono ...@@ -507,7 +506,7 @@ func copyAutonomyProposalProject(cur *auty.AutonomyProposalProject) *auty.Autono
return nil return nil
} }
newAut := *cur newAut := *cur
if cur.PropProject != nil{ if cur.PropProject != nil {
newProject := *cur.GetPropProject() newProject := *cur.GetPropProject()
newAut.PropProject = &newProject newAut.PropProject = &newProject
} }
...@@ -525,4 +524,3 @@ func copyAutonomyProposalProject(cur *auty.AutonomyProposalProject) *auty.Autono ...@@ -525,4 +524,3 @@ func copyAutonomyProposalProject(cur *auty.AutonomyProposalProject) *auty.Autono
} }
return &newAut return &newAut
} }
...@@ -7,17 +7,17 @@ package executor ...@@ -7,17 +7,17 @@ package executor
import ( import (
"testing" "testing"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" "github.com/33cn/chain33/account"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/types"
apimock "github.com/33cn/chain33/client/mocks" apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/account"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/stretchr/testify/mock"
"github.com/33cn/chain33/common/address"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
) )
//const ( //const (
...@@ -29,19 +29,19 @@ import ( ...@@ -29,19 +29,19 @@ import (
//) //)
const ( const (
testProjectAmount int64 = types.Coin * 100 // 工程需要资金 testProjectAmount int64 = types.Coin * 100 // 工程需要资金
) )
func InitBoard(stateDB dbm.KV) { func InitBoard(stateDB dbm.KV) {
// add active board // add active board
board := &auty.ProposalBoard{ board := &auty.ProposalBoard{
Year: 2019, Year: 2019,
Month: 11, Month: 11,
Day: 1, Day: 1,
Boards: []string{AddrA, AddrB, AddrC, AddrD}, Boards: []string{AddrA, AddrB, AddrC, AddrD},
StartBlockHeight:1, StartBlockHeight: 1,
EndBlockHeight:10, EndBlockHeight: 10,
RealEndBlockHeight:5, RealEndBlockHeight: 5,
} }
stateDB.Set(activeBoardID(), types.Encode(board)) stateDB.Set(activeBoardID(), types.Encode(board))
} }
...@@ -49,12 +49,12 @@ func InitBoard(stateDB dbm.KV) { ...@@ -49,12 +49,12 @@ func InitBoard(stateDB dbm.KV) {
func InitRule(stateDB dbm.KV) { func InitRule(stateDB dbm.KV) {
// add active rule // add active rule
rule := &auty.RuleConfig{ rule := &auty.RuleConfig{
BoardAttendRatio: boardAttendRatio, BoardAttendRatio: boardAttendRatio,
BoardApproveRatio: boardApproveRatio, BoardApproveRatio: boardApproveRatio,
PubOpposeRatio: pubOpposeRatio, PubOpposeRatio: pubOpposeRatio,
ProposalAmount: proposalAmount, ProposalAmount: proposalAmount,
LargeProjectAmount: types.Coin *100, LargeProjectAmount: types.Coin * 100,
PublicPeriod: publicPeriod, PublicPeriod: publicPeriod,
} }
stateDB.Set(activeRuleID(), types.Encode(rule)) stateDB.Set(activeRuleID(), types.Encode(rule))
} }
...@@ -74,35 +74,35 @@ func TestPropProject(t *testing.T) { ...@@ -74,35 +74,35 @@ func TestPropProject(t *testing.T) {
env, exec, _, _ := InitEnv() env, exec, _, _ := InitEnv()
opts := []*auty.ProposalProject{ opts := []*auty.ProposalProject{
&auty.ProposalProject{ // check toaddr { // check toaddr
ToAddr: "1111111111", ToAddr: "1111111111",
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + 10, EndBlockHeight: env.blockHeight + 10,
}, },
&auty.ProposalProject{ // check amount { // check amount
Amount: 0, Amount: 0,
ToAddr: AddrA, ToAddr: AddrA,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + 10, EndBlockHeight: env.blockHeight + 10,
}, },
&auty.ProposalProject{ // check StartBlockHeight EndBlockHeight { // check StartBlockHeight EndBlockHeight
Amount: 10, Amount: 10,
ToAddr: AddrA, ToAddr: AddrA,
StartBlockHeight: env.blockHeight-1, StartBlockHeight: env.blockHeight - 1,
EndBlockHeight: env.blockHeight-1, EndBlockHeight: env.blockHeight - 1,
}, },
&auty.ProposalProject{ // check activeboard { // check activeboard
Amount: 100, Amount: 100,
ToAddr: AddrA, ToAddr: AddrA,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + 10, EndBlockHeight: env.blockHeight + 10,
}, },
} }
result := [] error { result := []error{
types.ErrInvalidAddress, types.ErrInvalidAddress,
types.ErrInvalidParam, types.ErrInvalidParam,
types.ErrInvalidParam, types.ErrInvalidParam,
types.ErrNotFound, types.ErrNotFound,
} }
...@@ -167,14 +167,14 @@ func TestTerminateProposalProject(t *testing.T) { ...@@ -167,14 +167,14 @@ func TestTerminateProposalProject(t *testing.T) {
} }
func testPropProject(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func testPropProject(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
opt1 := &auty.ProposalProject{ opt1 := &auty.ProposalProject{
Year: 2019, Year: 2019,
Month: 7, Month: 7,
Day: 10, Day: 10,
Amount: testProjectAmount, Amount: testProjectAmount,
ToAddr: AddrD, ToAddr: AddrD,
StartBlockHeight: env.blockHeight + 5, StartBlockHeight: env.blockHeight + 5,
EndBlockHeight: env.blockHeight + 10, EndBlockHeight: env.blockHeight + 10,
} }
pbtx, err := propProjectTx(opt1) pbtx, err := propProjectTx(opt1)
require.NoError(t, err) require.NoError(t, err)
...@@ -231,8 +231,8 @@ func propProjectTx(parm *auty.ProposalProject) (*types.Transaction, error) { ...@@ -231,8 +231,8 @@ func propProjectTx(parm *auty.ProposalProject) (*types.Transaction, error) {
func revokeProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func revokeProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
proposalID := env.txHash proposalID := env.txHash
opt2 := &auty.RevokeProposalProject{ opt2 := &auty.RevokeProposalProject{
ProposalID:proposalID, ProposalID: proposalID,
} }
rtx, err := revokeProposalProjectTx(opt2) rtx, err := revokeProposalProjectTx(opt2)
require.NoError(t, err) require.NoError(t, err)
...@@ -294,22 +294,22 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD ...@@ -294,22 +294,22 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
acc = &types.Account{ acc = &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val1 := types.Encode(acc) val1 := types.Encode(acc)
values1 := [][]byte{val1} values1 := [][]byte{val1}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values1}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values1}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
...@@ -326,9 +326,9 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD ...@@ -326,9 +326,9 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD
} }
for _, record := range records { for _, record := range records {
opt := &auty.VoteProposalProject{ opt := &auty.VoteProposalProject{
ProposalID:proposalID, ProposalID: proposalID,
Approve: record.appr, Approve: record.appr,
} }
tx, err := voteProposalProjectTx(opt) tx, err := voteProposalProjectTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -362,11 +362,11 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD ...@@ -362,11 +362,11 @@ func voteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, stateD
// 每次需要重新设置 // 每次需要重新设置
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
} }
} }
...@@ -408,22 +408,22 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta ...@@ -408,22 +408,22 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
acc = &types.Account{ acc = &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val1 := types.Encode(acc) val1 := types.Encode(acc)
values1 := [][]byte{val1} values1 := [][]byte{val1}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values1}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values1}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
...@@ -440,9 +440,9 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta ...@@ -440,9 +440,9 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta
} }
for _, record := range records { for _, record := range records {
opt := &auty.PubVoteProposalProject{ opt := &auty.PubVoteProposalProject{
ProposalID:proposalID, ProposalID: proposalID,
Oppose: record.appr, Oppose: record.appr,
} }
tx, err := pubVoteProposalProjectTx(opt) tx, err := pubVoteProposalProjectTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -476,11 +476,11 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta ...@@ -476,11 +476,11 @@ func pubVoteProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, sta
// 每次需要重新设置 // 每次需要重新设置
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
} }
} }
...@@ -493,7 +493,7 @@ func checkPubVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID ...@@ -493,7 +493,7 @@ func checkPubVoteProposalProjectResult(t *testing.T, stateDB dbm.KV, proposalID
account := accCoin.LoadExecAccount(AddrA, address.ExecAddress(auty.AutonomyX)) account := accCoin.LoadExecAccount(AddrA, address.ExecAddress(auty.AutonomyX))
require.Equal(t, int64(0), account.Frozen) require.Equal(t, int64(0), account.Frozen)
account = accCoin.LoadExecAccount(autonomyFundAddr, address.ExecAddress(auty.AutonomyX)) account = accCoin.LoadExecAccount(autonomyFundAddr, address.ExecAddress(auty.AutonomyX))
require.Equal(t, int64(proposalAmount) + testProjectAmount, account.Balance) require.Equal(t, int64(proposalAmount)+testProjectAmount, account.Balance)
// status // status
value, err := stateDB.Get(propProjectID(proposalID)) value, err := stateDB.Get(propProjectID(proposalID))
require.NoError(t, err) require.NoError(t, err)
...@@ -522,19 +522,19 @@ func terminateProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, s ...@@ -522,19 +522,19 @@ func terminateProposalProject(t *testing.T, env *execEnv, exec drivers.Driver, s
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
opt := &auty.TerminateProposalProject{ opt := &auty.TerminateProposalProject{
ProposalID:proposalID, ProposalID: proposalID,
} }
tx, err := terminateProposalProjectTx(opt) tx, err := terminateProposalProjectTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -591,20 +591,20 @@ func terminateProposalProjectTx(parm *auty.TerminateProposalProject) (*types.Tra ...@@ -591,20 +591,20 @@ func terminateProposalProjectTx(parm *auty.TerminateProposalProject) (*types.Tra
func TestGetProjectReceiptLog(t *testing.T) { func TestGetProjectReceiptLog(t *testing.T) {
pre := &auty.AutonomyProposalProject{ pre := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{Year: 1800, Month: 1}, PropProject: &auty.ProposalProject{Year: 1800, Month: 1},
CurRule: &auty.RuleConfig{BoardAttendRatio:80}, CurRule: &auty.RuleConfig{BoardAttendRatio: 80},
Boards: []string{"111", "222", "333"}, Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{TotalVotes: 100}, BoardVoteRes: &auty.VoteResult{TotalVotes: 100},
Status: 1, Status: 1,
Address:"121", Address: "121",
} }
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{Year: 1900, Month: 1}, PropProject: &auty.ProposalProject{Year: 1900, Month: 1},
CurRule: &auty.RuleConfig{BoardAttendRatio:90}, CurRule: &auty.RuleConfig{BoardAttendRatio: 90},
Boards: []string{"555", "666", "777"}, Boards: []string{"555", "666", "777"},
BoardVoteRes: &auty.VoteResult{TotalVotes: 100}, BoardVoteRes: &auty.VoteResult{TotalVotes: 100},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
log := getProjectReceiptLog(pre, cur, 2) log := getProjectReceiptLog(pre, cur, 2)
require.Equal(t, int32(2), log.Ty) require.Equal(t, int32(2), log.Ty)
...@@ -622,13 +622,13 @@ func TestGetProjectReceiptLog(t *testing.T) { ...@@ -622,13 +622,13 @@ func TestGetProjectReceiptLog(t *testing.T) {
func TestCopyAutonomyProposalProject(t *testing.T) { func TestCopyAutonomyProposalProject(t *testing.T) {
require.Nil(t, copyAutonomyProposalProject(nil)) require.Nil(t, copyAutonomyProposalProject(nil))
cur := &auty.AutonomyProposalProject{ cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{Year: 1800, Month: 1}, PropProject: &auty.ProposalProject{Year: 1800, Month: 1},
CurRule: &auty.RuleConfig{BoardAttendRatio:80}, CurRule: &auty.RuleConfig{BoardAttendRatio: 80},
Boards: []string{"111", "222", "333"}, Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{TotalVotes: 100}, BoardVoteRes: &auty.VoteResult{TotalVotes: 100},
PubVote: &auty.PublicVote{Publicity:true}, PubVote: &auty.PublicVote{Publicity: true},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
pre := copyAutonomyProposalProject(cur) pre := copyAutonomyProposalProject(cur)
cur.PropProject.Year = 1900 cur.PropProject.Year = 1900
...@@ -649,4 +649,4 @@ func TestCopyAutonomyProposalProject(t *testing.T) { ...@@ -649,4 +649,4 @@ func TestCopyAutonomyProposalProject(t *testing.T) {
require.Equal(t, 100, int(pre.BoardVoteRes.TotalVotes)) require.Equal(t, 100, int(pre.BoardVoteRes.TotalVotes))
require.Equal(t, true, pre.PubVote.Publicity) require.Equal(t, true, pre.PubVote.Publicity)
require.Equal(t, []string{"555", "666", "777"}, cur.Boards) require.Equal(t, []string{"555", "666", "777"}, cur.Boards)
} }
\ No newline at end of file
...@@ -19,7 +19,6 @@ func (a *Autonomy) Query_ListProposalBoard(in *auty.ReqQueryProposalBoard) (type ...@@ -19,7 +19,6 @@ func (a *Autonomy) Query_ListProposalBoard(in *auty.ReqQueryProposalBoard) (type
return a.listProposalBoard(in) return a.listProposalBoard(in)
} }
// Query_GetProposalProject 查询提案项目 // Query_GetProposalProject 查询提案项目
func (a *Autonomy) Query_GetProposalProject(in *types.ReqString) (types.Message, error) { func (a *Autonomy) Query_GetProposalProject(in *types.ReqString) (types.Message, error) {
return a.getProposalProject(in) return a.getProposalProject(in)
...@@ -30,7 +29,6 @@ func (a *Autonomy) Query_ListProposalProject(in *auty.ReqQueryProposalProject) ( ...@@ -30,7 +29,6 @@ func (a *Autonomy) Query_ListProposalProject(in *auty.ReqQueryProposalProject) (
return a.listProposalProject(in) return a.listProposalProject(in)
} }
// Query_GetProposalRule 查询提案规则 // Query_GetProposalRule 查询提案规则
func (a *Autonomy) Query_GetProposalRule(in *types.ReqString) (types.Message, error) { func (a *Autonomy) Query_GetProposalRule(in *types.ReqString) (types.Message, error) {
return a.getProposalRule(in) return a.getProposalRule(in)
...@@ -41,8 +39,7 @@ func (a *Autonomy) Query_ListProposalRule(in *auty.ReqQueryProposalRule) (types. ...@@ -41,8 +39,7 @@ func (a *Autonomy) Query_ListProposalRule(in *auty.ReqQueryProposalRule) (types.
return a.listProposalRule(in) return a.listProposalRule(in)
} }
// Query_ListProposalComment 批量查询提案评论 // Query_ListProposalComment 批量查询提案评论
func (a *Autonomy) Query_ListProposalComment(in *auty.ReqQueryProposalComment) (types.Message, error) { func (a *Autonomy) Query_ListProposalComment(in *auty.ReqQueryProposalComment) (types.Message, error) {
return a.listProposalComment(in) return a.listProposalComment(in)
} }
\ No newline at end of file
...@@ -124,7 +124,7 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa ...@@ -124,7 +124,7 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa
key = nil key = nil
} else { //翻页查找指定的txhash列表 } else { //翻页查找指定的txhash列表
heightstr := genHeightIndexStr(req.GetIndex()) heightstr := genHeightIndexStr(req.GetIndex())
key = calcRuleKey4StatusHeight(req.Status, heightstr) key = calcRuleKey4StatusHeight(req.Status, heightstr)
} }
prefix := calcRuleKey4StatusHeight(req.Status, "") prefix := calcRuleKey4StatusHeight(req.Status, "")
values, err = localDb.List(prefix, key, req.Count, req.GetDirection()) values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
...@@ -175,9 +175,9 @@ func saveCommentHeightIndex(res *auty.ReceiptProposalComment) (kvs []*types.KeyV ...@@ -175,9 +175,9 @@ func saveCommentHeightIndex(res *auty.ReceiptProposalComment) (kvs []*types.KeyV
kv.Key = calcCommentHeight(res.Cmt.ProposalID, dapp.HeightIndexStr(res.Height, int64(res.Index))) kv.Key = calcCommentHeight(res.Cmt.ProposalID, dapp.HeightIndexStr(res.Height, int64(res.Index)))
kv.Value = types.Encode(&auty.RelationCmt{ kv.Value = types.Encode(&auty.RelationCmt{
RepCmtHash: res.Cmt.RepCmtHash, RepCmtHash: res.Cmt.RepCmtHash,
Comment: res.Cmt.Comment, Comment: res.Cmt.Comment,
Height: res.Height, Height: res.Height,
Index: res.Index, Index: res.Index,
}) })
kvs = append(kvs, kv) kvs = append(kvs, kv)
return kvs return kvs
...@@ -227,7 +227,7 @@ func (a *Autonomy) listProposalComment(req *auty.ReqQueryProposalComment) (types ...@@ -227,7 +227,7 @@ func (a *Autonomy) listProposalComment(req *auty.ReqQueryProposalComment) (types
key = nil key = nil
} else { //翻页查找指定的txhash列表 } else { //翻页查找指定的txhash列表
heightstr := genHeightIndexStr(req.GetIndex()) heightstr := genHeightIndexStr(req.GetIndex())
key = calcCommentHeight(req.ProposalID, heightstr) key = calcCommentHeight(req.ProposalID, heightstr)
} }
prefix := calcCommentHeight(req.ProposalID, "") prefix := calcCommentHeight(req.ProposalID, "")
values, err = localDb.List(prefix, key, req.Count, req.GetDirection()) values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
...@@ -248,4 +248,4 @@ func (a *Autonomy) listProposalComment(req *auty.ReqQueryProposalComment) (types ...@@ -248,4 +248,4 @@ func (a *Autonomy) listProposalComment(req *auty.ReqQueryProposalComment) (types
rep.RltCmt = append(rep.RltCmt, cmt) rep.RltCmt = append(rep.RltCmt, cmt)
} }
return &rep, nil return &rep, nil
} }
\ No newline at end of file
...@@ -6,32 +6,33 @@ package executor ...@@ -6,32 +6,33 @@ package executor
import ( import (
"testing" "testing"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/util"
) )
func TestExecLocalRule(t *testing.T) { func TestExecLocalRule(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropRule //TyLogPropRule
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{}, PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptRule := &auty.ReceiptProposalRule{ receiptRule := &auty.ReceiptProposalRule{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropRule, Log:types.Encode(receiptRule)}, {Ty: auty.TyLogPropRule, Log: types.Encode(receiptRule)},
}, },
} }
set, err := au.execLocalRule(receipt) set, err := au.execLocalRule(receipt)
...@@ -46,12 +47,12 @@ func TestExecLocalRule(t *testing.T) { ...@@ -46,12 +47,12 @@ func TestExecLocalRule(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptRule1 := &auty.ReceiptProposalRule{ receiptRule1 := &auty.ReceiptProposalRule{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execLocalRule(&types.ReceiptData{ set, err = au.execLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogRvkPropRule, Log:types.Encode(receiptRule1)}, {Ty: auty.TyLogRvkPropRule, Log: types.Encode(receiptRule1)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -71,12 +72,12 @@ func TestExecLocalRule(t *testing.T) { ...@@ -71,12 +72,12 @@ func TestExecLocalRule(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptRule2 := &auty.ReceiptProposalRule{ receiptRule2 := &auty.ReceiptProposalRule{
Prev: pre2, Prev: pre2,
Current: cur, Current: cur,
} }
set, err = au.execLocalRule(&types.ReceiptData{ set, err = au.execLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropRule, Log:types.Encode(receiptRule2)}, {Ty: auty.TyLogVotePropRule, Log: types.Encode(receiptRule2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -92,21 +93,21 @@ func TestExecDelLocalRule(t *testing.T) { ...@@ -92,21 +93,21 @@ func TestExecDelLocalRule(t *testing.T) {
au := &Autonomy{} au := &Autonomy{}
//TyLogPropRule //TyLogPropRule
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{}, PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
receiptRule := &auty.ReceiptProposalRule{ receiptRule := &auty.ReceiptProposalRule{
Prev: nil, Prev: nil,
Current: cur, Current: cur,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropRule, Log:types.Encode(receiptRule)}, {Ty: auty.TyLogPropRule, Log: types.Encode(receiptRule)},
}, },
} }
set, err := au.execDelLocalRule(receipt) set, err := au.execDelLocalRule(receipt)
...@@ -122,12 +123,12 @@ func TestExecDelLocalRule(t *testing.T) { ...@@ -122,12 +123,12 @@ func TestExecDelLocalRule(t *testing.T) {
cur.Height = 2 cur.Height = 2
cur.Index = 3 cur.Index = 3
receiptRule2 := &auty.ReceiptProposalRule{ receiptRule2 := &auty.ReceiptProposalRule{
Prev: pre1, Prev: pre1,
Current: cur, Current: cur,
} }
set, err = au.execDelLocalRule(&types.ReceiptData{ set, err = au.execDelLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropRule, Log:types.Encode(receiptRule2)}, {Ty: auty.TyLogVotePropRule, Log: types.Encode(receiptRule2)},
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
...@@ -148,7 +149,7 @@ func TestGetProposalRule(t *testing.T) { ...@@ -148,7 +149,7 @@ func TestGetProposalRule(t *testing.T) {
au.SetStateDB(storedb) au.SetStateDB(storedb)
tx := "1111111111111111111" tx := "1111111111111111111"
storedb.Set(propRuleID(tx), types.Encode(&auty.AutonomyProposalRule{})) storedb.Set(propRuleID(tx), types.Encode(&auty.AutonomyProposalRule{}))
rsp, err := au.getProposalRule(&types.ReqString{Data:tx}) rsp, err := au.getProposalRule(&types.ReqString{Data: tx})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, rsp) require.NotNil(t, rsp)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 1) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 1)
...@@ -181,13 +182,13 @@ func TestListProposalRule(t *testing.T) { ...@@ -181,13 +182,13 @@ func TestListProposalRule(t *testing.T) {
testcase = append(testcase, testcase1...) testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...) testcase = append(testcase, testcase2...)
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{}, PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{}, CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111", Address: "11111111111111",
Height: 1, Height: 1,
Index: 2, Index: 2,
} }
for _, tcase := range testcase { for _, tcase := range testcase {
key := calcRuleKey4StatusHeight(tcase.status, key := calcRuleKey4StatusHeight(tcase.status,
...@@ -201,10 +202,10 @@ func TestListProposalRule(t *testing.T) { ...@@ -201,10 +202,10 @@ func TestListProposalRule(t *testing.T) {
// 反向查找 // 反向查找
req := &auty.ReqQueryProposalRule{ req := &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err := au.listProposalRule(req) rsp, err := au.listProposalRule(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -218,10 +219,10 @@ func TestListProposalRule(t *testing.T) { ...@@ -218,10 +219,10 @@ func TestListProposalRule(t *testing.T) {
// 正向查找 // 正向查找
req = &auty.ReqQueryProposalRule{ req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Count:10, Count: 10,
Direction:1, Direction: 1,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalRule(req) rsp, err = au.listProposalRule(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -233,10 +234,10 @@ func TestListProposalRule(t *testing.T) { ...@@ -233,10 +234,10 @@ func TestListProposalRule(t *testing.T) {
// 翻页查找 // 翻页查找
req = &auty.ReqQueryProposalRule{ req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Count:1, Count: 1,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalRule(req) rsp, err = au.listProposalRule(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -248,10 +249,10 @@ func TestListProposalRule(t *testing.T) { ...@@ -248,10 +249,10 @@ func TestListProposalRule(t *testing.T) {
// //
Index := height*types.MaxTxsPerBlock + int64(index) Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalRule{ req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: Index, Index: Index,
} }
rsp, err = au.listProposalRule(req) rsp, err = au.listProposalRule(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 2) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 2)
...@@ -266,18 +267,18 @@ func TestExecLocalCommentProp(t *testing.T) { ...@@ -266,18 +267,18 @@ func TestExecLocalCommentProp(t *testing.T) {
propID := "11111111111111" propID := "11111111111111"
Repcmt := "2222222222" Repcmt := "2222222222"
comment := "3333333333" comment := "3333333333"
receiptCmt := &auty.ReceiptProposalComment { receiptCmt := &auty.ReceiptProposalComment{
Cmt: &auty.Comment{ Cmt: &auty.Comment{
ProposalID: propID, ProposalID: propID,
RepCmtHash:Repcmt, RepCmtHash: Repcmt,
Comment:comment, Comment: comment,
}, },
Height: 11, Height: 11,
Index: 1, Index: 1,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogCommentProp, Log:types.Encode(receiptCmt)}, {Ty: auty.TyLogCommentProp, Log: types.Encode(receiptCmt)},
}, },
} }
set, err := au.execLocalCommentProp(receipt) set, err := au.execLocalCommentProp(receipt)
...@@ -293,18 +294,18 @@ func TestExecDelLocalCommentProp(t *testing.T) { ...@@ -293,18 +294,18 @@ func TestExecDelLocalCommentProp(t *testing.T) {
propID := "11111111111111" propID := "11111111111111"
Repcmt := "2222222222" Repcmt := "2222222222"
comment := "3333333333" comment := "3333333333"
receiptCmt := &auty.ReceiptProposalComment { receiptCmt := &auty.ReceiptProposalComment{
Cmt: &auty.Comment{ Cmt: &auty.Comment{
ProposalID: propID, ProposalID: propID,
RepCmtHash:Repcmt, RepCmtHash: Repcmt,
Comment:comment, Comment: comment,
}, },
Height: 11, Height: 11,
Index: 1, Index: 1,
} }
receipt := &types.ReceiptData{ receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{ Logs: []*types.ReceiptLog{
{Ty: auty.TyLogCommentProp, Log:types.Encode(receiptCmt)}, {Ty: auty.TyLogCommentProp, Log: types.Encode(receiptCmt)},
}, },
} }
set, err := au.execDelLocalCommentProp(receipt) set, err := au.execDelLocalCommentProp(receipt)
...@@ -328,7 +329,7 @@ func TestListProposalComment(t *testing.T) { ...@@ -328,7 +329,7 @@ func TestListProposalComment(t *testing.T) {
index int64 index int64
} }
propID := "3333333333" propID := "3333333333"
propID1 := "2222222" propID1 := "2222222"
propID2 := "111111111111" propID2 := "111111111111"
...@@ -346,24 +347,24 @@ func TestListProposalComment(t *testing.T) { ...@@ -346,24 +347,24 @@ func TestListProposalComment(t *testing.T) {
testcase = append(testcase, testcase1...) testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...) testcase = append(testcase, testcase2...)
cur := &auty.RelationCmt{ cur := &auty.RelationCmt{
RepCmtHash:"aaaaaa", RepCmtHash: "aaaaaa",
Comment:"bbbbbbbbbb", Comment: "bbbbbbbbbb",
} }
for _, tcase := range testcase { for _, tcase := range testcase {
key := calcCommentHeight(tcase.propId, key := calcCommentHeight(tcase.propId,
dapp.HeightIndexStr(tcase.height, int64(tcase.index))) dapp.HeightIndexStr(tcase.height, int64(tcase.index)))
cur.Height = tcase.height cur.Height = tcase.height
cur.Index = int32(tcase.index) cur.Index = int32(tcase.index)
value := types.Encode(cur) value := types.Encode(cur)
kvdb.Set(key, value) kvdb.Set(key, value)
} }
// 反向查找 // 反向查找
req := &auty.ReqQueryProposalComment{ req := &auty.ReqQueryProposalComment{
ProposalID:propID2, ProposalID: propID2,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err := au.listProposalComment(req) rsp, err := au.listProposalComment(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -377,10 +378,10 @@ func TestListProposalComment(t *testing.T) { ...@@ -377,10 +378,10 @@ func TestListProposalComment(t *testing.T) {
// 正向查找 // 正向查找
req = &auty.ReqQueryProposalComment{ req = &auty.ReqQueryProposalComment{
ProposalID:propID2, ProposalID: propID2,
Count:10, Count: 10,
Direction:1, Direction: 1,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalComment(req) rsp, err = au.listProposalComment(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -392,10 +393,10 @@ func TestListProposalComment(t *testing.T) { ...@@ -392,10 +393,10 @@ func TestListProposalComment(t *testing.T) {
// 翻页查找 // 翻页查找
req = &auty.ReqQueryProposalComment{ req = &auty.ReqQueryProposalComment{
ProposalID:propID2, ProposalID: propID2,
Count:1, Count: 1,
Direction:0, Direction: 0,
Index: -1, Index: -1,
} }
rsp, err = au.listProposalComment(req) rsp, err = au.listProposalComment(req)
require.NoError(t, err) require.NoError(t, err)
...@@ -407,10 +408,10 @@ func TestListProposalComment(t *testing.T) { ...@@ -407,10 +408,10 @@ func TestListProposalComment(t *testing.T) {
// //
Index := height*types.MaxTxsPerBlock + int64(index) Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalComment{ req = &auty.ReqQueryProposalComment{
ProposalID:propID2, ProposalID: propID2,
Count:10, Count: 10,
Direction:0, Direction: 0,
Index: Index, Index: Index,
} }
rsp, err = au.listProposalComment(req) rsp, err = au.listProposalComment(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalComment).RltCmt), 2) require.Equal(t, len(rsp.(*auty.ReplyQueryProposalComment).RltCmt), 2)
......
...@@ -12,25 +12,23 @@ import ( ...@@ -12,25 +12,23 @@ import (
"github.com/33cn/chain33/system/dapp" "github.com/33cn/chain33/system/dapp"
) )
func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) { func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
//如果全小于等于0,则说明该提案规则参数不正确 //如果全小于等于0,则说明该提案规则参数不正确
if prob.RuleCfg == nil || prob.RuleCfg.BoardAttendRatio <= 0 && prob.RuleCfg.BoardApproveRatio <= 0 && if prob.RuleCfg == nil || prob.RuleCfg.BoardAttendRatio <= 0 && prob.RuleCfg.BoardApproveRatio <= 0 &&
prob.RuleCfg.PubOpposeRatio <= 0 && prob.RuleCfg.ProposalAmount <= 0 && prob.RuleCfg.LargeProjectAmount <= 0 && prob.RuleCfg.PubOpposeRatio <= 0 && prob.RuleCfg.ProposalAmount <= 0 && prob.RuleCfg.LargeProjectAmount <= 0 &&
prob.RuleCfg.PublicPeriod <= 0 { prob.RuleCfg.PublicPeriod <= 0 {
alog.Error("propRule ", "ProposalRule RuleCfg invaild or have no modify param", prob.RuleCfg) alog.Error("propRule ", "ProposalRule RuleCfg invaild or have no modify param", prob.RuleCfg)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
if prob.RuleCfg.BoardAttendRatio > 100 || prob.RuleCfg.BoardApproveRatio > 100 || prob.RuleCfg.PubOpposeRatio > 100 { if prob.RuleCfg.BoardAttendRatio > 100 || prob.RuleCfg.BoardApproveRatio > 100 || prob.RuleCfg.PubOpposeRatio > 100 {
alog.Error("propRule RuleCfg invaild", "BoardAttendRatio", prob.RuleCfg.BoardAttendRatio, "BoardApproveRatio", alog.Error("propRule RuleCfg invaild", "BoardAttendRatio", prob.RuleCfg.BoardAttendRatio, "BoardApproveRatio",
prob.RuleCfg.BoardApproveRatio, "PubOpposeRatio", prob.RuleCfg.PubOpposeRatio) prob.RuleCfg.BoardApproveRatio, "PubOpposeRatio", prob.RuleCfg.PubOpposeRatio)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height { if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height {
alog.Error("propRule height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight", alog.Error("propRule height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight",
prob.EndBlockHeight, "height", a.height) prob.EndBlockHeight, "height", a.height)
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
// 获取当前生效提案规则,并且将不修改的规则补齐 // 获取当前生效提案规则,并且将不修改的规则补齐
...@@ -53,13 +51,13 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) { ...@@ -53,13 +51,13 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule:prob, PropRule: prob,
CurRule: rule, CurRule: rule,
VoteResult: &auty.VoteResult{}, VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule, Status: auty.AutonomyStatusProposalRule,
Address: a.fromaddr, Address: a.fromaddr,
Height: a.height, Height: a.height,
Index: a.index, Index: a.index,
} }
key := propRuleID(common.ToHex(a.txhash)) key := propRuleID(common.ToHex(a.txhash))
...@@ -164,12 +162,12 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -164,12 +162,12 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
votes.Address = append(votes.Address, a.fromaddr) votes.Address = append(votes.Address, a.fromaddr)
if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数 if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数
addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp" addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account, err := a.getStartHeightVoteAccount(addr, start) account, err := a.getStartHeightVoteAccount(addr, start)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice) cur.VoteResult.TotalVotes = int32(account.Balance / ticketPrice)
} }
// 获取可投票数 // 获取可投票数
...@@ -178,9 +176,9 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -178,9 +176,9 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
return nil, err return nil, err
} }
if voteProb.Approve { if voteProb.Approve {
cur.VoteResult.ApproveVotes += int32(account.Balance/ticketPrice) cur.VoteResult.ApproveVotes += int32(account.Balance / ticketPrice)
} else { } else {
cur.VoteResult.OpposeVotes += int32(account.Balance/ticketPrice) cur.VoteResult.OpposeVotes += int32(account.Balance / ticketPrice)
} }
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
...@@ -198,9 +196,9 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -198,9 +196,9 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
} }
if cur.VoteResult.TotalVotes != 0 && if cur.VoteResult.TotalVotes != 0 &&
cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes != 0 && cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes != 0 &&
float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 && float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 { float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true cur.VoteResult.Pass = true
cur.PropRule.RealEndBlockHeight = a.height cur.PropRule.RealEndBlockHeight = a.height
} }
...@@ -218,7 +216,7 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt, ...@@ -218,7 +216,7 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
// 更新系统规则 // 更新系统规则
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg) upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg)
kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value:types.Encode(upRule)}) kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value: types.Encode(upRule)})
} }
ty := auty.TyLogVotePropRule ty := auty.TyLogVotePropRule
...@@ -265,11 +263,11 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re ...@@ -265,11 +263,11 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
if err != nil { if err != nil {
return nil, err return nil, err
} }
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice) cur.VoteResult.TotalVotes = int32(account.Balance / ticketPrice)
} }
if float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 && if float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes)/float32(cur.VoteResult.TotalVotes) >= float32(pubAttendRatio)/100.0 &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 { float32(cur.VoteResult.ApproveVotes)/float32(cur.VoteResult.ApproveVotes+cur.VoteResult.OpposeVotes) >= float32(pubApproveRatio)/100.0 {
cur.VoteResult.Pass = true cur.VoteResult.Pass = true
} else { } else {
cur.VoteResult.Pass = false cur.VoteResult.Pass = false
...@@ -298,7 +296,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re ...@@ -298,7 +296,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
// 更新系统规则 // 更新系统规则
if cur.VoteResult.Pass { if cur.VoteResult.Pass {
upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg) upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg)
kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value:types.Encode(upRule)}) kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value: types.Encode(upRule)})
} }
receiptLog := getRuleReceiptLog(pre, cur, auty.TyLogTmintPropRule) receiptLog := getRuleReceiptLog(pre, cur, auty.TyLogTmintPropRule)
logs = append(logs, receiptLog) logs = append(logs, receiptLog)
...@@ -307,7 +305,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re ...@@ -307,7 +305,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
} }
func (a *action) transfer(tf *auty.TransferFund) (*types.Receipt, error) { func (a *action) transfer(tf *auty.TransferFund) (*types.Receipt, error) {
if a.execaddr != dapp.ExecAddress(string(auty.AutonomyX)) { if a.execaddr != dapp.ExecAddress(string(auty.AutonomyX)) {
err := auty.ErrNoAutonomyExec err := auty.ErrNoAutonomyExec
alog.Error("autonomy transfer ", "addr", a.fromaddr, "execaddr", a.execaddr, "this exec is not autonomy", err) alog.Error("autonomy transfer ", "addr", a.fromaddr, "execaddr", a.execaddr, "this exec is not autonomy", err)
return nil, err return nil, err
...@@ -342,7 +340,7 @@ func (a *action) commentProp(cm *auty.Comment) (*types.Receipt, error) { ...@@ -342,7 +340,7 @@ func (a *action) commentProp(cm *auty.Comment) (*types.Receipt, error) {
func getCommentReceiptLog(cur *auty.Comment, height int64, index int32, ty int32) *types.ReceiptLog { func getCommentReceiptLog(cur *auty.Comment, height int64, index int32, ty int32) *types.ReceiptLog {
log := &types.ReceiptLog{} log := &types.ReceiptLog{}
log.Ty = ty log.Ty = ty
r := &auty.ReceiptProposalComment{Cmt: cur, Height:height, Index:index} r := &auty.ReceiptProposalComment{Cmt: cur, Height: height, Index: index}
log.Log = types.Encode(r) log.Log = types.Encode(r)
return log return log
} }
...@@ -419,5 +417,3 @@ func upgradeRule(cur, modify *auty.RuleConfig) *auty.RuleConfig { ...@@ -419,5 +417,3 @@ func upgradeRule(cur, modify *auty.RuleConfig) *auty.RuleConfig {
} }
return &new return &new
} }
...@@ -7,17 +7,17 @@ package executor ...@@ -7,17 +7,17 @@ package executor
import ( import (
"testing" "testing"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types" "github.com/33cn/chain33/account"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/types"
apimock "github.com/33cn/chain33/client/mocks" apimock "github.com/33cn/chain33/client/mocks"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/account"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/stretchr/testify/mock"
"github.com/33cn/chain33/common/address"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
) )
const ( const (
...@@ -54,21 +54,20 @@ func TestTerminateProposalRule(t *testing.T) { ...@@ -54,21 +54,20 @@ func TestTerminateProposalRule(t *testing.T) {
} }
func testPropRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func testPropRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
opt1 := &auty.ProposalRule{ opt1 := &auty.ProposalRule{
Year: 2019, Year: 2019,
Month: 7, Month: 7,
Day: 10, Day: 10,
RuleCfg: &auty.RuleConfig{ RuleCfg: &auty.RuleConfig{
BoardAttendRatio: testBoardAttendRatio, BoardAttendRatio: testBoardAttendRatio,
BoardApproveRatio: testBoardApproveRatio, BoardApproveRatio: testBoardApproveRatio,
PubOpposeRatio: testPubOpposeRatio, PubOpposeRatio: testPubOpposeRatio,
ProposalAmount: testProposalAmount, ProposalAmount: testProposalAmount,
LargeProjectAmount: testLargeProjectAmount, LargeProjectAmount: testLargeProjectAmount,
PublicPeriod:testPublicPeriod, PublicPeriod: testPublicPeriod,
},
}, StartBlockHeight: env.blockHeight + 5,
StartBlockHeight: env.blockHeight + 5, EndBlockHeight: env.blockHeight + 10,
EndBlockHeight: env.blockHeight + 10,
} }
pbtx, err := propRuleTx(opt1) pbtx, err := propRuleTx(opt1)
require.NoError(t, err) require.NoError(t, err)
...@@ -124,8 +123,8 @@ func propRuleTx(parm *auty.ProposalRule) (*types.Transaction, error) { ...@@ -124,8 +123,8 @@ func propRuleTx(parm *auty.ProposalRule) (*types.Transaction, error) {
func revokeProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) { func revokeProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB dbm.KV, kvdb dbm.KVDB, save bool) {
proposalID := env.txHash proposalID := env.txHash
opt2 := &auty.RevokeProposalRule{ opt2 := &auty.RevokeProposalRule{
ProposalID:proposalID, ProposalID: proposalID,
} }
rtx, err := revokeProposalRuleTx(opt2) rtx, err := revokeProposalRuleTx(opt2)
require.NoError(t, err) require.NoError(t, err)
...@@ -171,7 +170,7 @@ func revokeProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB ...@@ -171,7 +170,7 @@ func revokeProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB
require.Equal(t, rule.BoardAttendRatio, boardAttendRatio) require.Equal(t, rule.BoardAttendRatio, boardAttendRatio)
require.Equal(t, rule.BoardApproveRatio, boardApproveRatio) require.Equal(t, rule.BoardApproveRatio, boardApproveRatio)
require.Equal(t, rule.PubOpposeRatio, pubOpposeRatio) require.Equal(t, rule.PubOpposeRatio, pubOpposeRatio)
require.Equal(t, rule.ProposalAmount , proposalAmount) require.Equal(t, rule.ProposalAmount, proposalAmount)
require.Equal(t, rule.LargeProjectAmount, largeProjectAmount) require.Equal(t, rule.LargeProjectAmount, largeProjectAmount)
require.Equal(t, rule.PublicPeriod, publicPeriod) require.Equal(t, rule.PublicPeriod, publicPeriod)
} }
...@@ -194,22 +193,22 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d ...@@ -194,22 +193,22 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
acc = &types.Account{ acc = &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val1 := types.Encode(acc) val1 := types.Encode(acc)
values1 := [][]byte{val1} values1 := [][]byte{val1}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values1}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values1}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
...@@ -226,9 +225,9 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d ...@@ -226,9 +225,9 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d
} }
for _, record := range records { for _, record := range records {
opt := &auty.VoteProposalRule{ opt := &auty.VoteProposalRule{
ProposalID:proposalID, ProposalID: proposalID,
Approve: record.appr, Approve: record.appr,
} }
tx, err := voteProposalRuleTx(opt) tx, err := voteProposalRuleTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -262,11 +261,11 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d ...@@ -262,11 +261,11 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d
// 每次需要重新设置 // 每次需要重新设置
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total, Balance: total,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
} }
// check // check
...@@ -298,7 +297,7 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d ...@@ -298,7 +297,7 @@ func voteProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stateDB d
require.Equal(t, rule.BoardAttendRatio, testBoardAttendRatio) require.Equal(t, rule.BoardAttendRatio, testBoardAttendRatio)
require.Equal(t, rule.BoardApproveRatio, testBoardApproveRatio) require.Equal(t, rule.BoardApproveRatio, testBoardApproveRatio)
require.Equal(t, rule.PubOpposeRatio, testPubOpposeRatio) require.Equal(t, rule.PubOpposeRatio, testPubOpposeRatio)
require.Equal(t, rule.ProposalAmount , proposalAmount) require.Equal(t, rule.ProposalAmount, proposalAmount)
require.Equal(t, rule.LargeProjectAmount, testLargeProjectAmount) require.Equal(t, rule.LargeProjectAmount, testLargeProjectAmount)
require.Equal(t, rule.PublicPeriod, testPublicPeriod) require.Equal(t, rule.PublicPeriod, testPublicPeriod)
} }
...@@ -321,19 +320,19 @@ func terminateProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stat ...@@ -321,19 +320,19 @@ func terminateProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stat
hear := &types.Header{StateHash: []byte("")} hear := &types.Header{StateHash: []byte("")}
api.On("GetHeaders", mock.Anything). api.On("GetHeaders", mock.Anything).
Return(&types.Headers{ Return(&types.Headers{
Items:[]*types.Header{hear}}, nil) Items: []*types.Header{hear}}, nil)
acc := &types.Account{ acc := &types.Account{
Currency: 0, Currency: 0,
Balance: total*4, Balance: total * 4,
} }
val := types.Encode(acc) val := types.Encode(acc)
values := [][]byte{val} values := [][]byte{val}
api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values:values}, nil).Once() api.On("StoreGet", mock.Anything).Return(&types.StoreReplyValue{Values: values}, nil).Once()
exec.SetAPI(api) exec.SetAPI(api)
proposalID := env.txHash proposalID := env.txHash
opt := &auty.TerminateProposalRule{ opt := &auty.TerminateProposalRule{
ProposalID:proposalID, ProposalID: proposalID,
} }
tx, err := terminateProposalRuleTx(opt) tx, err := terminateProposalRuleTx(opt)
require.NoError(t, err) require.NoError(t, err)
...@@ -380,7 +379,7 @@ func terminateProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stat ...@@ -380,7 +379,7 @@ func terminateProposalRule(t *testing.T, env *execEnv, exec drivers.Driver, stat
require.Equal(t, rule.BoardAttendRatio, boardAttendRatio) require.Equal(t, rule.BoardAttendRatio, boardAttendRatio)
require.Equal(t, rule.BoardApproveRatio, boardApproveRatio) require.Equal(t, rule.BoardApproveRatio, boardApproveRatio)
require.Equal(t, rule.PubOpposeRatio, pubOpposeRatio) require.Equal(t, rule.PubOpposeRatio, pubOpposeRatio)
require.Equal(t, rule.ProposalAmount , proposalAmount) require.Equal(t, rule.ProposalAmount, proposalAmount)
require.Equal(t, rule.LargeProjectAmount, largeProjectAmount) require.Equal(t, rule.LargeProjectAmount, largeProjectAmount)
require.Equal(t, rule.PublicPeriod, publicPeriod) require.Equal(t, rule.PublicPeriod, publicPeriod)
} }
...@@ -398,16 +397,16 @@ func terminateProposalRuleTx(parm *auty.TerminateProposalRule) (*types.Transacti ...@@ -398,16 +397,16 @@ func terminateProposalRuleTx(parm *auty.TerminateProposalRule) (*types.Transacti
func TestGetRuleReceiptLog(t *testing.T) { func TestGetRuleReceiptLog(t *testing.T) {
pre := &auty.AutonomyProposalRule{ pre := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{Year: 1800, Month: 1}, PropRule: &auty.ProposalRule{Year: 1800, Month: 1},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 1, Status: 1,
Address:"121", Address: "121",
} }
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{Year: 1900, Month: 1}, PropRule: &auty.ProposalRule{Year: 1900, Month: 1},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
log := getRuleReceiptLog(pre, cur, 2) log := getRuleReceiptLog(pre, cur, 2)
require.Equal(t, int32(2), log.Ty) require.Equal(t, int32(2), log.Ty)
...@@ -421,11 +420,11 @@ func TestGetRuleReceiptLog(t *testing.T) { ...@@ -421,11 +420,11 @@ func TestGetRuleReceiptLog(t *testing.T) {
func TestCopyAutonomyProposalRule(t *testing.T) { func TestCopyAutonomyProposalRule(t *testing.T) {
require.Nil(t, copyAutonomyProposalRule(nil)) require.Nil(t, copyAutonomyProposalRule(nil))
cur := &auty.AutonomyProposalRule{ cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{Year: 1900, Month: 1, RuleCfg:&auty.RuleConfig{BoardApproveRatio:80}}, PropRule: &auty.ProposalRule{Year: 1900, Month: 1, RuleCfg: &auty.RuleConfig{BoardApproveRatio: 80}},
CurRule: &auty.RuleConfig{BoardApproveRatio:100}, CurRule: &auty.RuleConfig{BoardApproveRatio: 100},
VoteResult: &auty.VoteResult{TotalVotes: 100}, VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2, Status: 2,
Address:"123", Address: "123",
} }
pre := copyAutonomyProposalRule(cur) pre := copyAutonomyProposalRule(cur)
cur.PropRule.Year = 1800 cur.PropRule.Year = 1800
...@@ -449,44 +448,44 @@ func TestUpgradeRule(t *testing.T) { ...@@ -449,44 +448,44 @@ func TestUpgradeRule(t *testing.T) {
new := upgradeRule(nil, &auty.RuleConfig{}) new := upgradeRule(nil, &auty.RuleConfig{})
require.Nil(t, new) require.Nil(t, new)
cur := &auty.RuleConfig{ cur := &auty.RuleConfig{
BoardAttendRatio: 1, BoardAttendRatio: 1,
BoardApproveRatio: 2, BoardApproveRatio: 2,
PubOpposeRatio: 3, PubOpposeRatio: 3,
ProposalAmount: 4, ProposalAmount: 4,
LargeProjectAmount: 5, LargeProjectAmount: 5,
PublicPeriod: 6, PublicPeriod: 6,
} }
modify := &auty.RuleConfig{ modify := &auty.RuleConfig{
BoardAttendRatio: 0, BoardAttendRatio: 0,
BoardApproveRatio: -1, BoardApproveRatio: -1,
PubOpposeRatio: 0, PubOpposeRatio: 0,
ProposalAmount: -1, ProposalAmount: -1,
LargeProjectAmount: 0, LargeProjectAmount: 0,
PublicPeriod: 0, PublicPeriod: 0,
} }
new = upgradeRule(cur, modify) new = upgradeRule(cur, modify)
require.NotNil(t, new) require.NotNil(t, new)
require.Equal(t, new.BoardAttendRatio, cur.BoardAttendRatio) require.Equal(t, new.BoardAttendRatio, cur.BoardAttendRatio)
require.Equal(t, new.BoardApproveRatio, cur.BoardApproveRatio) require.Equal(t, new.BoardApproveRatio, cur.BoardApproveRatio)
require.Equal(t, new.PubOpposeRatio, cur.PubOpposeRatio) require.Equal(t, new.PubOpposeRatio, cur.PubOpposeRatio)
require.Equal(t, new.ProposalAmount , cur.ProposalAmount) require.Equal(t, new.ProposalAmount, cur.ProposalAmount)
require.Equal(t, new.LargeProjectAmount, cur.LargeProjectAmount) require.Equal(t, new.LargeProjectAmount, cur.LargeProjectAmount)
require.Equal(t, new.PublicPeriod, cur.PublicPeriod) require.Equal(t, new.PublicPeriod, cur.PublicPeriod)
modify = &auty.RuleConfig{ modify = &auty.RuleConfig{
BoardAttendRatio: 10, BoardAttendRatio: 10,
BoardApproveRatio: 20, BoardApproveRatio: 20,
PubOpposeRatio: 30, PubOpposeRatio: 30,
ProposalAmount: 40, ProposalAmount: 40,
LargeProjectAmount: 50, LargeProjectAmount: 50,
PublicPeriod: 60, PublicPeriod: 60,
} }
new = upgradeRule(cur, modify) new = upgradeRule(cur, modify)
require.NotNil(t, new) require.NotNil(t, new)
require.Equal(t, new.BoardAttendRatio, modify.BoardAttendRatio) require.Equal(t, new.BoardAttendRatio, modify.BoardAttendRatio)
require.Equal(t, new.BoardApproveRatio, modify.BoardApproveRatio) require.Equal(t, new.BoardApproveRatio, modify.BoardApproveRatio)
require.Equal(t, new.PubOpposeRatio, modify.PubOpposeRatio) require.Equal(t, new.PubOpposeRatio, modify.PubOpposeRatio)
require.Equal(t, new.ProposalAmount , modify.ProposalAmount) require.Equal(t, new.ProposalAmount, modify.ProposalAmount)
require.Equal(t, new.LargeProjectAmount, modify.LargeProjectAmount) require.Equal(t, new.LargeProjectAmount, modify.LargeProjectAmount)
require.Equal(t, new.PublicPeriod, modify.PublicPeriod) require.Equal(t, new.PublicPeriod, modify.PublicPeriod)
} }
...@@ -494,7 +493,7 @@ func TestUpgradeRule(t *testing.T) { ...@@ -494,7 +493,7 @@ func TestUpgradeRule(t *testing.T) {
func TestTransfer(t *testing.T) { func TestTransfer(t *testing.T) {
env, exec, stateDB, _ := InitEnv() env, exec, stateDB, _ := InitEnv()
opt1 := &auty.TransferFund{ opt1 := &auty.TransferFund{
Amount: types.Coin * 190, Amount: types.Coin * 190,
} }
pbtx, err := transferFundTx(opt1) pbtx, err := transferFundTx(opt1)
...@@ -514,9 +513,9 @@ func TestTransfer(t *testing.T) { ...@@ -514,9 +513,9 @@ func TestTransfer(t *testing.T) {
accCoin := account.NewCoinsAccount() accCoin := account.NewCoinsAccount()
accCoin.SetDB(stateDB) accCoin.SetDB(stateDB)
account := accCoin.LoadExecAccount(AddrA, address.ExecAddress(auty.AutonomyX)) account := accCoin.LoadExecAccount(AddrA, address.ExecAddress(auty.AutonomyX))
require.Equal(t, total - types.Coin * 190, account.Balance) require.Equal(t, total-types.Coin*190, account.Balance)
account = accCoin.LoadExecAccount(autonomyFundAddr, address.ExecAddress(auty.AutonomyX)) account = accCoin.LoadExecAccount(autonomyFundAddr, address.ExecAddress(auty.AutonomyX))
require.Equal(t, types.Coin * 190, account.Balance) require.Equal(t, types.Coin*190, account.Balance)
} }
func transferFundTx(parm *auty.TransferFund) (*types.Transaction, error) { func transferFundTx(parm *auty.TransferFund) (*types.Transaction, error) {
...@@ -536,10 +535,10 @@ func TestComment(t *testing.T) { ...@@ -536,10 +535,10 @@ func TestComment(t *testing.T) {
propID := "11111111111111" propID := "11111111111111"
Repcmt := "2222222222" Repcmt := "2222222222"
comment := "3333333333" comment := "3333333333"
opt1 := &auty.Comment{ opt1 := &auty.Comment{
ProposalID: propID, ProposalID: propID,
RepCmtHash: Repcmt, RepCmtHash: Repcmt,
Comment:comment, Comment: comment,
} }
pbtx, err := commentPropTx(opt1) pbtx, err := commentPropTx(opt1)
require.NoError(t, err) require.NoError(t, err)
...@@ -582,4 +581,4 @@ func commentPropTx(parm *auty.Comment) (*types.Transaction, error) { ...@@ -582,4 +581,4 @@ func commentPropTx(parm *auty.Comment) (*types.Transaction, error) {
Value: &auty.AutonomyAction_CommentProp{CommentProp: parm}, Value: &auty.AutonomyAction_CommentProp{CommentProp: parm},
} }
return types.CreateFormatTx(types.ExecName(auty.AutonomyX), types.Encode(val)) return types.CreateFormatTx(types.ExecName(auty.AutonomyX), types.Encode(val))
} }
\ No newline at end of file
...@@ -9,10 +9,10 @@ import ( ...@@ -9,10 +9,10 @@ import (
"github.com/33cn/chain33/rpc/jsonclient" "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
_ "github.com/33cn/plugin/plugin" _ "github.com/33cn/plugin/plugin"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
) )
func testPropBoardTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testPropBoardTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
...@@ -58,4 +58,3 @@ func testListProposalBoardCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { ...@@ -58,4 +58,3 @@ func testListProposalBoardCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
rep = &auty.ReplyQueryProposalBoard{} rep = &auty.ReplyQueryProposalBoard{}
return jrpc.Call("Chain33.Query", params, rep) return jrpc.Call("Chain33.Query", params, rep)
} }
...@@ -213,4 +213,4 @@ func (c *Jrpc) CommentProposalTx(parm *auty.Comment, result *interface{}) error ...@@ -213,4 +213,4 @@ func (c *Jrpc) CommentProposalTx(parm *auty.Comment, result *interface{}) error
*result = hex.EncodeToString(reply.Data) *result = hex.EncodeToString(reply.Data)
return nil return nil
} }
\ No newline at end of file
...@@ -9,13 +9,12 @@ import ( ...@@ -9,13 +9,12 @@ import (
"github.com/33cn/chain33/rpc/jsonclient" "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
_ "github.com/33cn/plugin/plugin" _ "github.com/33cn/plugin/plugin"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
) )
func testPropProjectTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testPropProjectTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
params := &auty.ProposalProject{} params := &auty.ProposalProject{}
var res string var res string
...@@ -65,4 +64,3 @@ func testListProposalProjectCmd(t *testing.T, jrpc *jsonclient.JSONClient) error ...@@ -65,4 +64,3 @@ func testListProposalProjectCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
rep = &auty.ReplyQueryProposalProject{} rep = &auty.ReplyQueryProposalProject{}
return jrpc.Call("Chain33.Query", params, rep) return jrpc.Call("Chain33.Query", params, rep)
} }
...@@ -237,4 +237,4 @@ func (c *channelClient) commentProposal(ctx context.Context, head *auty.Comment) ...@@ -237,4 +237,4 @@ func (c *channelClient) commentProposal(ctx context.Context, head *auty.Comment)
return nil, err return nil, err
} }
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
\ No newline at end of file
...@@ -9,10 +9,10 @@ import ( ...@@ -9,10 +9,10 @@ import (
"github.com/33cn/chain33/rpc/jsonclient" "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
_ "github.com/33cn/plugin/plugin" _ "github.com/33cn/plugin/plugin"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
) )
func testPropRuleTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testPropRuleTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
...@@ -79,4 +79,4 @@ func testListProposalCommentCmd(t *testing.T, jrpc *jsonclient.JSONClient) error ...@@ -79,4 +79,4 @@ func testListProposalCommentCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
params.Payload = types.MustPBToJSON(req) params.Payload = types.MustPBToJSON(req)
rep = &auty.ReplyQueryProposalComment{} rep = &auty.ReplyQueryProposalComment{}
return jrpc.Call("Chain33.Query", params, rep) return jrpc.Call("Chain33.Query", params, rep)
} }
\ No newline at end of file
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: autonomy.proto // 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
ReqQueryProposalBoard
ReplyQueryProposalBoard
VoteResult
PublicVote
VotesRecord
RuleConfig
AutonomyProposalProject
ProposalProject
RevokeProposalProject
VoteProposalProject
PubVoteProposalProject
TerminateProposalProject
ReceiptProposalProject
LocalProposalProject
ReqQueryProposalProject
ReplyQueryProposalProject
AutonomyProposalRule
ProposalRule
RevokeProposalRule
VoteProposalRule
TerminateProposalRule
ReceiptProposalRule
LocalProposalRule
ReqQueryProposalRule
ReplyQueryProposalRule
TransferFund
Comment
ReceiptProposalComment
ReqQueryProposalComment
RelationCmt
ReplyQueryProposalComment
*/
package types package types
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
...@@ -87,80 +39,131 @@ type AutonomyAction struct { ...@@ -87,80 +39,131 @@ type AutonomyAction struct {
// *AutonomyAction_TmintPropRule // *AutonomyAction_TmintPropRule
// *AutonomyAction_Transfer // *AutonomyAction_Transfer
// *AutonomyAction_CommentProp // *AutonomyAction_CommentProp
Value isAutonomyAction_Value `protobuf_oneof:"value"` Value isAutonomyAction_Value `protobuf_oneof:"value"`
Ty int32 `protobuf:"varint,16,opt,name=ty" json:"ty,omitempty"` Ty int32 `protobuf:"varint,16,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AutonomyAction) Reset() { *m = AutonomyAction{} }
func (m *AutonomyAction) String() string { return proto.CompactTextString(m) }
func (*AutonomyAction) ProtoMessage() {}
func (*AutonomyAction) Descriptor() ([]byte, []int) {
return fileDescriptor_0246b47df8434d60, []int{0}
}
func (m *AutonomyAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutonomyAction.Unmarshal(m, b)
}
func (m *AutonomyAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutonomyAction.Marshal(b, m, deterministic)
}
func (m *AutonomyAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutonomyAction.Merge(m, src)
}
func (m *AutonomyAction) XXX_Size() int {
return xxx_messageInfo_AutonomyAction.Size(m)
}
func (m *AutonomyAction) XXX_DiscardUnknown() {
xxx_messageInfo_AutonomyAction.DiscardUnknown(m)
} }
func (m *AutonomyAction) Reset() { *m = AutonomyAction{} } var xxx_messageInfo_AutonomyAction proto.InternalMessageInfo
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 { type isAutonomyAction_Value interface {
isAutonomyAction_Value() isAutonomyAction_Value()
} }
type AutonomyAction_PropBoard struct { type AutonomyAction_PropBoard struct {
PropBoard *ProposalBoard `protobuf:"bytes,1,opt,name=propBoard,oneof"` PropBoard *ProposalBoard `protobuf:"bytes,1,opt,name=propBoard,proto3,oneof"`
} }
type AutonomyAction_RvkPropBoard struct { type AutonomyAction_RvkPropBoard struct {
RvkPropBoard *RevokeProposalBoard `protobuf:"bytes,2,opt,name=rvkPropBoard,oneof"` RvkPropBoard *RevokeProposalBoard `protobuf:"bytes,2,opt,name=rvkPropBoard,proto3,oneof"`
} }
type AutonomyAction_VotePropBoard struct { type AutonomyAction_VotePropBoard struct {
VotePropBoard *VoteProposalBoard `protobuf:"bytes,3,opt,name=votePropBoard,oneof"` VotePropBoard *VoteProposalBoard `protobuf:"bytes,3,opt,name=votePropBoard,proto3,oneof"`
} }
type AutonomyAction_TmintPropBoard struct { type AutonomyAction_TmintPropBoard struct {
TmintPropBoard *TerminateProposalBoard `protobuf:"bytes,4,opt,name=tmintPropBoard,oneof"` TmintPropBoard *TerminateProposalBoard `protobuf:"bytes,4,opt,name=tmintPropBoard,proto3,oneof"`
} }
type AutonomyAction_PropProject struct { type AutonomyAction_PropProject struct {
PropProject *ProposalProject `protobuf:"bytes,5,opt,name=propProject,oneof"` PropProject *ProposalProject `protobuf:"bytes,5,opt,name=propProject,proto3,oneof"`
} }
type AutonomyAction_RvkPropProject struct { type AutonomyAction_RvkPropProject struct {
RvkPropProject *RevokeProposalProject `protobuf:"bytes,6,opt,name=rvkPropProject,oneof"` RvkPropProject *RevokeProposalProject `protobuf:"bytes,6,opt,name=rvkPropProject,proto3,oneof"`
} }
type AutonomyAction_VotePropProject struct { type AutonomyAction_VotePropProject struct {
VotePropProject *VoteProposalProject `protobuf:"bytes,7,opt,name=votePropProject,oneof"` VotePropProject *VoteProposalProject `protobuf:"bytes,7,opt,name=votePropProject,proto3,oneof"`
} }
type AutonomyAction_PubVotePropProject struct { type AutonomyAction_PubVotePropProject struct {
PubVotePropProject *PubVoteProposalProject `protobuf:"bytes,8,opt,name=pubVotePropProject,oneof"` PubVotePropProject *PubVoteProposalProject `protobuf:"bytes,8,opt,name=pubVotePropProject,proto3,oneof"`
} }
type AutonomyAction_TmintPropProject struct { type AutonomyAction_TmintPropProject struct {
TmintPropProject *TerminateProposalProject `protobuf:"bytes,9,opt,name=tmintPropProject,oneof"` TmintPropProject *TerminateProposalProject `protobuf:"bytes,9,opt,name=tmintPropProject,proto3,oneof"`
} }
type AutonomyAction_PropRule struct { type AutonomyAction_PropRule struct {
PropRule *ProposalRule `protobuf:"bytes,10,opt,name=propRule,oneof"` PropRule *ProposalRule `protobuf:"bytes,10,opt,name=propRule,proto3,oneof"`
} }
type AutonomyAction_RvkPropRule struct { type AutonomyAction_RvkPropRule struct {
RvkPropRule *RevokeProposalRule `protobuf:"bytes,11,opt,name=rvkPropRule,oneof"` RvkPropRule *RevokeProposalRule `protobuf:"bytes,11,opt,name=rvkPropRule,proto3,oneof"`
} }
type AutonomyAction_VotePropRule struct { type AutonomyAction_VotePropRule struct {
VotePropRule *VoteProposalRule `protobuf:"bytes,12,opt,name=votePropRule,oneof"` VotePropRule *VoteProposalRule `protobuf:"bytes,12,opt,name=votePropRule,proto3,oneof"`
} }
type AutonomyAction_TmintPropRule struct { type AutonomyAction_TmintPropRule struct {
TmintPropRule *TerminateProposalRule `protobuf:"bytes,13,opt,name=tmintPropRule,oneof"` TmintPropRule *TerminateProposalRule `protobuf:"bytes,13,opt,name=tmintPropRule,proto3,oneof"`
} }
type AutonomyAction_Transfer struct { type AutonomyAction_Transfer struct {
Transfer *TransferFund `protobuf:"bytes,14,opt,name=transfer,oneof"` Transfer *TransferFund `protobuf:"bytes,14,opt,name=transfer,proto3,oneof"`
} }
type AutonomyAction_CommentProp struct { type AutonomyAction_CommentProp struct {
CommentProp *Comment `protobuf:"bytes,15,opt,name=commentProp,oneof"` CommentProp *Comment `protobuf:"bytes,15,opt,name=commentProp,proto3,oneof"`
} }
func (*AutonomyAction_PropBoard) isAutonomyAction_Value() {} func (*AutonomyAction_PropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropBoard) isAutonomyAction_Value() {} func (*AutonomyAction_RvkPropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_PropProject) isAutonomyAction_Value() {} func (*AutonomyAction_VotePropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropProject) isAutonomyAction_Value() {} func (*AutonomyAction_TmintPropBoard) isAutonomyAction_Value() {}
func (*AutonomyAction_PropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_PubVotePropProject) isAutonomyAction_Value() {} func (*AutonomyAction_PubVotePropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_PropRule) isAutonomyAction_Value() {} func (*AutonomyAction_TmintPropProject) isAutonomyAction_Value() {}
func (*AutonomyAction_RvkPropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropRule) isAutonomyAction_Value() {} func (*AutonomyAction_PropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_Transfer) isAutonomyAction_Value() {} func (*AutonomyAction_RvkPropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_CommentProp) isAutonomyAction_Value() {}
func (*AutonomyAction_VotePropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_TmintPropRule) isAutonomyAction_Value() {}
func (*AutonomyAction_Transfer) isAutonomyAction_Value() {}
func (*AutonomyAction_CommentProp) isAutonomyAction_Value() {}
func (m *AutonomyAction) GetValue() isAutonomyAction_Value { func (m *AutonomyAction) GetValue() isAutonomyAction_Value {
if m != nil { if m != nil {
...@@ -522,77 +525,77 @@ func _AutonomyAction_OneofSizer(msg proto.Message) (n int) { ...@@ -522,77 +525,77 @@ func _AutonomyAction_OneofSizer(msg proto.Message) (n int) {
switch x := m.Value.(type) { switch x := m.Value.(type) {
case *AutonomyAction_PropBoard: case *AutonomyAction_PropBoard:
s := proto.Size(x.PropBoard) s := proto.Size(x.PropBoard)
n += proto.SizeVarint(1<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_RvkPropBoard: case *AutonomyAction_RvkPropBoard:
s := proto.Size(x.RvkPropBoard) s := proto.Size(x.RvkPropBoard)
n += proto.SizeVarint(2<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_VotePropBoard: case *AutonomyAction_VotePropBoard:
s := proto.Size(x.VotePropBoard) s := proto.Size(x.VotePropBoard)
n += proto.SizeVarint(3<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_TmintPropBoard: case *AutonomyAction_TmintPropBoard:
s := proto.Size(x.TmintPropBoard) s := proto.Size(x.TmintPropBoard)
n += proto.SizeVarint(4<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_PropProject: case *AutonomyAction_PropProject:
s := proto.Size(x.PropProject) s := proto.Size(x.PropProject)
n += proto.SizeVarint(5<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_RvkPropProject: case *AutonomyAction_RvkPropProject:
s := proto.Size(x.RvkPropProject) s := proto.Size(x.RvkPropProject)
n += proto.SizeVarint(6<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_VotePropProject: case *AutonomyAction_VotePropProject:
s := proto.Size(x.VotePropProject) s := proto.Size(x.VotePropProject)
n += proto.SizeVarint(7<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_PubVotePropProject: case *AutonomyAction_PubVotePropProject:
s := proto.Size(x.PubVotePropProject) s := proto.Size(x.PubVotePropProject)
n += proto.SizeVarint(8<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_TmintPropProject: case *AutonomyAction_TmintPropProject:
s := proto.Size(x.TmintPropProject) s := proto.Size(x.TmintPropProject)
n += proto.SizeVarint(9<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_PropRule: case *AutonomyAction_PropRule:
s := proto.Size(x.PropRule) s := proto.Size(x.PropRule)
n += proto.SizeVarint(10<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_RvkPropRule: case *AutonomyAction_RvkPropRule:
s := proto.Size(x.RvkPropRule) s := proto.Size(x.RvkPropRule)
n += proto.SizeVarint(11<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_VotePropRule: case *AutonomyAction_VotePropRule:
s := proto.Size(x.VotePropRule) s := proto.Size(x.VotePropRule)
n += proto.SizeVarint(12<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_TmintPropRule: case *AutonomyAction_TmintPropRule:
s := proto.Size(x.TmintPropRule) s := proto.Size(x.TmintPropRule)
n += proto.SizeVarint(13<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_Transfer: case *AutonomyAction_Transfer:
s := proto.Size(x.Transfer) s := proto.Size(x.Transfer)
n += proto.SizeVarint(14<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *AutonomyAction_CommentProp: case *AutonomyAction_CommentProp:
s := proto.Size(x.CommentProp) s := proto.Size(x.CommentProp)
n += proto.SizeVarint(15<<3 | proto.WireBytes) n += 1 // tag and wire
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case nil: case nil:
...@@ -606,9 +609,9 @@ func init() { ...@@ -606,9 +609,9 @@ func init() {
proto.RegisterType((*AutonomyAction)(nil), "types.AutonomyAction") proto.RegisterType((*AutonomyAction)(nil), "types.AutonomyAction")
} }
func init() { proto.RegisterFile("autonomy.proto", fileDescriptor0) } func init() { proto.RegisterFile("autonomy.proto", fileDescriptor_0246b47df8434d60) }
var fileDescriptor0 = []byte{ var fileDescriptor_0246b47df8434d60 = []byte{
// 427 bytes of a gzipped FileDescriptorProto // 427 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xcf, 0xaf, 0xd2, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xcf, 0xaf, 0xd2, 0x40,
0x14, 0x85, 0x01, 0xed, 0xe3, 0xbd, 0x5b, 0x5a, 0xc8, 0xd5, 0x68, 0x25, 0x1a, 0x89, 0x2b, 0x56, 0x14, 0x85, 0x01, 0xed, 0xe3, 0xbd, 0x5b, 0x5a, 0xc8, 0xd5, 0x68, 0x25, 0x1a, 0x89, 0x2b, 0x56,
......
...@@ -3,32 +3,64 @@ ...@@ -3,32 +3,64 @@
package types package types
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf 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
type AutonomyProposalBoard struct { type AutonomyProposalBoard struct {
PropBoard *ProposalBoard `protobuf:"bytes,1,opt,name=propBoard" json:"propBoard,omitempty"` PropBoard *ProposalBoard `protobuf:"bytes,1,opt,name=propBoard,proto3" json:"propBoard,omitempty"`
// 投票该提案的规则 // 投票该提案的规则
CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule" json:"curRule,omitempty"` CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule,proto3" json:"curRule,omitempty"`
// 全体持票人投票结果 // 全体持票人投票结果
VoteResult *VoteResult `protobuf:"bytes,3,opt,name=voteResult" json:"voteResult,omitempty"` VoteResult *VoteResult `protobuf:"bytes,3,opt,name=voteResult,proto3" json:"voteResult,omitempty"`
// 状态 // 状态
Status int32 `protobuf:"varint,4,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"`
Address string `protobuf:"bytes,5,opt,name=address" json:"address,omitempty"` Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
Height int64 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,7,opt,name=index" json:"index,omitempty"` Index int32 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AutonomyProposalBoard) Reset() { *m = AutonomyProposalBoard{} }
func (m *AutonomyProposalBoard) String() string { return proto.CompactTextString(m) }
func (*AutonomyProposalBoard) ProtoMessage() {}
func (*AutonomyProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{0}
}
func (m *AutonomyProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutonomyProposalBoard.Unmarshal(m, b)
}
func (m *AutonomyProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutonomyProposalBoard.Marshal(b, m, deterministic)
}
func (m *AutonomyProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutonomyProposalBoard.Merge(m, src)
}
func (m *AutonomyProposalBoard) XXX_Size() int {
return xxx_messageInfo_AutonomyProposalBoard.Size(m)
}
func (m *AutonomyProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_AutonomyProposalBoard.DiscardUnknown(m)
} }
func (m *AutonomyProposalBoard) Reset() { *m = AutonomyProposalBoard{} } var xxx_messageInfo_AutonomyProposalBoard proto.InternalMessageInfo
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 { func (m *AutonomyProposalBoard) GetPropBoard() *ProposalBoard {
if m != nil { if m != nil {
...@@ -82,21 +114,44 @@ func (m *AutonomyProposalBoard) GetIndex() int32 { ...@@ -82,21 +114,44 @@ func (m *AutonomyProposalBoard) GetIndex() int32 {
// action // action
type ProposalBoard struct { type ProposalBoard struct {
// 提案时间 // 提案时间
Year int32 `protobuf:"varint,1,opt,name=year" json:"year,omitempty"` Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"`
Month int32 `protobuf:"varint,2,opt,name=month" json:"month,omitempty"` Month int32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"`
Day int32 `protobuf:"varint,3,opt,name=day" json:"day,omitempty"` Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"`
// 提案董事会成员 // 提案董事会成员
Boards []string `protobuf:"bytes,4,rep,name=boards" json:"boards,omitempty"` Boards []string `protobuf:"bytes,4,rep,name=boards,proto3" json:"boards,omitempty"`
// 投票相关 // 投票相关
StartBlockHeight int64 `protobuf:"varint,5,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"` StartBlockHeight int64 `protobuf:"varint,5,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"`
EndBlockHeight int64 `protobuf:"varint,6,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"` EndBlockHeight int64 `protobuf:"varint,6,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"`
RealEndBlockHeight int64 `protobuf:"varint,7,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"` RealEndBlockHeight int64 `protobuf:"varint,7,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ProposalBoard) Reset() { *m = ProposalBoard{} } func (m *ProposalBoard) Reset() { *m = ProposalBoard{} }
func (m *ProposalBoard) String() string { return proto.CompactTextString(m) } func (m *ProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ProposalBoard) ProtoMessage() {} func (*ProposalBoard) ProtoMessage() {}
func (*ProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } func (*ProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{1}
}
func (m *ProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProposalBoard.Unmarshal(m, b)
}
func (m *ProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProposalBoard.Marshal(b, m, deterministic)
}
func (m *ProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProposalBoard.Merge(m, src)
}
func (m *ProposalBoard) XXX_Size() int {
return xxx_messageInfo_ProposalBoard.Size(m)
}
func (m *ProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_ProposalBoard.DiscardUnknown(m)
}
var xxx_messageInfo_ProposalBoard proto.InternalMessageInfo
func (m *ProposalBoard) GetYear() int32 { func (m *ProposalBoard) GetYear() int32 {
if m != nil { if m != nil {
...@@ -148,13 +203,36 @@ func (m *ProposalBoard) GetRealEndBlockHeight() int64 { ...@@ -148,13 +203,36 @@ func (m *ProposalBoard) GetRealEndBlockHeight() int64 {
} }
type RevokeProposalBoard struct { type RevokeProposalBoard struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *RevokeProposalBoard) Reset() { *m = RevokeProposalBoard{} } func (m *RevokeProposalBoard) Reset() { *m = RevokeProposalBoard{} }
func (m *RevokeProposalBoard) String() string { return proto.CompactTextString(m) } func (m *RevokeProposalBoard) String() string { return proto.CompactTextString(m) }
func (*RevokeProposalBoard) ProtoMessage() {} func (*RevokeProposalBoard) ProtoMessage() {}
func (*RevokeProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } func (*RevokeProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{2}
}
func (m *RevokeProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RevokeProposalBoard.Unmarshal(m, b)
}
func (m *RevokeProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RevokeProposalBoard.Marshal(b, m, deterministic)
}
func (m *RevokeProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_RevokeProposalBoard.Merge(m, src)
}
func (m *RevokeProposalBoard) XXX_Size() int {
return xxx_messageInfo_RevokeProposalBoard.Size(m)
}
func (m *RevokeProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_RevokeProposalBoard.DiscardUnknown(m)
}
var xxx_messageInfo_RevokeProposalBoard proto.InternalMessageInfo
func (m *RevokeProposalBoard) GetProposalID() string { func (m *RevokeProposalBoard) GetProposalID() string {
if m != nil { if m != nil {
...@@ -164,14 +242,37 @@ func (m *RevokeProposalBoard) GetProposalID() string { ...@@ -164,14 +242,37 @@ func (m *RevokeProposalBoard) GetProposalID() string {
} }
type VoteProposalBoard struct { type VoteProposalBoard struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve" json:"approve,omitempty"` Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *VoteProposalBoard) Reset() { *m = VoteProposalBoard{} }
func (m *VoteProposalBoard) String() string { return proto.CompactTextString(m) }
func (*VoteProposalBoard) ProtoMessage() {}
func (*VoteProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{3}
} }
func (m *VoteProposalBoard) Reset() { *m = VoteProposalBoard{} } func (m *VoteProposalBoard) XXX_Unmarshal(b []byte) error {
func (m *VoteProposalBoard) String() string { return proto.CompactTextString(m) } return xxx_messageInfo_VoteProposalBoard.Unmarshal(m, b)
func (*VoteProposalBoard) ProtoMessage() {} }
func (*VoteProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } func (m *VoteProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoteProposalBoard.Marshal(b, m, deterministic)
}
func (m *VoteProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoteProposalBoard.Merge(m, src)
}
func (m *VoteProposalBoard) XXX_Size() int {
return xxx_messageInfo_VoteProposalBoard.Size(m)
}
func (m *VoteProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_VoteProposalBoard.DiscardUnknown(m)
}
var xxx_messageInfo_VoteProposalBoard proto.InternalMessageInfo
func (m *VoteProposalBoard) GetProposalID() string { func (m *VoteProposalBoard) GetProposalID() string {
if m != nil { if m != nil {
...@@ -188,13 +289,36 @@ func (m *VoteProposalBoard) GetApprove() bool { ...@@ -188,13 +289,36 @@ func (m *VoteProposalBoard) GetApprove() bool {
} }
type TerminateProposalBoard struct { type TerminateProposalBoard struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TerminateProposalBoard) Reset() { *m = TerminateProposalBoard{} }
func (m *TerminateProposalBoard) String() string { return proto.CompactTextString(m) }
func (*TerminateProposalBoard) ProtoMessage() {}
func (*TerminateProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{4}
}
func (m *TerminateProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TerminateProposalBoard.Unmarshal(m, b)
}
func (m *TerminateProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TerminateProposalBoard.Marshal(b, m, deterministic)
}
func (m *TerminateProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_TerminateProposalBoard.Merge(m, src)
}
func (m *TerminateProposalBoard) XXX_Size() int {
return xxx_messageInfo_TerminateProposalBoard.Size(m)
}
func (m *TerminateProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_TerminateProposalBoard.DiscardUnknown(m)
} }
func (m *TerminateProposalBoard) Reset() { *m = TerminateProposalBoard{} } var xxx_messageInfo_TerminateProposalBoard proto.InternalMessageInfo
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 { func (m *TerminateProposalBoard) GetProposalID() string {
if m != nil { if m != nil {
...@@ -205,14 +329,37 @@ func (m *TerminateProposalBoard) GetProposalID() string { ...@@ -205,14 +329,37 @@ func (m *TerminateProposalBoard) GetProposalID() string {
// receipt // receipt
type ReceiptProposalBoard struct { type ReceiptProposalBoard struct {
Prev *AutonomyProposalBoard `protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"` Prev *AutonomyProposalBoard `protobuf:"bytes,1,opt,name=prev,proto3" json:"prev,omitempty"`
Current *AutonomyProposalBoard `protobuf:"bytes,2,opt,name=current" json:"current,omitempty"` Current *AutonomyProposalBoard `protobuf:"bytes,2,opt,name=current,proto3" json:"current,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ReceiptProposalBoard) Reset() { *m = ReceiptProposalBoard{} } func (m *ReceiptProposalBoard) Reset() { *m = ReceiptProposalBoard{} }
func (m *ReceiptProposalBoard) String() string { return proto.CompactTextString(m) } func (m *ReceiptProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReceiptProposalBoard) ProtoMessage() {} func (*ReceiptProposalBoard) ProtoMessage() {}
func (*ReceiptProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } func (*ReceiptProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{5}
}
func (m *ReceiptProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptProposalBoard.Unmarshal(m, b)
}
func (m *ReceiptProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptProposalBoard.Marshal(b, m, deterministic)
}
func (m *ReceiptProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptProposalBoard.Merge(m, src)
}
func (m *ReceiptProposalBoard) XXX_Size() int {
return xxx_messageInfo_ReceiptProposalBoard.Size(m)
}
func (m *ReceiptProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptProposalBoard.DiscardUnknown(m)
}
var xxx_messageInfo_ReceiptProposalBoard proto.InternalMessageInfo
func (m *ReceiptProposalBoard) GetPrev() *AutonomyProposalBoard { func (m *ReceiptProposalBoard) GetPrev() *AutonomyProposalBoard {
if m != nil { if m != nil {
...@@ -229,14 +376,37 @@ func (m *ReceiptProposalBoard) GetCurrent() *AutonomyProposalBoard { ...@@ -229,14 +376,37 @@ func (m *ReceiptProposalBoard) GetCurrent() *AutonomyProposalBoard {
} }
type LocalProposalBoard struct { type LocalProposalBoard struct {
PropBd *AutonomyProposalBoard `protobuf:"bytes,1,opt,name=propBd" json:"propBd,omitempty"` PropBd *AutonomyProposalBoard `protobuf:"bytes,1,opt,name=propBd,proto3" json:"propBd,omitempty"`
Comments []string `protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"` Comments []string `protobuf:"bytes,2,rep,name=comments,proto3" json:"comments,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *LocalProposalBoard) Reset() { *m = LocalProposalBoard{} } func (m *LocalProposalBoard) Reset() { *m = LocalProposalBoard{} }
func (m *LocalProposalBoard) String() string { return proto.CompactTextString(m) } func (m *LocalProposalBoard) String() string { return proto.CompactTextString(m) }
func (*LocalProposalBoard) ProtoMessage() {} func (*LocalProposalBoard) ProtoMessage() {}
func (*LocalProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } func (*LocalProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{6}
}
func (m *LocalProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalProposalBoard.Unmarshal(m, b)
}
func (m *LocalProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalProposalBoard.Marshal(b, m, deterministic)
}
func (m *LocalProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalProposalBoard.Merge(m, src)
}
func (m *LocalProposalBoard) XXX_Size() int {
return xxx_messageInfo_LocalProposalBoard.Size(m)
}
func (m *LocalProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_LocalProposalBoard.DiscardUnknown(m)
}
var xxx_messageInfo_LocalProposalBoard proto.InternalMessageInfo
func (m *LocalProposalBoard) GetPropBd() *AutonomyProposalBoard { func (m *LocalProposalBoard) GetPropBd() *AutonomyProposalBoard {
if m != nil { if m != nil {
...@@ -254,17 +424,40 @@ func (m *LocalProposalBoard) GetComments() []string { ...@@ -254,17 +424,40 @@ func (m *LocalProposalBoard) GetComments() []string {
// query // query
type ReqQueryProposalBoard struct { type ReqQueryProposalBoard struct {
// 优先根据status查询 //优先根据status查询
Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,3,opt,name=direction" json:"direction,omitempty"` Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqQueryProposalBoard) Reset() { *m = ReqQueryProposalBoard{} }
func (m *ReqQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalBoard) ProtoMessage() {}
func (*ReqQueryProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{7}
}
func (m *ReqQueryProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqQueryProposalBoard.Unmarshal(m, b)
}
func (m *ReqQueryProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqQueryProposalBoard.Marshal(b, m, deterministic)
}
func (m *ReqQueryProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqQueryProposalBoard.Merge(m, src)
}
func (m *ReqQueryProposalBoard) XXX_Size() int {
return xxx_messageInfo_ReqQueryProposalBoard.Size(m)
}
func (m *ReqQueryProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_ReqQueryProposalBoard.DiscardUnknown(m)
} }
func (m *ReqQueryProposalBoard) Reset() { *m = ReqQueryProposalBoard{} } var xxx_messageInfo_ReqQueryProposalBoard proto.InternalMessageInfo
func (m *ReqQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalBoard) ProtoMessage() {}
func (*ReqQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
func (m *ReqQueryProposalBoard) GetStatus() int32 { func (m *ReqQueryProposalBoard) GetStatus() int32 {
if m != nil { if m != nil {
...@@ -295,13 +488,36 @@ func (m *ReqQueryProposalBoard) GetIndex() int64 { ...@@ -295,13 +488,36 @@ func (m *ReqQueryProposalBoard) GetIndex() int64 {
} }
type ReplyQueryProposalBoard struct { type ReplyQueryProposalBoard struct {
PropBoards []*AutonomyProposalBoard `protobuf:"bytes,1,rep,name=propBoards" json:"propBoards,omitempty"` PropBoards []*AutonomyProposalBoard `protobuf:"bytes,1,rep,name=propBoards,proto3" json:"propBoards,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReplyQueryProposalBoard) Reset() { *m = ReplyQueryProposalBoard{} }
func (m *ReplyQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalBoard) ProtoMessage() {}
func (*ReplyQueryProposalBoard) Descriptor() ([]byte, []int) {
return fileDescriptor_937f74b042f92c0f, []int{8}
}
func (m *ReplyQueryProposalBoard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyQueryProposalBoard.Unmarshal(m, b)
}
func (m *ReplyQueryProposalBoard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyQueryProposalBoard.Marshal(b, m, deterministic)
}
func (m *ReplyQueryProposalBoard) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyQueryProposalBoard.Merge(m, src)
}
func (m *ReplyQueryProposalBoard) XXX_Size() int {
return xxx_messageInfo_ReplyQueryProposalBoard.Size(m)
}
func (m *ReplyQueryProposalBoard) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyQueryProposalBoard.DiscardUnknown(m)
} }
func (m *ReplyQueryProposalBoard) Reset() { *m = ReplyQueryProposalBoard{} } var xxx_messageInfo_ReplyQueryProposalBoard proto.InternalMessageInfo
func (m *ReplyQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalBoard) ProtoMessage() {}
func (*ReplyQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
func (m *ReplyQueryProposalBoard) GetPropBoards() []*AutonomyProposalBoard { func (m *ReplyQueryProposalBoard) GetPropBoards() []*AutonomyProposalBoard {
if m != nil { if m != nil {
...@@ -322,9 +538,9 @@ func init() { ...@@ -322,9 +538,9 @@ func init() {
proto.RegisterType((*ReplyQueryProposalBoard)(nil), "types.ReplyQueryProposalBoard") proto.RegisterType((*ReplyQueryProposalBoard)(nil), "types.ReplyQueryProposalBoard")
} }
func init() { proto.RegisterFile("board.proto", fileDescriptor1) } func init() { proto.RegisterFile("board.proto", fileDescriptor_937f74b042f92c0f) }
var fileDescriptor1 = []byte{ var fileDescriptor_937f74b042f92c0f = []byte{
// 524 bytes of a gzipped FileDescriptorProto // 524 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0x95, 0x93, 0x6c, 0xd2, 0x4c, 0x55, 0xd4, 0x2e, 0x69, 0xb1, 0xaa, 0x0a, 0x45, 0x3e, 0x20, 0x10, 0x95, 0x93, 0x6c, 0xd2, 0x4c, 0x55, 0xd4, 0x2e, 0x69, 0xb1, 0xaa, 0x0a, 0x45, 0x3e, 0x20,
......
...@@ -6,7 +6,7 @@ package types ...@@ -6,7 +6,7 @@ package types
// autonomy action ty // autonomy action ty
const ( const (
AutonomyActionPropBoard = iota + 1 AutonomyActionPropBoard = iota + 1
AutonomyActionRvkPropBoard AutonomyActionRvkPropBoard
AutonomyActionVotePropBoard AutonomyActionVotePropBoard
AutonomyActionTmintPropBoard AutonomyActionTmintPropBoard
...@@ -42,7 +42,7 @@ const ( ...@@ -42,7 +42,7 @@ const (
TyLogVotePropRule = 2123 TyLogVotePropRule = 2123
TyLogTmintPropRule = 2124 TyLogTmintPropRule = 2124
TyLogCommentProp = 2131 TyLogCommentProp = 2131
) )
// status // status
...@@ -70,22 +70,21 @@ const ( ...@@ -70,22 +70,21 @@ const (
const ( const (
// GetProposalBoard 用于在cmd里面的区分不同的查询 // GetProposalBoard 用于在cmd里面的区分不同的查询
GetProposalBoard = "GetProposalBoard" GetProposalBoard = "GetProposalBoard"
// ListProposalBoard // ListProposalBoard
ListProposalBoard = "ListProposalBoard" ListProposalBoard = "ListProposalBoard"
// GetProposalProject 用于在cmd里面的区分不同的查询 // GetProposalProject 用于在cmd里面的区分不同的查询
GetProposalProject = "GetProposalProject" GetProposalProject = "GetProposalProject"
// ListProposalProject // ListProposalProject
ListProposalProject = "ListProposalProject" ListProposalProject = "ListProposalProject"
// GetProposalRule 用于在cmd里面的区分不同的查询 // GetProposalRule 用于在cmd里面的区分不同的查询
GetProposalRule = "GetProposalRule" GetProposalRule = "GetProposalRule"
// ListProposalRule // ListProposalRule
ListProposalRule = "ListProposalRule" ListProposalRule = "ListProposalRule"
// ListProposalComment // ListProposalComment
ListProposalComment = "ListProposalComment" ListProposalComment = "ListProposalComment"
) )
//包的名字可以通过配置文件来配置 //包的名字可以通过配置文件来配置
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字 //建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//如果发生重名,可以通过配置文件修改这些名字 //如果发生重名,可以通过配置文件修改这些名字
......
...@@ -3,30 +3,62 @@ ...@@ -3,30 +3,62 @@
package types package types
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf 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
type VoteResult struct { type VoteResult struct {
// 总票数 // 总票数
TotalVotes int32 `protobuf:"varint,1,opt,name=totalVotes" json:"totalVotes,omitempty"` TotalVotes int32 `protobuf:"varint,1,opt,name=totalVotes,proto3" json:"totalVotes,omitempty"`
// 赞成票 // 赞成票
ApproveVotes int32 `protobuf:"varint,2,opt,name=approveVotes" json:"approveVotes,omitempty"` ApproveVotes int32 `protobuf:"varint,2,opt,name=approveVotes,proto3" json:"approveVotes,omitempty"`
// 反对票 // 反对票
OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes" json:"opposeVotes,omitempty"` OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes,proto3" json:"opposeVotes,omitempty"`
// 是否通过 // 是否通过
Pass bool `protobuf:"varint,4,opt,name=pass" json:"pass,omitempty"` Pass bool `protobuf:"varint,4,opt,name=pass,proto3" json:"pass,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *VoteResult) Reset() { *m = VoteResult{} } func (m *VoteResult) Reset() { *m = VoteResult{} }
func (m *VoteResult) String() string { return proto.CompactTextString(m) } func (m *VoteResult) String() string { return proto.CompactTextString(m) }
func (*VoteResult) ProtoMessage() {} func (*VoteResult) ProtoMessage() {}
func (*VoteResult) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } func (*VoteResult) Descriptor() ([]byte, []int) {
return fileDescriptor_d916a933dd8220ff, []int{0}
}
func (m *VoteResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VoteResult.Unmarshal(m, b)
}
func (m *VoteResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoteResult.Marshal(b, m, deterministic)
}
func (m *VoteResult) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoteResult.Merge(m, src)
}
func (m *VoteResult) XXX_Size() int {
return xxx_messageInfo_VoteResult.Size(m)
}
func (m *VoteResult) XXX_DiscardUnknown() {
xxx_messageInfo_VoteResult.DiscardUnknown(m)
}
var xxx_messageInfo_VoteResult proto.InternalMessageInfo
func (m *VoteResult) GetTotalVotes() int32 { func (m *VoteResult) GetTotalVotes() int32 {
if m != nil { if m != nil {
...@@ -58,19 +90,42 @@ func (m *VoteResult) GetPass() bool { ...@@ -58,19 +90,42 @@ func (m *VoteResult) GetPass() bool {
type PublicVote struct { type PublicVote struct {
// 是否需要公示 // 是否需要公示
Publicity bool `protobuf:"varint,1,opt,name=publicity" json:"publicity,omitempty"` Publicity bool `protobuf:"varint,1,opt,name=publicity,proto3" json:"publicity,omitempty"`
// 总票数 // 总票数
TotalVotes int32 `protobuf:"varint,2,opt,name=totalVotes" json:"totalVotes,omitempty"` TotalVotes int32 `protobuf:"varint,2,opt,name=totalVotes,proto3" json:"totalVotes,omitempty"`
// 全体持票人反对票 // 全体持票人反对票
OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes" json:"opposeVotes,omitempty"` OpposeVotes int32 `protobuf:"varint,3,opt,name=opposeVotes,proto3" json:"opposeVotes,omitempty"`
// 是否通过 // 是否通过
PubPass bool `protobuf:"varint,4,opt,name=pubPass" json:"pubPass,omitempty"` PubPass bool `protobuf:"varint,4,opt,name=pubPass,proto3" json:"pubPass,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PublicVote) Reset() { *m = PublicVote{} }
func (m *PublicVote) String() string { return proto.CompactTextString(m) }
func (*PublicVote) ProtoMessage() {}
func (*PublicVote) Descriptor() ([]byte, []int) {
return fileDescriptor_d916a933dd8220ff, []int{1}
}
func (m *PublicVote) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PublicVote.Unmarshal(m, b)
}
func (m *PublicVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PublicVote.Marshal(b, m, deterministic)
}
func (m *PublicVote) XXX_Merge(src proto.Message) {
xxx_messageInfo_PublicVote.Merge(m, src)
}
func (m *PublicVote) XXX_Size() int {
return xxx_messageInfo_PublicVote.Size(m)
}
func (m *PublicVote) XXX_DiscardUnknown() {
xxx_messageInfo_PublicVote.DiscardUnknown(m)
} }
func (m *PublicVote) Reset() { *m = PublicVote{} } var xxx_messageInfo_PublicVote proto.InternalMessageInfo
func (m *PublicVote) String() string { return proto.CompactTextString(m) }
func (*PublicVote) ProtoMessage() {}
func (*PublicVote) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
func (m *PublicVote) GetPublicity() bool { func (m *PublicVote) GetPublicity() bool {
if m != nil { if m != nil {
...@@ -101,13 +156,36 @@ func (m *PublicVote) GetPubPass() bool { ...@@ -101,13 +156,36 @@ func (m *PublicVote) GetPubPass() bool {
} }
type VotesRecord struct { type VotesRecord struct {
Address []string `protobuf:"bytes,1,rep,name=address" json:"address,omitempty"` Address []string `protobuf:"bytes,1,rep,name=address,proto3" json:"address,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *VotesRecord) Reset() { *m = VotesRecord{} }
func (m *VotesRecord) String() string { return proto.CompactTextString(m) }
func (*VotesRecord) ProtoMessage() {}
func (*VotesRecord) Descriptor() ([]byte, []int) {
return fileDescriptor_d916a933dd8220ff, []int{2}
}
func (m *VotesRecord) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VotesRecord.Unmarshal(m, b)
}
func (m *VotesRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VotesRecord.Marshal(b, m, deterministic)
}
func (m *VotesRecord) XXX_Merge(src proto.Message) {
xxx_messageInfo_VotesRecord.Merge(m, src)
}
func (m *VotesRecord) XXX_Size() int {
return xxx_messageInfo_VotesRecord.Size(m)
}
func (m *VotesRecord) XXX_DiscardUnknown() {
xxx_messageInfo_VotesRecord.DiscardUnknown(m)
} }
func (m *VotesRecord) Reset() { *m = VotesRecord{} } var xxx_messageInfo_VotesRecord proto.InternalMessageInfo
func (m *VotesRecord) String() string { return proto.CompactTextString(m) }
func (*VotesRecord) ProtoMessage() {}
func (*VotesRecord) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
func (m *VotesRecord) GetAddress() []string { func (m *VotesRecord) GetAddress() []string {
if m != nil { if m != nil {
...@@ -118,23 +196,46 @@ func (m *VotesRecord) GetAddress() []string { ...@@ -118,23 +196,46 @@ func (m *VotesRecord) GetAddress() []string {
type RuleConfig struct { type RuleConfig struct {
// 董事会成员参与率,以%为单位,只保留整数部分 // 董事会成员参与率,以%为单位,只保留整数部分
BoardAttendRatio int32 `protobuf:"varint,1,opt,name=boardAttendRatio" json:"boardAttendRatio,omitempty"` BoardAttendRatio int32 `protobuf:"varint,1,opt,name=boardAttendRatio,proto3" json:"boardAttendRatio,omitempty"`
// 董事会成员赞成率 // 董事会成员赞成率
BoardApproveRatio int32 `protobuf:"varint,2,opt,name=boardApproveRatio" json:"boardApproveRatio,omitempty"` BoardApproveRatio int32 `protobuf:"varint,2,opt,name=boardApproveRatio,proto3" json:"boardApproveRatio,omitempty"`
// 全体持票人否决率 // 全体持票人否决率
PubOpposeRatio int32 `protobuf:"varint,3,opt,name=pubOpposeRatio" json:"pubOpposeRatio,omitempty"` PubOpposeRatio int32 `protobuf:"varint,3,opt,name=pubOpposeRatio,proto3" json:"pubOpposeRatio,omitempty"`
// 提案金额 // 提案金额
ProposalAmount int64 `protobuf:"varint,4,opt,name=proposalAmount" json:"proposalAmount,omitempty"` ProposalAmount int64 `protobuf:"varint,4,opt,name=proposalAmount,proto3" json:"proposalAmount,omitempty"`
// 重大项目公示金额阈值 // 重大项目公示金额阈值
LargeProjectAmount int64 `protobuf:"varint,5,opt,name=largeProjectAmount" json:"largeProjectAmount,omitempty"` LargeProjectAmount int64 `protobuf:"varint,5,opt,name=largeProjectAmount,proto3" json:"largeProjectAmount,omitempty"`
// 重大项目公示时间(以区块数为单位) // 重大项目公示时间(以区块数为单位)
PublicPeriod int32 `protobuf:"varint,6,opt,name=publicPeriod" json:"publicPeriod,omitempty"` PublicPeriod int32 `protobuf:"varint,6,opt,name=publicPeriod,proto3" json:"publicPeriod,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RuleConfig) Reset() { *m = RuleConfig{} }
func (m *RuleConfig) String() string { return proto.CompactTextString(m) }
func (*RuleConfig) ProtoMessage() {}
func (*RuleConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_d916a933dd8220ff, []int{3}
}
func (m *RuleConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RuleConfig.Unmarshal(m, b)
}
func (m *RuleConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RuleConfig.Marshal(b, m, deterministic)
}
func (m *RuleConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_RuleConfig.Merge(m, src)
}
func (m *RuleConfig) XXX_Size() int {
return xxx_messageInfo_RuleConfig.Size(m)
}
func (m *RuleConfig) XXX_DiscardUnknown() {
xxx_messageInfo_RuleConfig.DiscardUnknown(m)
} }
func (m *RuleConfig) Reset() { *m = RuleConfig{} } var xxx_messageInfo_RuleConfig proto.InternalMessageInfo
func (m *RuleConfig) String() string { return proto.CompactTextString(m) }
func (*RuleConfig) ProtoMessage() {}
func (*RuleConfig) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} }
func (m *RuleConfig) GetBoardAttendRatio() int32 { func (m *RuleConfig) GetBoardAttendRatio() int32 {
if m != nil { if m != nil {
...@@ -185,9 +286,9 @@ func init() { ...@@ -185,9 +286,9 @@ func init() {
proto.RegisterType((*RuleConfig)(nil), "types.RuleConfig") proto.RegisterType((*RuleConfig)(nil), "types.RuleConfig")
} }
func init() { proto.RegisterFile("lcommon.proto", fileDescriptor2) } func init() { proto.RegisterFile("lcommon.proto", fileDescriptor_d916a933dd8220ff) }
var fileDescriptor2 = []byte{ var fileDescriptor_d916a933dd8220ff = []byte{
// 314 bytes of a gzipped FileDescriptorProto // 314 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x3d, 0x4e, 0xf3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x3d, 0x4e, 0xf3, 0x40,
0x10, 0x86, 0xe5, 0xfc, 0x7d, 0xc9, 0xe4, 0x03, 0xc1, 0x54, 0x2e, 0x10, 0x8a, 0x5c, 0x40, 0x84, 0x10, 0x86, 0xe5, 0xfc, 0x7d, 0xc9, 0xe4, 0x03, 0xc1, 0x54, 0x2e, 0x10, 0x8a, 0x5c, 0x40, 0x84,
......
...@@ -3,36 +3,68 @@ ...@@ -3,36 +3,68 @@
package types package types
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf 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
type AutonomyProposalProject struct { type AutonomyProposalProject struct {
PropProject *ProposalProject `protobuf:"bytes,1,opt,name=propProject" json:"propProject,omitempty"` PropProject *ProposalProject `protobuf:"bytes,1,opt,name=propProject,proto3" json:"propProject,omitempty"`
// 投票该提案的规则 // 投票该提案的规则
CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule" json:"curRule,omitempty"` CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule,proto3" json:"curRule,omitempty"`
// 投票该提案的董事会成员 // 投票该提案的董事会成员
Boards []string `protobuf:"bytes,3,rep,name=boards" json:"boards,omitempty"` Boards []string `protobuf:"bytes,3,rep,name=boards,proto3" json:"boards,omitempty"`
// 董事会投票结果 // 董事会投票结果
BoardVoteRes *VoteResult `protobuf:"bytes,4,opt,name=boardVoteRes" json:"boardVoteRes,omitempty"` BoardVoteRes *VoteResult `protobuf:"bytes,4,opt,name=boardVoteRes,proto3" json:"boardVoteRes,omitempty"`
// 公示投票 // 公示投票
PubVote *PublicVote `protobuf:"bytes,5,opt,name=pubVote" json:"pubVote,omitempty"` PubVote *PublicVote `protobuf:"bytes,5,opt,name=pubVote,proto3" json:"pubVote,omitempty"`
// 状态 // 状态
Status int32 `protobuf:"varint,6,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"`
Address string `protobuf:"bytes,7,opt,name=address" json:"address,omitempty"` Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty"`
Height int64 `protobuf:"varint,8,opt,name=height" json:"height,omitempty"` Height int64 `protobuf:"varint,8,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,9,opt,name=index" json:"index,omitempty"` Index int32 `protobuf:"varint,9,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *AutonomyProposalProject) Reset() { *m = AutonomyProposalProject{} } func (m *AutonomyProposalProject) Reset() { *m = AutonomyProposalProject{} }
func (m *AutonomyProposalProject) String() string { return proto.CompactTextString(m) } func (m *AutonomyProposalProject) String() string { return proto.CompactTextString(m) }
func (*AutonomyProposalProject) ProtoMessage() {} func (*AutonomyProposalProject) ProtoMessage() {}
func (*AutonomyProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } func (*AutonomyProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{0}
}
func (m *AutonomyProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutonomyProposalProject.Unmarshal(m, b)
}
func (m *AutonomyProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutonomyProposalProject.Marshal(b, m, deterministic)
}
func (m *AutonomyProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutonomyProposalProject.Merge(m, src)
}
func (m *AutonomyProposalProject) XXX_Size() int {
return xxx_messageInfo_AutonomyProposalProject.Size(m)
}
func (m *AutonomyProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_AutonomyProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_AutonomyProposalProject proto.InternalMessageInfo
func (m *AutonomyProposalProject) GetPropProject() *ProposalProject { func (m *AutonomyProposalProject) GetPropProject() *ProposalProject {
if m != nil { if m != nil {
...@@ -99,30 +131,53 @@ func (m *AutonomyProposalProject) GetIndex() int32 { ...@@ -99,30 +131,53 @@ func (m *AutonomyProposalProject) GetIndex() int32 {
type ProposalProject struct { type ProposalProject struct {
// 提案时间 // 提案时间
Year int32 `protobuf:"varint,1,opt,name=year" json:"year,omitempty"` Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"`
Month int32 `protobuf:"varint,2,opt,name=month" json:"month,omitempty"` Month int32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"`
Day int32 `protobuf:"varint,3,opt,name=day" json:"day,omitempty"` Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"`
// 项目相关 // 项目相关
FirstStage string `protobuf:"bytes,4,opt,name=firstStage" json:"firstStage,omitempty"` FirstStage string `protobuf:"bytes,4,opt,name=firstStage,proto3" json:"firstStage,omitempty"`
LastStage string `protobuf:"bytes,5,opt,name=lastStage" json:"lastStage,omitempty"` LastStage string `protobuf:"bytes,5,opt,name=lastStage,proto3" json:"lastStage,omitempty"`
Production string `protobuf:"bytes,6,opt,name=production" json:"production,omitempty"` Production string `protobuf:"bytes,6,opt,name=production,proto3" json:"production,omitempty"`
Description string `protobuf:"bytes,7,opt,name=description" json:"description,omitempty"` Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"`
Contractor string `protobuf:"bytes,8,opt,name=contractor" json:"contractor,omitempty"` Contractor string `protobuf:"bytes,8,opt,name=contractor,proto3" json:"contractor,omitempty"`
Amount int64 `protobuf:"varint,9,opt,name=amount" json:"amount,omitempty"` Amount int64 `protobuf:"varint,9,opt,name=amount,proto3" json:"amount,omitempty"`
AmountDetail string `protobuf:"bytes,10,opt,name=amountDetail" json:"amountDetail,omitempty"` AmountDetail string `protobuf:"bytes,10,opt,name=amountDetail,proto3" json:"amountDetail,omitempty"`
// 支付相关 // 支付相关
ToAddr string `protobuf:"bytes,11,opt,name=toAddr" json:"toAddr,omitempty"` ToAddr string `protobuf:"bytes,11,opt,name=toAddr,proto3" json:"toAddr,omitempty"`
// 投票相关 // 投票相关
StartBlockHeight int64 `protobuf:"varint,12,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"` StartBlockHeight int64 `protobuf:"varint,12,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"`
EndBlockHeight int64 `protobuf:"varint,13,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"` EndBlockHeight int64 `protobuf:"varint,13,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"`
RealEndBlockHeight int64 `protobuf:"varint,14,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"` RealEndBlockHeight int64 `protobuf:"varint,14,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"`
ProjectNeedBlockNum int32 `protobuf:"varint,15,opt,name=projectNeedBlockNum" json:"projectNeedBlockNum,omitempty"` ProjectNeedBlockNum int32 `protobuf:"varint,15,opt,name=projectNeedBlockNum,proto3" json:"projectNeedBlockNum,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ProposalProject) Reset() { *m = ProposalProject{} } func (m *ProposalProject) Reset() { *m = ProposalProject{} }
func (m *ProposalProject) String() string { return proto.CompactTextString(m) } func (m *ProposalProject) String() string { return proto.CompactTextString(m) }
func (*ProposalProject) ProtoMessage() {} func (*ProposalProject) ProtoMessage() {}
func (*ProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } func (*ProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{1}
}
func (m *ProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProposalProject.Unmarshal(m, b)
}
func (m *ProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProposalProject.Marshal(b, m, deterministic)
}
func (m *ProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProposalProject.Merge(m, src)
}
func (m *ProposalProject) XXX_Size() int {
return xxx_messageInfo_ProposalProject.Size(m)
}
func (m *ProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_ProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_ProposalProject proto.InternalMessageInfo
func (m *ProposalProject) GetYear() int32 { func (m *ProposalProject) GetYear() int32 {
if m != nil { if m != nil {
...@@ -230,13 +285,36 @@ func (m *ProposalProject) GetProjectNeedBlockNum() int32 { ...@@ -230,13 +285,36 @@ func (m *ProposalProject) GetProjectNeedBlockNum() int32 {
} }
type RevokeProposalProject struct { type RevokeProposalProject struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *RevokeProposalProject) Reset() { *m = RevokeProposalProject{} } func (m *RevokeProposalProject) Reset() { *m = RevokeProposalProject{} }
func (m *RevokeProposalProject) String() string { return proto.CompactTextString(m) } func (m *RevokeProposalProject) String() string { return proto.CompactTextString(m) }
func (*RevokeProposalProject) ProtoMessage() {} func (*RevokeProposalProject) ProtoMessage() {}
func (*RevokeProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} } func (*RevokeProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{2}
}
func (m *RevokeProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RevokeProposalProject.Unmarshal(m, b)
}
func (m *RevokeProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RevokeProposalProject.Marshal(b, m, deterministic)
}
func (m *RevokeProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_RevokeProposalProject.Merge(m, src)
}
func (m *RevokeProposalProject) XXX_Size() int {
return xxx_messageInfo_RevokeProposalProject.Size(m)
}
func (m *RevokeProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_RevokeProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_RevokeProposalProject proto.InternalMessageInfo
func (m *RevokeProposalProject) GetProposalID() string { func (m *RevokeProposalProject) GetProposalID() string {
if m != nil { if m != nil {
...@@ -246,14 +324,37 @@ func (m *RevokeProposalProject) GetProposalID() string { ...@@ -246,14 +324,37 @@ func (m *RevokeProposalProject) GetProposalID() string {
} }
type VoteProposalProject struct { type VoteProposalProject struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve" json:"approve,omitempty"` Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *VoteProposalProject) Reset() { *m = VoteProposalProject{} }
func (m *VoteProposalProject) String() string { return proto.CompactTextString(m) }
func (*VoteProposalProject) ProtoMessage() {}
func (*VoteProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{3}
}
func (m *VoteProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VoteProposalProject.Unmarshal(m, b)
}
func (m *VoteProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoteProposalProject.Marshal(b, m, deterministic)
}
func (m *VoteProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoteProposalProject.Merge(m, src)
}
func (m *VoteProposalProject) XXX_Size() int {
return xxx_messageInfo_VoteProposalProject.Size(m)
}
func (m *VoteProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_VoteProposalProject.DiscardUnknown(m)
} }
func (m *VoteProposalProject) Reset() { *m = VoteProposalProject{} } var xxx_messageInfo_VoteProposalProject proto.InternalMessageInfo
func (m *VoteProposalProject) String() string { return proto.CompactTextString(m) }
func (*VoteProposalProject) ProtoMessage() {}
func (*VoteProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} }
func (m *VoteProposalProject) GetProposalID() string { func (m *VoteProposalProject) GetProposalID() string {
if m != nil { if m != nil {
...@@ -270,14 +371,37 @@ func (m *VoteProposalProject) GetApprove() bool { ...@@ -270,14 +371,37 @@ func (m *VoteProposalProject) GetApprove() bool {
} }
type PubVoteProposalProject struct { type PubVoteProposalProject struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Oppose bool `protobuf:"varint,2,opt,name=oppose" json:"oppose,omitempty"` Oppose bool `protobuf:"varint,2,opt,name=oppose,proto3" json:"oppose,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PubVoteProposalProject) Reset() { *m = PubVoteProposalProject{} }
func (m *PubVoteProposalProject) String() string { return proto.CompactTextString(m) }
func (*PubVoteProposalProject) ProtoMessage() {}
func (*PubVoteProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{4}
}
func (m *PubVoteProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PubVoteProposalProject.Unmarshal(m, b)
}
func (m *PubVoteProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PubVoteProposalProject.Marshal(b, m, deterministic)
}
func (m *PubVoteProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_PubVoteProposalProject.Merge(m, src)
}
func (m *PubVoteProposalProject) XXX_Size() int {
return xxx_messageInfo_PubVoteProposalProject.Size(m)
}
func (m *PubVoteProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_PubVoteProposalProject.DiscardUnknown(m)
} }
func (m *PubVoteProposalProject) Reset() { *m = PubVoteProposalProject{} } var xxx_messageInfo_PubVoteProposalProject proto.InternalMessageInfo
func (m *PubVoteProposalProject) String() string { return proto.CompactTextString(m) }
func (*PubVoteProposalProject) ProtoMessage() {}
func (*PubVoteProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} }
func (m *PubVoteProposalProject) GetProposalID() string { func (m *PubVoteProposalProject) GetProposalID() string {
if m != nil { if m != nil {
...@@ -294,13 +418,36 @@ func (m *PubVoteProposalProject) GetOppose() bool { ...@@ -294,13 +418,36 @@ func (m *PubVoteProposalProject) GetOppose() bool {
} }
type TerminateProposalProject struct { type TerminateProposalProject struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *TerminateProposalProject) Reset() { *m = TerminateProposalProject{} } func (m *TerminateProposalProject) Reset() { *m = TerminateProposalProject{} }
func (m *TerminateProposalProject) String() string { return proto.CompactTextString(m) } func (m *TerminateProposalProject) String() string { return proto.CompactTextString(m) }
func (*TerminateProposalProject) ProtoMessage() {} func (*TerminateProposalProject) ProtoMessage() {}
func (*TerminateProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{5} } func (*TerminateProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{5}
}
func (m *TerminateProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TerminateProposalProject.Unmarshal(m, b)
}
func (m *TerminateProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TerminateProposalProject.Marshal(b, m, deterministic)
}
func (m *TerminateProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_TerminateProposalProject.Merge(m, src)
}
func (m *TerminateProposalProject) XXX_Size() int {
return xxx_messageInfo_TerminateProposalProject.Size(m)
}
func (m *TerminateProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_TerminateProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_TerminateProposalProject proto.InternalMessageInfo
func (m *TerminateProposalProject) GetProposalID() string { func (m *TerminateProposalProject) GetProposalID() string {
if m != nil { if m != nil {
...@@ -311,14 +458,37 @@ func (m *TerminateProposalProject) GetProposalID() string { ...@@ -311,14 +458,37 @@ func (m *TerminateProposalProject) GetProposalID() string {
// receipt // receipt
type ReceiptProposalProject struct { type ReceiptProposalProject struct {
Prev *AutonomyProposalProject `protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"` Prev *AutonomyProposalProject `protobuf:"bytes,1,opt,name=prev,proto3" json:"prev,omitempty"`
Current *AutonomyProposalProject `protobuf:"bytes,2,opt,name=current" json:"current,omitempty"` Current *AutonomyProposalProject `protobuf:"bytes,2,opt,name=current,proto3" json:"current,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ReceiptProposalProject) Reset() { *m = ReceiptProposalProject{} } func (m *ReceiptProposalProject) Reset() { *m = ReceiptProposalProject{} }
func (m *ReceiptProposalProject) String() string { return proto.CompactTextString(m) } func (m *ReceiptProposalProject) String() string { return proto.CompactTextString(m) }
func (*ReceiptProposalProject) ProtoMessage() {} func (*ReceiptProposalProject) ProtoMessage() {}
func (*ReceiptProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{6} } func (*ReceiptProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{6}
}
func (m *ReceiptProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptProposalProject.Unmarshal(m, b)
}
func (m *ReceiptProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptProposalProject.Marshal(b, m, deterministic)
}
func (m *ReceiptProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptProposalProject.Merge(m, src)
}
func (m *ReceiptProposalProject) XXX_Size() int {
return xxx_messageInfo_ReceiptProposalProject.Size(m)
}
func (m *ReceiptProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_ReceiptProposalProject proto.InternalMessageInfo
func (m *ReceiptProposalProject) GetPrev() *AutonomyProposalProject { func (m *ReceiptProposalProject) GetPrev() *AutonomyProposalProject {
if m != nil { if m != nil {
...@@ -335,14 +505,37 @@ func (m *ReceiptProposalProject) GetCurrent() *AutonomyProposalProject { ...@@ -335,14 +505,37 @@ func (m *ReceiptProposalProject) GetCurrent() *AutonomyProposalProject {
} }
type LocalProposalProject struct { type LocalProposalProject struct {
PropPrj *AutonomyProposalProject `protobuf:"bytes,1,opt,name=propPrj" json:"propPrj,omitempty"` PropPrj *AutonomyProposalProject `protobuf:"bytes,1,opt,name=propPrj,proto3" json:"propPrj,omitempty"`
Comments []string `protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"` Comments []string `protobuf:"bytes,2,rep,name=comments,proto3" json:"comments,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *LocalProposalProject) Reset() { *m = LocalProposalProject{} } func (m *LocalProposalProject) Reset() { *m = LocalProposalProject{} }
func (m *LocalProposalProject) String() string { return proto.CompactTextString(m) } func (m *LocalProposalProject) String() string { return proto.CompactTextString(m) }
func (*LocalProposalProject) ProtoMessage() {} func (*LocalProposalProject) ProtoMessage() {}
func (*LocalProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{7} } func (*LocalProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{7}
}
func (m *LocalProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalProposalProject.Unmarshal(m, b)
}
func (m *LocalProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalProposalProject.Marshal(b, m, deterministic)
}
func (m *LocalProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalProposalProject.Merge(m, src)
}
func (m *LocalProposalProject) XXX_Size() int {
return xxx_messageInfo_LocalProposalProject.Size(m)
}
func (m *LocalProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_LocalProposalProject.DiscardUnknown(m)
}
var xxx_messageInfo_LocalProposalProject proto.InternalMessageInfo
func (m *LocalProposalProject) GetPropPrj() *AutonomyProposalProject { func (m *LocalProposalProject) GetPropPrj() *AutonomyProposalProject {
if m != nil { if m != nil {
...@@ -360,17 +553,40 @@ func (m *LocalProposalProject) GetComments() []string { ...@@ -360,17 +553,40 @@ func (m *LocalProposalProject) GetComments() []string {
// query // query
type ReqQueryProposalProject struct { type ReqQueryProposalProject struct {
// 优先根据status查询 //优先根据status查询
Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,3,opt,name=direction" json:"direction,omitempty"` Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqQueryProposalProject) Reset() { *m = ReqQueryProposalProject{} }
func (m *ReqQueryProposalProject) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalProject) ProtoMessage() {}
func (*ReqQueryProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{8}
}
func (m *ReqQueryProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqQueryProposalProject.Unmarshal(m, b)
}
func (m *ReqQueryProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqQueryProposalProject.Marshal(b, m, deterministic)
}
func (m *ReqQueryProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqQueryProposalProject.Merge(m, src)
}
func (m *ReqQueryProposalProject) XXX_Size() int {
return xxx_messageInfo_ReqQueryProposalProject.Size(m)
}
func (m *ReqQueryProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_ReqQueryProposalProject.DiscardUnknown(m)
} }
func (m *ReqQueryProposalProject) Reset() { *m = ReqQueryProposalProject{} } var xxx_messageInfo_ReqQueryProposalProject proto.InternalMessageInfo
func (m *ReqQueryProposalProject) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalProject) ProtoMessage() {}
func (*ReqQueryProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{8} }
func (m *ReqQueryProposalProject) GetStatus() int32 { func (m *ReqQueryProposalProject) GetStatus() int32 {
if m != nil { if m != nil {
...@@ -401,13 +617,36 @@ func (m *ReqQueryProposalProject) GetIndex() int64 { ...@@ -401,13 +617,36 @@ func (m *ReqQueryProposalProject) GetIndex() int64 {
} }
type ReplyQueryProposalProject struct { type ReplyQueryProposalProject struct {
PropProjects []*AutonomyProposalProject `protobuf:"bytes,1,rep,name=propProjects" json:"propProjects,omitempty"` PropProjects []*AutonomyProposalProject `protobuf:"bytes,1,rep,name=propProjects,proto3" json:"propProjects,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReplyQueryProposalProject) Reset() { *m = ReplyQueryProposalProject{} }
func (m *ReplyQueryProposalProject) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalProject) ProtoMessage() {}
func (*ReplyQueryProposalProject) Descriptor() ([]byte, []int) {
return fileDescriptor_8340e6318dfdfac2, []int{9}
}
func (m *ReplyQueryProposalProject) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyQueryProposalProject.Unmarshal(m, b)
}
func (m *ReplyQueryProposalProject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyQueryProposalProject.Marshal(b, m, deterministic)
}
func (m *ReplyQueryProposalProject) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyQueryProposalProject.Merge(m, src)
}
func (m *ReplyQueryProposalProject) XXX_Size() int {
return xxx_messageInfo_ReplyQueryProposalProject.Size(m)
}
func (m *ReplyQueryProposalProject) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyQueryProposalProject.DiscardUnknown(m)
} }
func (m *ReplyQueryProposalProject) Reset() { *m = ReplyQueryProposalProject{} } var xxx_messageInfo_ReplyQueryProposalProject proto.InternalMessageInfo
func (m *ReplyQueryProposalProject) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalProject) ProtoMessage() {}
func (*ReplyQueryProposalProject) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{9} }
func (m *ReplyQueryProposalProject) GetPropProjects() []*AutonomyProposalProject { func (m *ReplyQueryProposalProject) GetPropProjects() []*AutonomyProposalProject {
if m != nil { if m != nil {
...@@ -429,9 +668,9 @@ func init() { ...@@ -429,9 +668,9 @@ func init() {
proto.RegisterType((*ReplyQueryProposalProject)(nil), "types.ReplyQueryProposalProject") proto.RegisterType((*ReplyQueryProposalProject)(nil), "types.ReplyQueryProposalProject")
} }
func init() { proto.RegisterFile("project.proto", fileDescriptor3) } func init() { proto.RegisterFile("project.proto", fileDescriptor_8340e6318dfdfac2) }
var fileDescriptor3 = []byte{ var fileDescriptor_8340e6318dfdfac2 = []byte{
// 686 bytes of a gzipped FileDescriptorProto // 686 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x6f, 0x13, 0x3b, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x6f, 0x13, 0x3b,
0x14, 0x55, 0x3a, 0x99, 0xa4, 0xb9, 0x49, 0x3f, 0x9e, 0xdb, 0x97, 0xfa, 0x55, 0x4f, 0x55, 0x34, 0x14, 0x55, 0x3a, 0x99, 0xa4, 0xb9, 0x49, 0x3f, 0x9e, 0xdb, 0x97, 0xfa, 0x55, 0x4f, 0x55, 0x34,
......
...@@ -3,31 +3,63 @@ ...@@ -3,31 +3,63 @@
package types package types
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf 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
type AutonomyProposalRule struct { type AutonomyProposalRule struct {
PropRule *ProposalRule `protobuf:"bytes,1,opt,name=propRule" json:"propRule,omitempty"` PropRule *ProposalRule `protobuf:"bytes,1,opt,name=propRule,proto3" json:"propRule,omitempty"`
CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule" json:"curRule,omitempty"` CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule,proto3" json:"curRule,omitempty"`
// 全体持票人投票结果 // 全体持票人投票结果
VoteResult *VoteResult `protobuf:"bytes,3,opt,name=voteResult" json:"voteResult,omitempty"` VoteResult *VoteResult `protobuf:"bytes,3,opt,name=voteResult,proto3" json:"voteResult,omitempty"`
// 状态 // 状态
Status int32 `protobuf:"varint,4,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"`
Address string `protobuf:"bytes,5,opt,name=address" json:"address,omitempty"` Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
Height int64 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,7,opt,name=index" json:"index,omitempty"` Index int32 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AutonomyProposalRule) Reset() { *m = AutonomyProposalRule{} }
func (m *AutonomyProposalRule) String() string { return proto.CompactTextString(m) }
func (*AutonomyProposalRule) ProtoMessage() {}
func (*AutonomyProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{0}
}
func (m *AutonomyProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AutonomyProposalRule.Unmarshal(m, b)
}
func (m *AutonomyProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AutonomyProposalRule.Marshal(b, m, deterministic)
}
func (m *AutonomyProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_AutonomyProposalRule.Merge(m, src)
}
func (m *AutonomyProposalRule) XXX_Size() int {
return xxx_messageInfo_AutonomyProposalRule.Size(m)
}
func (m *AutonomyProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_AutonomyProposalRule.DiscardUnknown(m)
} }
func (m *AutonomyProposalRule) Reset() { *m = AutonomyProposalRule{} } var xxx_messageInfo_AutonomyProposalRule proto.InternalMessageInfo
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 { func (m *AutonomyProposalRule) GetPropRule() *ProposalRule {
if m != nil { if m != nil {
...@@ -80,21 +112,44 @@ func (m *AutonomyProposalRule) GetIndex() int32 { ...@@ -80,21 +112,44 @@ func (m *AutonomyProposalRule) GetIndex() int32 {
type ProposalRule struct { type ProposalRule struct {
// 提案时间 // 提案时间
Year int32 `protobuf:"varint,1,opt,name=year" json:"year,omitempty"` Year int32 `protobuf:"varint,1,opt,name=year,proto3" json:"year,omitempty"`
Month int32 `protobuf:"varint,2,opt,name=month" json:"month,omitempty"` Month int32 `protobuf:"varint,2,opt,name=month,proto3" json:"month,omitempty"`
Day int32 `protobuf:"varint,3,opt,name=day" json:"day,omitempty"` Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"`
// 规则可修改项,如果某项不修改则置为-1 // 规则可修改项,如果某项不修改则置为-1
RuleCfg *RuleConfig `protobuf:"bytes,4,opt,name=ruleCfg" json:"ruleCfg,omitempty"` RuleCfg *RuleConfig `protobuf:"bytes,4,opt,name=ruleCfg,proto3" json:"ruleCfg,omitempty"`
// 投票相关 // 投票相关
StartBlockHeight int64 `protobuf:"varint,5,opt,name=startBlockHeight" json:"startBlockHeight,omitempty"` StartBlockHeight int64 `protobuf:"varint,5,opt,name=startBlockHeight,proto3" json:"startBlockHeight,omitempty"`
EndBlockHeight int64 `protobuf:"varint,6,opt,name=endBlockHeight" json:"endBlockHeight,omitempty"` EndBlockHeight int64 `protobuf:"varint,6,opt,name=endBlockHeight,proto3" json:"endBlockHeight,omitempty"`
RealEndBlockHeight int64 `protobuf:"varint,7,opt,name=realEndBlockHeight" json:"realEndBlockHeight,omitempty"` RealEndBlockHeight int64 `protobuf:"varint,7,opt,name=realEndBlockHeight,proto3" json:"realEndBlockHeight,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ProposalRule) Reset() { *m = ProposalRule{} } func (m *ProposalRule) Reset() { *m = ProposalRule{} }
func (m *ProposalRule) String() string { return proto.CompactTextString(m) } func (m *ProposalRule) String() string { return proto.CompactTextString(m) }
func (*ProposalRule) ProtoMessage() {} func (*ProposalRule) ProtoMessage() {}
func (*ProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } func (*ProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{1}
}
func (m *ProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProposalRule.Unmarshal(m, b)
}
func (m *ProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProposalRule.Marshal(b, m, deterministic)
}
func (m *ProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProposalRule.Merge(m, src)
}
func (m *ProposalRule) XXX_Size() int {
return xxx_messageInfo_ProposalRule.Size(m)
}
func (m *ProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_ProposalRule.DiscardUnknown(m)
}
var xxx_messageInfo_ProposalRule proto.InternalMessageInfo
func (m *ProposalRule) GetYear() int32 { func (m *ProposalRule) GetYear() int32 {
if m != nil { if m != nil {
...@@ -146,13 +201,36 @@ func (m *ProposalRule) GetRealEndBlockHeight() int64 { ...@@ -146,13 +201,36 @@ func (m *ProposalRule) GetRealEndBlockHeight() int64 {
} }
type RevokeProposalRule struct { type RevokeProposalRule struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *RevokeProposalRule) Reset() { *m = RevokeProposalRule{} } func (m *RevokeProposalRule) Reset() { *m = RevokeProposalRule{} }
func (m *RevokeProposalRule) String() string { return proto.CompactTextString(m) } func (m *RevokeProposalRule) String() string { return proto.CompactTextString(m) }
func (*RevokeProposalRule) ProtoMessage() {} func (*RevokeProposalRule) ProtoMessage() {}
func (*RevokeProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } func (*RevokeProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{2}
}
func (m *RevokeProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RevokeProposalRule.Unmarshal(m, b)
}
func (m *RevokeProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RevokeProposalRule.Marshal(b, m, deterministic)
}
func (m *RevokeProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_RevokeProposalRule.Merge(m, src)
}
func (m *RevokeProposalRule) XXX_Size() int {
return xxx_messageInfo_RevokeProposalRule.Size(m)
}
func (m *RevokeProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_RevokeProposalRule.DiscardUnknown(m)
}
var xxx_messageInfo_RevokeProposalRule proto.InternalMessageInfo
func (m *RevokeProposalRule) GetProposalID() string { func (m *RevokeProposalRule) GetProposalID() string {
if m != nil { if m != nil {
...@@ -162,14 +240,37 @@ func (m *RevokeProposalRule) GetProposalID() string { ...@@ -162,14 +240,37 @@ func (m *RevokeProposalRule) GetProposalID() string {
} }
type VoteProposalRule struct { type VoteProposalRule struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Approve bool `protobuf:"varint,2,opt,name=approve" json:"approve,omitempty"` Approve bool `protobuf:"varint,2,opt,name=approve,proto3" json:"approve,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *VoteProposalRule) Reset() { *m = VoteProposalRule{} } func (m *VoteProposalRule) Reset() { *m = VoteProposalRule{} }
func (m *VoteProposalRule) String() string { return proto.CompactTextString(m) } func (m *VoteProposalRule) String() string { return proto.CompactTextString(m) }
func (*VoteProposalRule) ProtoMessage() {} func (*VoteProposalRule) ProtoMessage() {}
func (*VoteProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} } func (*VoteProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{3}
}
func (m *VoteProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VoteProposalRule.Unmarshal(m, b)
}
func (m *VoteProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoteProposalRule.Marshal(b, m, deterministic)
}
func (m *VoteProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoteProposalRule.Merge(m, src)
}
func (m *VoteProposalRule) XXX_Size() int {
return xxx_messageInfo_VoteProposalRule.Size(m)
}
func (m *VoteProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_VoteProposalRule.DiscardUnknown(m)
}
var xxx_messageInfo_VoteProposalRule proto.InternalMessageInfo
func (m *VoteProposalRule) GetProposalID() string { func (m *VoteProposalRule) GetProposalID() string {
if m != nil { if m != nil {
...@@ -186,13 +287,36 @@ func (m *VoteProposalRule) GetApprove() bool { ...@@ -186,13 +287,36 @@ func (m *VoteProposalRule) GetApprove() bool {
} }
type TerminateProposalRule struct { type TerminateProposalRule struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *TerminateProposalRule) Reset() { *m = TerminateProposalRule{} } func (m *TerminateProposalRule) Reset() { *m = TerminateProposalRule{} }
func (m *TerminateProposalRule) String() string { return proto.CompactTextString(m) } func (m *TerminateProposalRule) String() string { return proto.CompactTextString(m) }
func (*TerminateProposalRule) ProtoMessage() {} func (*TerminateProposalRule) ProtoMessage() {}
func (*TerminateProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{4} } func (*TerminateProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{4}
}
func (m *TerminateProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TerminateProposalRule.Unmarshal(m, b)
}
func (m *TerminateProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TerminateProposalRule.Marshal(b, m, deterministic)
}
func (m *TerminateProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_TerminateProposalRule.Merge(m, src)
}
func (m *TerminateProposalRule) XXX_Size() int {
return xxx_messageInfo_TerminateProposalRule.Size(m)
}
func (m *TerminateProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_TerminateProposalRule.DiscardUnknown(m)
}
var xxx_messageInfo_TerminateProposalRule proto.InternalMessageInfo
func (m *TerminateProposalRule) GetProposalID() string { func (m *TerminateProposalRule) GetProposalID() string {
if m != nil { if m != nil {
...@@ -203,14 +327,37 @@ func (m *TerminateProposalRule) GetProposalID() string { ...@@ -203,14 +327,37 @@ func (m *TerminateProposalRule) GetProposalID() string {
// receipt // receipt
type ReceiptProposalRule struct { type ReceiptProposalRule struct {
Prev *AutonomyProposalRule `protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"` Prev *AutonomyProposalRule `protobuf:"bytes,1,opt,name=prev,proto3" json:"prev,omitempty"`
Current *AutonomyProposalRule `protobuf:"bytes,2,opt,name=current" json:"current,omitempty"` Current *AutonomyProposalRule `protobuf:"bytes,2,opt,name=current,proto3" json:"current,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReceiptProposalRule) Reset() { *m = ReceiptProposalRule{} }
func (m *ReceiptProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReceiptProposalRule) ProtoMessage() {}
func (*ReceiptProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{5}
}
func (m *ReceiptProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptProposalRule.Unmarshal(m, b)
}
func (m *ReceiptProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptProposalRule.Marshal(b, m, deterministic)
}
func (m *ReceiptProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptProposalRule.Merge(m, src)
}
func (m *ReceiptProposalRule) XXX_Size() int {
return xxx_messageInfo_ReceiptProposalRule.Size(m)
}
func (m *ReceiptProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptProposalRule.DiscardUnknown(m)
} }
func (m *ReceiptProposalRule) Reset() { *m = ReceiptProposalRule{} } var xxx_messageInfo_ReceiptProposalRule proto.InternalMessageInfo
func (m *ReceiptProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReceiptProposalRule) ProtoMessage() {}
func (*ReceiptProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{5} }
func (m *ReceiptProposalRule) GetPrev() *AutonomyProposalRule { func (m *ReceiptProposalRule) GetPrev() *AutonomyProposalRule {
if m != nil { if m != nil {
...@@ -227,14 +374,37 @@ func (m *ReceiptProposalRule) GetCurrent() *AutonomyProposalRule { ...@@ -227,14 +374,37 @@ func (m *ReceiptProposalRule) GetCurrent() *AutonomyProposalRule {
} }
type LocalProposalRule struct { type LocalProposalRule struct {
PropRule *AutonomyProposalRule `protobuf:"bytes,1,opt,name=propRule" json:"propRule,omitempty"` PropRule *AutonomyProposalRule `protobuf:"bytes,1,opt,name=propRule,proto3" json:"propRule,omitempty"`
Comments []string `protobuf:"bytes,2,rep,name=comments" json:"comments,omitempty"` Comments []string `protobuf:"bytes,2,rep,name=comments,proto3" json:"comments,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *LocalProposalRule) Reset() { *m = LocalProposalRule{} } func (m *LocalProposalRule) Reset() { *m = LocalProposalRule{} }
func (m *LocalProposalRule) String() string { return proto.CompactTextString(m) } func (m *LocalProposalRule) String() string { return proto.CompactTextString(m) }
func (*LocalProposalRule) ProtoMessage() {} func (*LocalProposalRule) ProtoMessage() {}
func (*LocalProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{6} } func (*LocalProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{6}
}
func (m *LocalProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LocalProposalRule.Unmarshal(m, b)
}
func (m *LocalProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LocalProposalRule.Marshal(b, m, deterministic)
}
func (m *LocalProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_LocalProposalRule.Merge(m, src)
}
func (m *LocalProposalRule) XXX_Size() int {
return xxx_messageInfo_LocalProposalRule.Size(m)
}
func (m *LocalProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_LocalProposalRule.DiscardUnknown(m)
}
var xxx_messageInfo_LocalProposalRule proto.InternalMessageInfo
func (m *LocalProposalRule) GetPropRule() *AutonomyProposalRule { func (m *LocalProposalRule) GetPropRule() *AutonomyProposalRule {
if m != nil { if m != nil {
...@@ -252,17 +422,40 @@ func (m *LocalProposalRule) GetComments() []string { ...@@ -252,17 +422,40 @@ func (m *LocalProposalRule) GetComments() []string {
// query // query
type ReqQueryProposalRule struct { type ReqQueryProposalRule struct {
// 优先根据status查询 //优先根据status查询
Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"` Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,3,opt,name=direction" json:"direction,omitempty"` Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReqQueryProposalRule) Reset() { *m = ReqQueryProposalRule{} }
func (m *ReqQueryProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalRule) ProtoMessage() {}
func (*ReqQueryProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{7}
}
func (m *ReqQueryProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqQueryProposalRule.Unmarshal(m, b)
}
func (m *ReqQueryProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqQueryProposalRule.Marshal(b, m, deterministic)
}
func (m *ReqQueryProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqQueryProposalRule.Merge(m, src)
}
func (m *ReqQueryProposalRule) XXX_Size() int {
return xxx_messageInfo_ReqQueryProposalRule.Size(m)
}
func (m *ReqQueryProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_ReqQueryProposalRule.DiscardUnknown(m)
} }
func (m *ReqQueryProposalRule) Reset() { *m = ReqQueryProposalRule{} } var xxx_messageInfo_ReqQueryProposalRule proto.InternalMessageInfo
func (m *ReqQueryProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalRule) ProtoMessage() {}
func (*ReqQueryProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{7} }
func (m *ReqQueryProposalRule) GetStatus() int32 { func (m *ReqQueryProposalRule) GetStatus() int32 {
if m != nil { if m != nil {
...@@ -293,13 +486,36 @@ func (m *ReqQueryProposalRule) GetIndex() int64 { ...@@ -293,13 +486,36 @@ func (m *ReqQueryProposalRule) GetIndex() int64 {
} }
type ReplyQueryProposalRule struct { type ReplyQueryProposalRule struct {
PropRules []*AutonomyProposalRule `protobuf:"bytes,1,rep,name=propRules" json:"propRules,omitempty"` PropRules []*AutonomyProposalRule `protobuf:"bytes,1,rep,name=propRules,proto3" json:"propRules,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReplyQueryProposalRule) Reset() { *m = ReplyQueryProposalRule{} }
func (m *ReplyQueryProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalRule) ProtoMessage() {}
func (*ReplyQueryProposalRule) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{8}
}
func (m *ReplyQueryProposalRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyQueryProposalRule.Unmarshal(m, b)
}
func (m *ReplyQueryProposalRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyQueryProposalRule.Marshal(b, m, deterministic)
}
func (m *ReplyQueryProposalRule) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyQueryProposalRule.Merge(m, src)
}
func (m *ReplyQueryProposalRule) XXX_Size() int {
return xxx_messageInfo_ReplyQueryProposalRule.Size(m)
}
func (m *ReplyQueryProposalRule) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyQueryProposalRule.DiscardUnknown(m)
} }
func (m *ReplyQueryProposalRule) Reset() { *m = ReplyQueryProposalRule{} } var xxx_messageInfo_ReplyQueryProposalRule proto.InternalMessageInfo
func (m *ReplyQueryProposalRule) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalRule) ProtoMessage() {}
func (*ReplyQueryProposalRule) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{8} }
func (m *ReplyQueryProposalRule) GetPropRules() []*AutonomyProposalRule { func (m *ReplyQueryProposalRule) GetPropRules() []*AutonomyProposalRule {
if m != nil { if m != nil {
...@@ -310,14 +526,37 @@ func (m *ReplyQueryProposalRule) GetPropRules() []*AutonomyProposalRule { ...@@ -310,14 +526,37 @@ func (m *ReplyQueryProposalRule) GetPropRules() []*AutonomyProposalRule {
// TransferFund action // TransferFund action
type TransferFund struct { type TransferFund struct {
Amount int64 `protobuf:"varint,1,opt,name=amount" json:"amount,omitempty"` Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"`
Note string `protobuf:"bytes,2,opt,name=note" json:"note,omitempty"` Note string `protobuf:"bytes,2,opt,name=note,proto3" json:"note,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *TransferFund) Reset() { *m = TransferFund{} } func (m *TransferFund) Reset() { *m = TransferFund{} }
func (m *TransferFund) String() string { return proto.CompactTextString(m) } func (m *TransferFund) String() string { return proto.CompactTextString(m) }
func (*TransferFund) ProtoMessage() {} func (*TransferFund) ProtoMessage() {}
func (*TransferFund) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{9} } func (*TransferFund) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{9}
}
func (m *TransferFund) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TransferFund.Unmarshal(m, b)
}
func (m *TransferFund) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TransferFund.Marshal(b, m, deterministic)
}
func (m *TransferFund) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransferFund.Merge(m, src)
}
func (m *TransferFund) XXX_Size() int {
return xxx_messageInfo_TransferFund.Size(m)
}
func (m *TransferFund) XXX_DiscardUnknown() {
xxx_messageInfo_TransferFund.DiscardUnknown(m)
}
var xxx_messageInfo_TransferFund proto.InternalMessageInfo
func (m *TransferFund) GetAmount() int64 { func (m *TransferFund) GetAmount() int64 {
if m != nil { if m != nil {
...@@ -335,15 +574,38 @@ func (m *TransferFund) GetNote() string { ...@@ -335,15 +574,38 @@ func (m *TransferFund) GetNote() string {
// Comment action // Comment action
type Comment struct { type Comment struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
RepCmtHash string `protobuf:"bytes,2,opt,name=repCmtHash" json:"repCmtHash,omitempty"` RepCmtHash string `protobuf:"bytes,2,opt,name=repCmtHash,proto3" json:"repCmtHash,omitempty"`
Comment string `protobuf:"bytes,3,opt,name=comment" json:"comment,omitempty"` Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *Comment) Reset() { *m = Comment{} } func (m *Comment) Reset() { *m = Comment{} }
func (m *Comment) String() string { return proto.CompactTextString(m) } func (m *Comment) String() string { return proto.CompactTextString(m) }
func (*Comment) ProtoMessage() {} func (*Comment) ProtoMessage() {}
func (*Comment) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{10} } func (*Comment) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{10}
}
func (m *Comment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Comment.Unmarshal(m, b)
}
func (m *Comment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Comment.Marshal(b, m, deterministic)
}
func (m *Comment) XXX_Merge(src proto.Message) {
xxx_messageInfo_Comment.Merge(m, src)
}
func (m *Comment) XXX_Size() int {
return xxx_messageInfo_Comment.Size(m)
}
func (m *Comment) XXX_DiscardUnknown() {
xxx_messageInfo_Comment.DiscardUnknown(m)
}
var xxx_messageInfo_Comment proto.InternalMessageInfo
func (m *Comment) GetProposalID() string { func (m *Comment) GetProposalID() string {
if m != nil { if m != nil {
...@@ -367,15 +629,38 @@ func (m *Comment) GetComment() string { ...@@ -367,15 +629,38 @@ func (m *Comment) GetComment() string {
} }
type ReceiptProposalComment struct { type ReceiptProposalComment struct {
Cmt *Comment `protobuf:"bytes,1,opt,name=cmt" json:"cmt,omitempty"` Cmt *Comment `protobuf:"bytes,1,opt,name=cmt,proto3" json:"cmt,omitempty"`
Height int64 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"` Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ReceiptProposalComment) Reset() { *m = ReceiptProposalComment{} } func (m *ReceiptProposalComment) Reset() { *m = ReceiptProposalComment{} }
func (m *ReceiptProposalComment) String() string { return proto.CompactTextString(m) } func (m *ReceiptProposalComment) String() string { return proto.CompactTextString(m) }
func (*ReceiptProposalComment) ProtoMessage() {} func (*ReceiptProposalComment) ProtoMessage() {}
func (*ReceiptProposalComment) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{11} } func (*ReceiptProposalComment) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{11}
}
func (m *ReceiptProposalComment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiptProposalComment.Unmarshal(m, b)
}
func (m *ReceiptProposalComment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReceiptProposalComment.Marshal(b, m, deterministic)
}
func (m *ReceiptProposalComment) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReceiptProposalComment.Merge(m, src)
}
func (m *ReceiptProposalComment) XXX_Size() int {
return xxx_messageInfo_ReceiptProposalComment.Size(m)
}
func (m *ReceiptProposalComment) XXX_DiscardUnknown() {
xxx_messageInfo_ReceiptProposalComment.DiscardUnknown(m)
}
var xxx_messageInfo_ReceiptProposalComment proto.InternalMessageInfo
func (m *ReceiptProposalComment) GetCmt() *Comment { func (m *ReceiptProposalComment) GetCmt() *Comment {
if m != nil { if m != nil {
...@@ -400,16 +685,39 @@ func (m *ReceiptProposalComment) GetIndex() int32 { ...@@ -400,16 +685,39 @@ func (m *ReceiptProposalComment) GetIndex() int32 {
// query // query
type ReqQueryProposalComment struct { type ReqQueryProposalComment struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` ProposalID string `protobuf:"bytes,1,opt,name=proposalID,proto3" json:"proposalID,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
Direction int32 `protobuf:"varint,3,opt,name=direction" json:"direction,omitempty"` Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` Index int64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ReqQueryProposalComment) Reset() { *m = ReqQueryProposalComment{} } func (m *ReqQueryProposalComment) Reset() { *m = ReqQueryProposalComment{} }
func (m *ReqQueryProposalComment) String() string { return proto.CompactTextString(m) } func (m *ReqQueryProposalComment) String() string { return proto.CompactTextString(m) }
func (*ReqQueryProposalComment) ProtoMessage() {} func (*ReqQueryProposalComment) ProtoMessage() {}
func (*ReqQueryProposalComment) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{12} } func (*ReqQueryProposalComment) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{12}
}
func (m *ReqQueryProposalComment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReqQueryProposalComment.Unmarshal(m, b)
}
func (m *ReqQueryProposalComment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReqQueryProposalComment.Marshal(b, m, deterministic)
}
func (m *ReqQueryProposalComment) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReqQueryProposalComment.Merge(m, src)
}
func (m *ReqQueryProposalComment) XXX_Size() int {
return xxx_messageInfo_ReqQueryProposalComment.Size(m)
}
func (m *ReqQueryProposalComment) XXX_DiscardUnknown() {
xxx_messageInfo_ReqQueryProposalComment.DiscardUnknown(m)
}
var xxx_messageInfo_ReqQueryProposalComment proto.InternalMessageInfo
func (m *ReqQueryProposalComment) GetProposalID() string { func (m *ReqQueryProposalComment) GetProposalID() string {
if m != nil { if m != nil {
...@@ -440,16 +748,39 @@ func (m *ReqQueryProposalComment) GetIndex() int64 { ...@@ -440,16 +748,39 @@ func (m *ReqQueryProposalComment) GetIndex() int64 {
} }
type RelationCmt struct { type RelationCmt struct {
RepCmtHash string `protobuf:"bytes,1,opt,name=repCmtHash" json:"repCmtHash,omitempty"` RepCmtHash string `protobuf:"bytes,1,opt,name=repCmtHash,proto3" json:"repCmtHash,omitempty"`
Comment string `protobuf:"bytes,2,opt,name=comment" json:"comment,omitempty"` Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"`
Height int64 `protobuf:"varint,3,opt,name=height" json:"height,omitempty"` Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
Index int32 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` Index int32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RelationCmt) Reset() { *m = RelationCmt{} }
func (m *RelationCmt) String() string { return proto.CompactTextString(m) }
func (*RelationCmt) ProtoMessage() {}
func (*RelationCmt) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{13}
}
func (m *RelationCmt) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RelationCmt.Unmarshal(m, b)
}
func (m *RelationCmt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RelationCmt.Marshal(b, m, deterministic)
}
func (m *RelationCmt) XXX_Merge(src proto.Message) {
xxx_messageInfo_RelationCmt.Merge(m, src)
}
func (m *RelationCmt) XXX_Size() int {
return xxx_messageInfo_RelationCmt.Size(m)
}
func (m *RelationCmt) XXX_DiscardUnknown() {
xxx_messageInfo_RelationCmt.DiscardUnknown(m)
} }
func (m *RelationCmt) Reset() { *m = RelationCmt{} } var xxx_messageInfo_RelationCmt proto.InternalMessageInfo
func (m *RelationCmt) String() string { return proto.CompactTextString(m) }
func (*RelationCmt) ProtoMessage() {}
func (*RelationCmt) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{13} }
func (m *RelationCmt) GetRepCmtHash() string { func (m *RelationCmt) GetRepCmtHash() string {
if m != nil { if m != nil {
...@@ -480,13 +811,36 @@ func (m *RelationCmt) GetIndex() int32 { ...@@ -480,13 +811,36 @@ func (m *RelationCmt) GetIndex() int32 {
} }
type ReplyQueryProposalComment struct { type ReplyQueryProposalComment struct {
RltCmt []*RelationCmt `protobuf:"bytes,1,rep,name=rltCmt" json:"rltCmt,omitempty"` RltCmt []*RelationCmt `protobuf:"bytes,1,rep,name=rltCmt,proto3" json:"rltCmt,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReplyQueryProposalComment) Reset() { *m = ReplyQueryProposalComment{} }
func (m *ReplyQueryProposalComment) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalComment) ProtoMessage() {}
func (*ReplyQueryProposalComment) Descriptor() ([]byte, []int) {
return fileDescriptor_07e8e0fa338d4596, []int{14}
}
func (m *ReplyQueryProposalComment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyQueryProposalComment.Unmarshal(m, b)
}
func (m *ReplyQueryProposalComment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyQueryProposalComment.Marshal(b, m, deterministic)
}
func (m *ReplyQueryProposalComment) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyQueryProposalComment.Merge(m, src)
}
func (m *ReplyQueryProposalComment) XXX_Size() int {
return xxx_messageInfo_ReplyQueryProposalComment.Size(m)
}
func (m *ReplyQueryProposalComment) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyQueryProposalComment.DiscardUnknown(m)
} }
func (m *ReplyQueryProposalComment) Reset() { *m = ReplyQueryProposalComment{} } var xxx_messageInfo_ReplyQueryProposalComment proto.InternalMessageInfo
func (m *ReplyQueryProposalComment) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalComment) ProtoMessage() {}
func (*ReplyQueryProposalComment) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{14} }
func (m *ReplyQueryProposalComment) GetRltCmt() []*RelationCmt { func (m *ReplyQueryProposalComment) GetRltCmt() []*RelationCmt {
if m != nil { if m != nil {
...@@ -513,9 +867,9 @@ func init() { ...@@ -513,9 +867,9 @@ func init() {
proto.RegisterType((*ReplyQueryProposalComment)(nil), "types.ReplyQueryProposalComment") proto.RegisterType((*ReplyQueryProposalComment)(nil), "types.ReplyQueryProposalComment")
} }
func init() { proto.RegisterFile("rule.proto", fileDescriptor4) } func init() { proto.RegisterFile("rule.proto", fileDescriptor_07e8e0fa338d4596) }
var fileDescriptor4 = []byte{ var fileDescriptor_07e8e0fa338d4596 = []byte{
// 678 bytes of a gzipped FileDescriptorProto // 678 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xdb, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xdb, 0x38,
0x10, 0x85, 0x2c, 0xcb, 0x8e, 0x26, 0xd9, 0x20, 0x61, 0xbc, 0x59, 0x6d, 0x5a, 0x04, 0x86, 0x0e, 0x10, 0x85, 0x2c, 0xcb, 0x8e, 0x26, 0xd9, 0x20, 0x61, 0xbc, 0x59, 0x6d, 0x5a, 0x04, 0x86, 0x0e,
......
...@@ -6,6 +6,7 @@ package types ...@@ -6,6 +6,7 @@ package types
import ( import (
"reflect" "reflect"
log "github.com/33cn/chain33/common/log/log15" log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
) )
...@@ -47,24 +48,23 @@ func (a *AutonomyType) GetName() string { ...@@ -47,24 +48,23 @@ func (a *AutonomyType) GetName() string {
// GetLogMap 获得日志类型列表 // GetLogMap 获得日志类型列表
func (a *AutonomyType) GetLogMap() map[int64]*types.LogInfo { func (a *AutonomyType) GetLogMap() map[int64]*types.LogInfo {
return map[int64]*types.LogInfo{ return map[int64]*types.LogInfo{
TyLogPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogPropBoard"}, TyLogPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogPropBoard"},
TyLogRvkPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogRvkPropBoard"}, TyLogRvkPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogRvkPropBoard"},
TyLogVotePropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogVotePropBoard"}, TyLogVotePropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogVotePropBoard"},
TyLogTmintPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogTmintPropBoard"}, TyLogTmintPropBoard: {Ty: reflect.TypeOf(ReceiptProposalBoard{}), Name: "LogTmintPropBoard"},
TyLogPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogPropProject"}, TyLogPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogPropProject"},
TyLogRvkPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogRvkPropProject"}, TyLogRvkPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogRvkPropProject"},
TyLogVotePropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogVotePropProject"}, TyLogVotePropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogVotePropProject"},
TyLogPubVotePropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogPubVotePropProject"}, TyLogPubVotePropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogPubVotePropProject"},
TyLogTmintPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogTmintPropProject"}, TyLogTmintPropProject: {Ty: reflect.TypeOf(ReceiptProposalProject{}), Name: "LogTmintPropProject"},
TyLogPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogPropRule"}, TyLogPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogPropRule"},
TyLogRvkPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogRvkPropRule"}, TyLogRvkPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogRvkPropRule"},
TyLogVotePropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogVotePropRule"}, TyLogVotePropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogVotePropRule"},
TyLogTmintPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogTmintPropRule"}, TyLogTmintPropRule: {Ty: reflect.TypeOf(ReceiptProposalRule{}), Name: "LogTmintPropRule"},
TyLogCommentProp: {Ty: reflect.TypeOf(ReceiptProposalComment{}), Name: "LogCommentProp"}, TyLogCommentProp: {Ty: reflect.TypeOf(ReceiptProposalComment{}), Name: "LogCommentProp"},
} }
} }
...@@ -76,23 +76,23 @@ func (a *AutonomyType) GetPayload() types.Message { ...@@ -76,23 +76,23 @@ func (a *AutonomyType) GetPayload() types.Message {
// GetTypeMap 获得Action 方法列表 // GetTypeMap 获得Action 方法列表
func (a *AutonomyType) GetTypeMap() map[string]int32 { func (a *AutonomyType) GetTypeMap() map[string]int32 {
return map[string]int32{ return map[string]int32{
"PropBoard": AutonomyActionPropBoard, "PropBoard": AutonomyActionPropBoard,
"RvkPropBoard": AutonomyActionRvkPropBoard, "RvkPropBoard": AutonomyActionRvkPropBoard,
"VotePropBoard": AutonomyActionVotePropBoard, "VotePropBoard": AutonomyActionVotePropBoard,
"TmintPropBoard": AutonomyActionTmintPropBoard, "TmintPropBoard": AutonomyActionTmintPropBoard,
"PropProject": AutonomyActionPropProject, "PropProject": AutonomyActionPropProject,
"RvkPropProject": AutonomyActionRvkPropProject, "RvkPropProject": AutonomyActionRvkPropProject,
"VotePropProject": AutonomyActionVotePropProject, "VotePropProject": AutonomyActionVotePropProject,
"PubVotePropProject": AutonomyActionPubVotePropProject, "PubVotePropProject": AutonomyActionPubVotePropProject,
"TmintPropProject": AutonomyActionTmintPropProject, "TmintPropProject": AutonomyActionTmintPropProject,
"PropRule": AutonomyActionPropRule, "PropRule": AutonomyActionPropRule,
"RvkPropRule": AutonomyActionRvkPropRule, "RvkPropRule": AutonomyActionRvkPropRule,
"VotePropRule": AutonomyActionVotePropRule, "VotePropRule": AutonomyActionVotePropRule,
"TmintPropRule": AutonomyActionTmintPropRule, "TmintPropRule": AutonomyActionTmintPropRule,
"Transfer": AutonomyActionTransfer, "Transfer": AutonomyActionTransfer,
"CommentProp": AutonomyActionCommentProp, "CommentProp": AutonomyActionCommentProp,
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment