Commit 579ca570 authored by liuyuhang's avatar liuyuhang Committed by 33cn

add prob project

parent 0b56fd16
......@@ -66,7 +66,7 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
cur := &auty.AutonomyProposalBoard{
PropBoard:prob,
Res: &auty.VotesResult{},
VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalBoard,
Address: a.fromaddr,
Height: a.height,
......@@ -202,13 +202,13 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
// 加入已经投票的
votes.Address = append(votes.Address, a.fromaddr)
if cur.GetRes().TotalVotes == 0 { //需要统计票数
if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数
addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account, err := a.getStartHeightVoteAccount(addr, start)
if err != nil {
return nil, err
}
cur.Res.TotalVotes = int32(account.Balance/ticketPrice)
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice)
}
account, err := a.getStartHeightVoteAccount(a.fromaddr, start)
......@@ -216,17 +216,17 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
return nil, err
}
if voteProb.Approve {
cur.Res.ApproveVotes += int32(account.Balance/ticketPrice)
cur.VoteResult.ApproveVotes += int32(account.Balance/ticketPrice)
} else {
cur.Res.OpposeVotes += int32(account.Balance/ticketPrice)
cur.VoteResult.OpposeVotes += int32(account.Balance/ticketPrice)
}
var logs []*types.ReceiptLog
var kv []*types.KeyValue
if float32(cur.Res.ApproveVotes + cur.Res.OpposeVotes) / float32(cur.Res.TotalVotes) >= participationRate &&
float32(cur.Res.ApproveVotes) / float32(cur.Res.ApproveVotes + cur.Res.OpposeVotes) >= approveRate {
cur.Res.Pass = true
if float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= participationRate &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= approveRate {
cur.VoteResult.Pass = true
cur.PropBoard.RealEndBlockHeight = a.height
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, autonomyAddr, a.execaddr, lockAmount)
......@@ -240,7 +240,7 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
key := propBoardID(voteProb.ProposalID)
cur.Status = auty.AutonomyStatusVotePropBoard
if cur.Res.Pass {
if cur.VoteResult.Pass {
cur.Status = auty.AutonomyStatusTmintPropBoard
}
value = types.Encode(&cur)
......@@ -250,7 +250,7 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
kv = append(kv, &types.KeyValue{Key: VotesRecord(voteProb.ProposalID), Value: types.Encode(&votes)})
ty := auty.TyLogVotePropBoard
if cur.Res.Pass {
if cur.VoteResult.Pass {
ty = auty.TyLogTmintPropBoard
}
receiptLog := getReceiptLog(pre, &cur, int32(ty))
......@@ -293,20 +293,20 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
return nil, err
}
if cur.GetRes().TotalVotes == 0 { //需要统计票数
if cur.GetVoteResult().TotalVotes == 0 { //需要统计票数
addr := "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp"
account, err := a.getStartHeightVoteAccount(addr, start)
if err != nil {
return nil, err
}
cur.Res.TotalVotes = int32(account.Balance/ticketPrice)
cur.VoteResult.TotalVotes = int32(account.Balance/ticketPrice)
}
if float32(cur.Res.ApproveVotes + cur.Res.OpposeVotes) / float32(cur.Res.TotalVotes) >= participationRate &&
float32(cur.Res.ApproveVotes) / float32(cur.Res.ApproveVotes + cur.Res.OpposeVotes) >= approveRate {
cur.Res.Pass = true
if float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) / float32(cur.VoteResult.TotalVotes) >= participationRate &&
float32(cur.VoteResult.ApproveVotes) / float32(cur.VoteResult.ApproveVotes + cur.VoteResult.OpposeVotes) >= approveRate {
cur.VoteResult.Pass = true
} else {
cur.Res.Pass = false
cur.VoteResult.Pass = false
}
cur.PropBoard.RealEndBlockHeight = a.height
......@@ -366,9 +366,9 @@ func getReceiptLog(pre, cur *auty.AutonomyProposalBoard, ty int32) *types.Receip
func copyAutonomyProposalBoard(cur *auty.AutonomyProposalBoard) *auty.AutonomyProposalBoard {
newAut := *cur
newBoard := *cur.GetPropBoard()
newRes := *cur.GetRes()
newRes := *cur.GetVoteResult()
newAut.PropBoard = &newBoard
newAut.Res = &newRes
newAut.VoteResult = &newRes
return &newAut
}
......@@ -35,9 +35,6 @@ type execEnv struct {
}
var (
Symbol = "BTY"
Asset = "coins"
PrivKeyA = "0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" // 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyB = "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" // 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
PrivKeyC = "0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115" // 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k
......@@ -47,18 +44,6 @@ var (
AddrC = "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
AddrD = "1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
AddrBWeight uint64 = 1
AddrCWeight uint64 = 4
AddrDWeight uint64 = 10
NewWeight uint64 = 2
Requiredweight uint64 = 5
NewRequiredweight uint64 = 4
CoinsBtyDailylimit uint64 = 100
NewCoinsBtyDailylimit uint64 = 10
PrintFlag = false
InAmount int64 = 10
OutAmount int64 = 5
boards = []string{"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4", "1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR", "1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"}
total = types.Coin * 30000
)
......@@ -344,7 +329,7 @@ func voteProposalBoard(t *testing.T, env *execEnv, exec drivers.Driver, stateDB
require.NoError(t, err)
require.Equal(t, int32(auty.AutonomyStatusTmintPropBoard), cur.Status)
require.Equal(t, AddrA, cur.Address)
require.Equal(t, true, cur.Res.Pass)
require.Equal(t, true, cur.VoteResult.Pass)
}
func voteProposalBoardTx(parm *auty.VoteProposalBoard) (*types.Transaction, error) {
......@@ -452,13 +437,13 @@ func TestGetStartHeightVoteAccount(t *testing.T) {
func TestGetReceiptLog(t *testing.T) {
pre := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1800, Month: 1},
Res: &auty.VotesResult{TotalVotes: 100},
VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 1,
Address:"121",
}
cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1},
Res: &auty.VotesResult{TotalVotes: 100},
VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2,
Address:"123",
}
......@@ -474,20 +459,20 @@ func TestGetReceiptLog(t *testing.T) {
func TestCopyAutonomyProposalBoard(t *testing.T) {
cur := &auty.AutonomyProposalBoard{
PropBoard: &auty.ProposalBoard{Year: 1900, Month: 1},
Res: &auty.VotesResult{TotalVotes: 100},
VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2,
Address:"123",
}
new := copyAutonomyProposalBoard(cur)
cur.PropBoard.Year = 1800
cur.PropBoard.Month = 2
cur.Res.TotalVotes = 50
cur.VoteResult.TotalVotes = 50
cur.Address = "234"
cur.Status = 1
require.Equal(t, 1900, int(new.PropBoard.Year))
require.Equal(t, 1, int(new.PropBoard.Month))
require.Equal(t, 100, int(new.Res.TotalVotes))
require.Equal(t, 100, int(new.VoteResult.TotalVotes))
require.Equal(t, "123", new.Address)
require.Equal(t, 2, int(new.Status))
}
......
......@@ -9,6 +9,7 @@ import (
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
)
// 提案董事会相关
// Exec_PropBoard 创建提案
func (a *Autonomy) Exec_PropBoard(payload *auty.ProposalBoard, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
......@@ -31,4 +32,35 @@ func (a *Autonomy) Exec_VotePropBoard(payload *auty.VoteProposalBoard, tx *types
func (a *Autonomy) Exec_TmintPropBoard(payload *auty.TerminateProposalBoard, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.tmintPropBoard(payload)
}
// 提案项目相关
// Exec_PropProject 创建提案项目
func (a *Autonomy) Exec_PropProject(payload *auty.ProposalProject, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.propProject(payload)
}
// Exec_RvkPropBoard 撤销提案项目
func (a *Autonomy) Exec_RvkPropProject(payload *auty.RevokeProposalProject, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.rvkPropProject(payload)
}
// Exec_VotePropBoard 投票提案项目
func (a *Autonomy) Exec_VotePropProject(payload *auty.VoteProposalProject, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.votePropProject(payload)
}
// Exec_VotePropBoard 投票提案项目
func (a *Autonomy) Exec_PubVotePropProject(payload *auty.PubVoteProposalProject, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.pubVotePropProject(payload)
}
// Exec_TmintPropBoard 终止提案项目
func (a *Autonomy) Exec_TmintPropProject(payload *auty.TerminateProposalProject, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newAction(a, tx, int32(index))
return action.tmintPropProject(payload)
}
\ No newline at end of file
......@@ -17,21 +17,40 @@ var (
localPrefix = "LOCDB" + auty.AutonomyX + "-"
)
func VotesRecord(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", votesRecordPrefix, txHash))
}
var (
// board
boardPrefix = idPrefix + "board" + "-"
localBoardPrefix = localPrefix + "board" + "-"
)
func propBoardID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", boardPrefix, txHash))
}
func VotesRecord(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", votesRecordPrefix, txHash))
func calcBoardKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localBoardPrefix + "%d-" +"%s", status, heightindex)
return []byte(key)
}
func calcBoardKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localPrefix + "%d-" +"%s", status, heightindex)
var (
// project
projectPrefix = idPrefix + "project" + "-"
localProjectPrefix = localPrefix + "project" + "-"
)
func propProjectID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", projectPrefix, txHash))
}
func calcProjectKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localProjectPrefix + "%d-" +"%s", status, heightindex)
return []byte(key)
}
This diff is collapsed.
......@@ -20,15 +20,16 @@ message AutonomyAction {
VoteProposalBoard votePropBoard = 3;
TerminateProposalBoard tmintPropBoard = 4;
// 提案项目相关
ProposalProject propProject = 5;
RevokeProposalProject rvkPropProject = 6;
VoteProposalBoard votePropProject = 7;
TerminateProposalProject tmintPropProject = 8;
ProposalProject propProject = 5;
RevokeProposalProject rvkPropProject = 6;
VoteProposalProject votePropProject = 7;
PubVoteProposalProject pubVotePropProject = 8;
TerminateProposalProject tmintPropProject = 9;
// 提案规则修改相关
ProposalRule propRule = 9;
RevokeProposalRule rvkPropRule = 10;
VoteProposalBoard votePropRule = 11;
TerminateProposalRule tmintPropRule = 12;
ProposalRule propRule = 10;
RevokeProposalRule rvkPropRule = 11;
VoteProposalRule votePropRule = 12;
TerminateProposalRule tmintPropRule = 13;
}
int32 ty = 13;
int32 ty = 14;
}
\ No newline at end of file
......@@ -10,14 +10,14 @@ package types;
message AutonomyProposalBoard {
ProposalBoard propBoard = 1;
ProposalBoard propBoard = 1;
// 全体持票人投票结果
VotesResult res = 2;
VoteResult voteResult = 2;
// 状态
int32 status = 3;
string address = 4;
int64 height = 5;
int32 index = 6;
int32 status = 3;
string address = 4;
int64 height = 5;
int32 index = 6;
}
// action
......
......@@ -6,7 +6,7 @@ syntax = "proto3";
package types;
message VotesResult {
message VoteResult {
// 总票数
int32 totalVotes = 1;
// 赞成票
......@@ -17,6 +17,15 @@ message VotesResult {
bool pass = 4;
}
message PublicVote {
// 是否需要公示
bool publicity = 1;
// 全体持票人反对票
int32 opposeVotes = 2;
// 是否通过
bool pubPass = 3;
}
message VotesRecord {
repeated string address = 1;
}
\ No newline at end of file
......@@ -9,17 +9,16 @@ import "lcommon.proto";
package types;
message AutonomyProposalProject {
ProposalProject propProject = 1;
ProposalProject propProject = 1;
// 董事会投票结果
VotesResult boardResult = 2;
// 是否需要公示
bool publicity = 3;
// 全体持票人反对票
int32 opposeVotes = 4;
// 是否通过
bool pubPass = 5;
VoteResult boardVoteRes = 2;
// 公示投票
PublicVote pubVote = 3;
// 状态
int32 status = 6;
int32 status = 4;
string address = 5;
int64 height = 6;
int32 index = 7;
}
message ProposalProject {
......@@ -34,7 +33,7 @@ message ProposalProject {
string production = 6; // 项目地址
string description = 7; // 项目阶段性简述
string contractor = 8; // 承包人
int32 amount = 9; // 项目经费
int64 amount = 9; // 项目经费
string amountDetail = 10; // 经费细则
// 支付相关
......@@ -51,6 +50,16 @@ message RevokeProposalProject {
string proposalID = 1;
}
message VoteProposalProject {
string proposalID = 1;
bool approve = 2;
}
message PubVoteProposalProject {
string proposalID = 1;
bool oppose = 2;
}
message TerminateProposalProject {
string proposalID = 1;
}
......
......@@ -11,7 +11,7 @@ package types;
message AutonomyProposalRule {
ProposalRule propRule = 1;
// 全体持票人投票结果
VotesResult res = 2;
VoteResult res = 2;
// 状态
int32 status = 3;
}
......@@ -39,6 +39,11 @@ message RevokeProposalRule {
string proposalID = 1;
}
message VoteProposalRule {
string proposalID = 1;
bool approve = 2;
}
message TerminateProposalRule {
string proposalID = 1;
}
......
This diff is collapsed.
......@@ -15,7 +15,7 @@ var _ = math.Inf
type AutonomyProposalBoard struct {
PropBoard *ProposalBoard `protobuf:"bytes,1,opt,name=propBoard" json:"propBoard,omitempty"`
// 全体持票人投票结果
Res *VotesResult `protobuf:"bytes,2,opt,name=res" json:"res,omitempty"`
VoteResult *VoteResult `protobuf:"bytes,2,opt,name=voteResult" json:"voteResult,omitempty"`
// 状态
Status int32 `protobuf:"varint,3,opt,name=status" json:"status,omitempty"`
Address string `protobuf:"bytes,4,opt,name=address" json:"address,omitempty"`
......@@ -35,9 +35,9 @@ func (m *AutonomyProposalBoard) GetPropBoard() *ProposalBoard {
return nil
}
func (m *AutonomyProposalBoard) GetRes() *VotesResult {
func (m *AutonomyProposalBoard) GetVoteResult() *VoteResult {
if m != nil {
return m.Res
return m.VoteResult
}
return nil
}
......@@ -316,37 +316,37 @@ func init() {
func init() { proto.RegisterFile("board.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{
// 498 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x8b, 0xd4, 0x30,
0x14, 0x25, 0x76, 0x3a, 0xb3, 0xbd, 0xcb, 0xca, 0x1a, 0x67, 0xd7, 0xb2, 0x2c, 0x52, 0x8a, 0x48,
0xf1, 0x61, 0x90, 0xf5, 0x03, 0xf1, 0xcd, 0x41, 0x41, 0x41, 0x41, 0x83, 0xfa, 0x9e, 0x6d, 0xaf,
0x4e, 0xd9, 0xb6, 0x89, 0x49, 0x3a, 0xd8, 0x37, 0xff, 0xa2, 0xbf, 0xc2, 0xbf, 0x21, 0x49, 0x33,
0x76, 0xba, 0x0e, 0xba, 0xfb, 0xd6, 0x73, 0x73, 0x6e, 0x72, 0x4f, 0x72, 0x4e, 0x61, 0xff, 0x5c,
0x70, 0x55, 0x2c, 0xa4, 0x12, 0x46, 0xd0, 0xd0, 0x74, 0x12, 0xf5, 0xc9, 0x41, 0x95, 0x8b, 0xba,
0x16, 0x4d, 0x5f, 0x4d, 0x7f, 0x12, 0x38, 0x7a, 0xd1, 0x1a, 0xd1, 0x88, 0xba, 0x7b, 0xaf, 0x84,
0x14, 0x9a, 0x57, 0x4b, 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 0x3b, 0x00, 0x00, 0xff, 0xff, 0x83, 0xda, 0x5e, 0xb4, 0x66, 0x04,
0x00, 0x00,
// 499 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd4, 0x30,
0x10, 0x95, 0xbb, 0x9b, 0xb4, 0x99, 0xaa, 0xa8, 0x35, 0xdb, 0x12, 0x55, 0x15, 0x8a, 0x72, 0x40,
0x11, 0x87, 0x15, 0x94, 0x0f, 0x21, 0x6e, 0xac, 0x40, 0x02, 0x09, 0x24, 0xb0, 0x80, 0xbb, 0x9b,
0x0c, 0x6c, 0xd4, 0x24, 0x36, 0x8e, 0xb3, 0x22, 0x37, 0x7e, 0x29, 0x57, 0xfe, 0x06, 0xca, 0xc4,
0xdb, 0x6c, 0xca, 0x0a, 0xe8, 0x2d, 0x6f, 0xfc, 0x9e, 0x3d, 0x63, 0xbf, 0x17, 0xd8, 0xbf, 0x50,
0xd2, 0x64, 0x73, 0x6d, 0x94, 0x55, 0xdc, 0xb3, 0xad, 0xc6, 0xfa, 0xf4, 0xa0, 0x48, 0x55, 0x59,
0xaa, 0xaa, 0xaf, 0xc6, 0x3f, 0x19, 0x1c, 0xbf, 0x68, 0xac, 0xaa, 0x54, 0xd9, 0xbe, 0x37, 0x4a,
0xab, 0x5a, 0x16, 0x8b, 0x4e, 0xc5, 0xcf, 0x21, 0xd0, 0x46, 0x69, 0x02, 0x21, 0x8b, 0x58, 0xb2,
0x7f, 0x3e, 0x9b, 0xd3, 0x1e, 0xf3, 0x11, 0x51, 0x0c, 0x34, 0xfe, 0x10, 0x60, 0xa5, 0x2c, 0x0a,
0xac, 0x9b, 0xc2, 0x86, 0x3b, 0x24, 0x3a, 0x72, 0xa2, 0xcf, 0x57, 0x0b, 0x62, 0x83, 0xc4, 0x4f,
0xc0, 0xaf, 0xad, 0xb4, 0x4d, 0x1d, 0x4e, 0x22, 0x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0x6b, 0x3b, 0x16, 0x3e, 0x80, 0xa9, 0x36, 0xb8, 0x72, 0x26, 0x3c, 0x73, 0x7e, 0xda, 0xea, 0x5a,
0x41, 0x4c, 0xfe, 0x14, 0x76, 0xd3, 0xc6, 0x18, 0xac, 0xd6, 0x26, 0xfc, 0xbb, 0x68, 0x4d, 0x8e,
0xbf, 0x00, 0x7f, 0xab, 0x52, 0x59, 0x8c, 0xcf, 0x7f, 0x0c, 0x3e, 0x59, 0x3c, 0xfb, 0xaf, 0x0e,
0x1c, 0x97, 0x9f, 0xc2, 0x5e, 0x97, 0x34, 0xac, 0x6c, 0x1d, 0xee, 0x90, 0x59, 0xae, 0x70, 0xdc,
0xc2, 0xb1, 0xc0, 0x6f, 0x1f, 0x1a, 0x34, 0xd7, 0x42, 0x37, 0xa4, 0x81, 0x8d, 0xd2, 0x30, 0x03,
0x2f, 0x55, 0x8d, 0x1b, 0xc7, 0x13, 0x3d, 0xe0, 0x67, 0x10, 0x64, 0xb9, 0xc1, 0xd4, 0xe6, 0xaa,
0x72, 0x2e, 0x1d, 0x0a, 0x43, 0x1e, 0xa6, 0x64, 0x19, 0x97, 0x87, 0x4f, 0x70, 0x47, 0xa0, 0x2e,
0xda, 0x2d, 0x87, 0x3f, 0xa7, 0xc4, 0x2f, 0x7a, 0x7f, 0xb3, 0x68, 0xf2, 0xcf, 0x51, 0x07, 0xfa,
0x85, 0x4f, 0xbf, 0x93, 0x47, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xce, 0x7c, 0xf0, 0x73,
0x04, 0x00, 0x00,
}
......@@ -70,6 +70,20 @@ const (
)
const (
AutonomyStatusProposalProject = iota + 1
AutonomyStatusRvkPropProject
AutonomyStatusVotePropProject
AutonomyStatusTmintPropProject
)
const (
AutonomyStatusProposalRule = iota + 1
AutonomyStatusRvkPropRule
AutonomyStatusVotePropRule
AutonomyStatusTmintPropRule
)
const (
// GetProposalBoard 用于在cmd里面的区分不同的查询
GetProposalBoard = "GetProposalBoard"
// GetProposalProject 用于在cmd里面的区分不同的查询
......
......@@ -12,7 +12,7 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type VotesResult struct {
type VoteResult struct {
// 总票数
TotalVotes int32 `protobuf:"varint,1,opt,name=totalVotes" json:"totalVotes,omitempty"`
// 赞成票
......@@ -23,39 +23,74 @@ type VotesResult struct {
Pass bool `protobuf:"varint,4,opt,name=pass" json:"pass,omitempty"`
}
func (m *VotesResult) Reset() { *m = VotesResult{} }
func (m *VotesResult) String() string { return proto.CompactTextString(m) }
func (*VotesResult) ProtoMessage() {}
func (*VotesResult) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
func (m *VoteResult) Reset() { *m = VoteResult{} }
func (m *VoteResult) String() string { return proto.CompactTextString(m) }
func (*VoteResult) ProtoMessage() {}
func (*VoteResult) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
func (m *VotesResult) GetTotalVotes() int32 {
func (m *VoteResult) GetTotalVotes() int32 {
if m != nil {
return m.TotalVotes
}
return 0
}
func (m *VotesResult) GetApproveVotes() int32 {
func (m *VoteResult) GetApproveVotes() int32 {
if m != nil {
return m.ApproveVotes
}
return 0
}
func (m *VotesResult) GetOpposeVotes() int32 {
func (m *VoteResult) GetOpposeVotes() int32 {
if m != nil {
return m.OpposeVotes
}
return 0
}
func (m *VotesResult) GetPass() bool {
func (m *VoteResult) GetPass() bool {
if m != nil {
return m.Pass
}
return false
}
type PublicVote struct {
// 是否需要公示
Publicity bool `protobuf:"varint,1,opt,name=publicity" json:"publicity,omitempty"`
// 全体持票人反对票
OpposeVotes int32 `protobuf:"varint,2,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
PubPass bool `protobuf:"varint,3,opt,name=pubPass" json:"pubPass,omitempty"`
}
func (m *PublicVote) Reset() { *m = PublicVote{} }
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 {
if m != nil {
return m.Publicity
}
return false
}
func (m *PublicVote) GetOpposeVotes() int32 {
if m != nil {
return m.OpposeVotes
}
return 0
}
func (m *PublicVote) GetPubPass() bool {
if m != nil {
return m.PubPass
}
return false
}
type VotesRecord struct {
Address []string `protobuf:"bytes,1,rep,name=address" json:"address,omitempty"`
}
......@@ -63,7 +98,7 @@ type VotesRecord struct {
func (m *VotesRecord) Reset() { *m = VotesRecord{} }
func (m *VotesRecord) String() string { return proto.CompactTextString(m) }
func (*VotesRecord) ProtoMessage() {}
func (*VotesRecord) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
func (*VotesRecord) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
func (m *VotesRecord) GetAddress() []string {
if m != nil {
......@@ -73,23 +108,26 @@ func (m *VotesRecord) GetAddress() []string {
}
func init() {
proto.RegisterType((*VotesResult)(nil), "types.VotesResult")
proto.RegisterType((*VoteResult)(nil), "types.VoteResult")
proto.RegisterType((*PublicVote)(nil), "types.PublicVote")
proto.RegisterType((*VotesRecord)(nil), "types.VotesRecord")
}
func init() { proto.RegisterFile("lcommon.proto", fileDescriptor2) }
var fileDescriptor2 = []byte{
// 161 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0xbd, 0xae, 0xc2, 0x30,
0x0c, 0x46, 0x95, 0xdb, 0xf6, 0x02, 0x2e, 0x2c, 0x9e, 0x3a, 0xa1, 0xaa, 0x0b, 0x99, 0x58, 0x78,
0x93, 0x0c, 0xec, 0xa1, 0xc9, 0x96, 0x62, 0x2b, 0x36, 0x48, 0x3c, 0x01, 0xaf, 0x8d, 0x08, 0x3f,
0x2a, 0x9b, 0x7d, 0x74, 0x86, 0xf3, 0xc1, 0x26, 0x8d, 0x34, 0x4d, 0x74, 0xde, 0x73, 0x26, 0x25,
0x6c, 0xf4, 0xc6, 0x51, 0x86, 0xbb, 0x81, 0xf6, 0x48, 0x1a, 0xc5, 0x45, 0xb9, 0x24, 0xc5, 0x2d,
0x80, 0x92, 0xfa, 0x54, 0x58, 0x67, 0x7a, 0x63, 0x1b, 0x37, 0x23, 0x38, 0xc0, 0xda, 0x33, 0x67,
0xba, 0xc6, 0x97, 0xf1, 0x57, 0x8c, 0x1f, 0x86, 0x3d, 0xb4, 0xc4, 0x4c, 0xf2, 0x56, 0xaa, 0xa2,
0xcc, 0x11, 0x22, 0xd4, 0xec, 0x45, 0xba, 0xba, 0x37, 0x76, 0xe9, 0xca, 0x3d, 0xec, 0xbe, 0x21,
0x23, 0xe5, 0x80, 0x1d, 0x2c, 0x7c, 0x08, 0x39, 0xca, 0xb3, 0xa2, 0xb2, 0x2b, 0xf7, 0x79, 0x4f,
0xff, 0x65, 0xc0, 0xe1, 0x11, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x42, 0x8d, 0xc4, 0xd1, 0x00, 0x00,
0x00,
// 205 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xcd, 0x4e, 0x85, 0x30,
0x10, 0x85, 0x53, 0x7e, 0x14, 0x06, 0xdd, 0x74, 0xc5, 0xc2, 0x18, 0xd2, 0x8d, 0xac, 0xdc, 0xf8,
0x22, 0xa4, 0x0b, 0xf7, 0x05, 0x6a, 0x42, 0x52, 0x9c, 0x49, 0x5b, 0x4c, 0x78, 0x01, 0x9f, 0xdb,
0x74, 0x94, 0xc8, 0xbd, 0x77, 0xd7, 0xf3, 0xe5, 0x6b, 0xce, 0xcc, 0xc0, 0xa3, 0x9b, 0x70, 0x5d,
0xf1, 0xf3, 0x95, 0x3c, 0x46, 0x94, 0x65, 0xdc, 0xc9, 0x06, 0xf5, 0x2d, 0x00, 0xde, 0x31, 0x5a,
0x6d, 0xc3, 0xe6, 0xa2, 0x7c, 0x06, 0x88, 0x18, 0x8d, 0x4b, 0x28, 0xb4, 0xa2, 0x13, 0x7d, 0xa9,
0x4f, 0x44, 0x2a, 0x78, 0x30, 0x44, 0x1e, 0xbf, 0xec, 0xaf, 0x91, 0xb1, 0x71, 0xc1, 0x64, 0x07,
0x0d, 0x12, 0x61, 0xf8, 0x53, 0x72, 0x56, 0xce, 0x48, 0x4a, 0x28, 0xc8, 0x84, 0xd0, 0x16, 0x9d,
0xe8, 0x2b, 0xcd, 0x6f, 0xf5, 0x01, 0x30, 0x6c, 0xa3, 0x5b, 0xa6, 0xa4, 0xc8, 0x27, 0xa8, 0x89,
0xd3, 0x12, 0x77, 0x1e, 0xa3, 0xd2, 0xff, 0xe0, 0xba, 0x21, 0xbb, 0x6d, 0x68, 0xe1, 0x9e, 0xb6,
0x71, 0x48, 0x25, 0x39, 0xff, 0x3e, 0xa2, 0x7a, 0x81, 0x86, 0x15, 0x6d, 0x27, 0xf4, 0x73, 0x12,
0xcd, 0x3c, 0x7b, 0x1b, 0xd2, 0xb6, 0x79, 0x5f, 0xeb, 0x23, 0x8e, 0x77, 0x7c, 0xa7, 0xb7, 0x9f,
0x00, 0x00, 0x00, 0xff, 0xff, 0xe3, 0x7b, 0x84, 0x76, 0x38, 0x01, 0x00, 0x00,
}
This diff is collapsed.
This diff is collapsed.
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