Commit 58b5def0 authored by liuyuhang's avatar liuyuhang Committed by 33cn

add proposal board

parent af694733
...@@ -5,410 +5,217 @@ ...@@ -5,410 +5,217 @@
package commands package commands
import ( import (
"bytes"
"encoding/json"
"fmt"
"math"
"os"
"strings" "strings"
"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/spf13/cobra"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
pty "github.com/33cn/plugin/plugin/dapp/autonomy/types" "github.com/spf13/cobra"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
) )
// Cmd autonomy 客户端主程序
func Cmd() *cobra.Command { // AutonomyCmd 自治系统命令行
func AutonomyCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "autonomy", Use: "autonomy",
Short: "autonomy construct management", Short: "autonomy management",
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
} }
cmd.AddCommand(createCmd())
cmd.AddCommand(withdrawCmd())
cmd.AddCommand(terminateCmd())
cmd.AddCommand(showCmd())
cmd.AddCommand(queryWithdrawCmd())
cmd.AddCommand(listautonomyCmd())
return cmd
}
func createCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "create autonomy construct",
}
cmd.AddCommand(fixAmountCmd())
cmd.AddCommand(leftCmd())
return cmd
}
func createFlag(cmd *cobra.Command) *cobra.Command {
cmd.PersistentFlags().StringP("beneficiary", "b", "", "address of beneficiary")
cmd.MarkFlagRequired("beneficiary")
cmd.PersistentFlags().StringP("asset_exec", "e", "", "asset exec") // board
cmd.MarkFlagRequired("asset_exec") cmd.AddCommand(
ProposalBoardCmd(),
cmd.PersistentFlags().StringP("asset_symbol", "s", "", "asset symbol") RevokeProposalBoardCmd(),
cmd.MarkFlagRequired("asset_symbol") VoteProposalBoardCmd(),
TerminateProposalBoardCmd(),
cmd.PersistentFlags().Float64P("total", "t", 0, "total count of asset") ShowProposalBoardCmd(),
cmd.MarkFlagRequired("total") )
cmd.PersistentFlags().Int64P("start_ts", "", 0, "effect, UTC timestamp")
//cmd.MarkFlagRequired("start_ts")
return cmd return cmd
} }
func checkAmount(amount float64) error { // ProposalBoardCmd 创建提案命令
if amount < 0 || amount > float64(types.MaxCoin/types.Coin) { func ProposalBoardCmd() *cobra.Command {
return types.ErrAmount
}
return nil
}
func getCreateFlags(cmd *cobra.Command) (*pty.autonomyCreate, error) {
beneficiary, _ := cmd.Flags().GetString("beneficiary")
exec, _ := cmd.Flags().GetString("asset_exec")
symbol, _ := cmd.Flags().GetString("asset_symbol")
total, _ := cmd.Flags().GetFloat64("total")
startTs, _ := cmd.Flags().GetInt64("start_ts")
if err := checkAmount(total); err != nil {
return nil, types.ErrAmount
}
totalInt64 := int64(math.Trunc((total+0.0000001)*1e4)) * 1e4
autonomy := &pty.autonomyCreate{
StartTime: startTs,
AssetExec: exec,
AssetSymbol: symbol,
TotalCount: totalInt64,
Beneficiary: beneficiary,
Means: "",
}
return autonomy, nil
}
func fixAmountCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "fix_amount", Use: "proposalboard",
Short: "create fix amount means autonomy construct", Short: "create proposal board",
Run: fixAmount, Run: proposalBoard,
} }
cmd = createFlag(cmd) addProposalBoardFlags(cmd)
cmd.Flags().Float64P("amount", "a", 0, "amount every period")
cmd.MarkFlagRequired("amount")
cmd.Flags().Int64P("period", "p", 0, "period in second")
cmd.MarkFlagRequired("period")
return cmd return cmd
} }
func fixAmount(cmd *cobra.Command, args []string) { func addProposalBoardFlags(cmd *cobra.Command) {
create, err := getCreateFlags(cmd) cmd.Flags().Int32P("year", "y", 0, "year")
if err != nil { cmd.Flags().Int32P("month", "m", 0, "month")
fmt.Fprintln(os.Stderr, err) cmd.Flags().Int32P("day", "d", 0, "day")
return cmd.Flags().Int64P("startBlock", "s", 0, "start block height")
} cmd.MarkFlagRequired("startBlock")
cmd.Flags().Int64P("endBlock", "e", 0, "end block height")
cmd.MarkFlagRequired("endBlock")
amount, _ := cmd.Flags().GetFloat64("amount") cmd.Flags().StringP("boards", "b", "", "addr1-addr2......addrN (3<=N<=30)")
if err = checkAmount(amount); err != nil { cmd.MarkFlagRequired("boards")
fmt.Fprintln(os.Stderr, err) }
return
}
amountInt64 := int64(math.Trunc((amount+0.0000001)*1e4)) * 1e4
period, _ := cmd.Flags().GetInt64("period")
if period <= 0 { func proposalBoard(cmd *cobra.Command, args []string) {
fmt.Fprintf(os.Stderr, "period must be positive integer") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
return year, _ := cmd.Flags().GetInt32("year")
} month, _ := cmd.Flags().GetInt32("month")
day, _ := cmd.Flags().GetInt32("day")
if create.TotalCount <= amountInt64 { startBlock, _ := cmd.Flags().GetInt64("startBlock")
fmt.Fprintf(os.Stderr, "total must bigger than amount") endBlock, _ := cmd.Flags().GetInt64("endBlock")
return boardstr, _ := cmd.Flags().GetString("gameName")
}
create.Means = pty.FixAmountX boards := strings.Split(boardstr, "-")
create.MeansOpt = &pty.autonomyCreate_FixAmount{FixAmount: &pty.FixAmount{Period: period, Amount: amountInt64}}
params := &rpctypes.CreateTxIn{ params := &auty.ProposalBoard{
Execer: types.ExecName(pty.autonomyX), Year: year,
ActionName: "createautonomy", Month: month,
Payload: types.MustPBToJSON(create), Day: day,
Boards: boards,
StartBlockHeight: startBlock,
EndBlockHeight: endBlock,
} }
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") var res string
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, nil) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.PropBoardTx", params, &res)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
func leftCmd() *cobra.Command { // RevokeProposalBoardCmd 撤销提案
func RevokeProposalBoardCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "left_proportion", Use: "revokeBoard",
Short: "create left proportion means autonomy construct", Short: "revoke proposal board",
Run: left, Run: revokeProposalBoard,
} }
cmd = createFlag(cmd) addRevokeProposalBoardFlags(cmd)
cmd.Flags().Int64P("ten_thousandth", "", 0, "input/10000 of total")
cmd.MarkFlagRequired("amount")
cmd.Flags().Int64P("period", "p", 0, "period in second")
cmd.MarkFlagRequired("period")
return cmd return cmd
} }
func left(cmd *cobra.Command, args []string) { func addRevokeProposalBoardFlags(cmd *cobra.Command) {
create, err := getCreateFlags(cmd) cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
if err != nil { cmd.MarkFlagRequired("proposalID")
fmt.Fprintln(os.Stderr, err)
return
}
tenThousandth, _ := cmd.Flags().GetInt64("ten_thousandth")
period, _ := cmd.Flags().GetInt64("period")
create.Means = pty.LeftProportionX
create.MeansOpt = &pty.autonomyCreate_LeftProportion{
LeftProportion: &pty.LeftProportion{Period: period, TenThousandth: tenThousandth}}
if period <= 0 {
fmt.Fprintf(os.Stderr, "period must be positive interge")
return
}
if tenThousandth <= 0 || tenThousandth >= 10000 {
fmt.Fprintf(os.Stderr, "tenThousandth must be 0~10000")
return
}
params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.autonomyX),
ActionName: pty.Action_Createautonomy,
Payload: types.MustPBToJSON(create),
}
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, nil)
ctx.RunWithoutMarshal()
} }
func withdrawCmd() *cobra.Command { func revokeProposalBoard(cmd *cobra.Command, args []string) {
cmd := &cobra.Command{ rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
Use: "withdraw", ID, _ := cmd.Flags().GetString("proposalID")
Short: "withdraw asset from construct",
Run: withdraw,
}
cmd.Flags().StringP("id", "", "", "autonomy construct id")
cmd.MarkFlagRequired("id")
return cmd
}
func terminateCmd() *cobra.Command { params := &auty.RevokeProposalBoard{
cmd := &cobra.Command{ ProposalID: ID,
Use: "terminate",
Short: "terminate construct",
Run: terminate,
} }
cmd.Flags().StringP("id", "", "", "autonomy construct id") var res string
cmd.MarkFlagRequired("id") ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.RevokeProposalBoardTx", params, &res)
ctx.RunWithoutMarshal()
return cmd
} }
func showCmd() *cobra.Command { // RevokeProposalBoardCmd 撤销提案
func VoteProposalBoardCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "show", Use: "voteBoard",
Short: "show construct", Short: "vote proposal board",
Run: show, Run: voteProposalBoard,
} }
cmd.Flags().StringP("id", "", "", "autonomy construct id") addVoteProposalBoardFlags(cmd)
cmd.MarkFlagRequired("id")
return cmd return cmd
} }
func queryWithdrawCmd() *cobra.Command { func addVoteProposalBoardFlags(cmd *cobra.Command) {
cmd := &cobra.Command{ cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
Use: "show_withdraw", cmd.MarkFlagRequired("proposalID")
Short: "show available withdraw amount of one autonomy construct", cmd.Flags().BoolP("approve", "ap", true, "is approve, default true")
Run: queryWithdraw,
}
cmd.Flags().StringP("id", "", "", "autonomy construct id")
cmd.MarkFlagRequired("id")
return cmd
} }
func withdraw(cmd *cobra.Command, args []string) { func voteProposalBoard(cmd *cobra.Command, args []string) {
id, _ := cmd.Flags().GetString("id")
params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.autonomyX),
ActionName: pty.Action_Withdrawautonomy,
Payload: types.MustPBToJSON(&pty.autonomyWithdraw{autonomyID: id}),
}
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, nil) ID, _ := cmd.Flags().GetString("proposalID")
ctx.RunWithoutMarshal() approve, _ := cmd.Flags().GetBool("approve")
}
func terminate(cmd *cobra.Command, args []string) {
id, _ := cmd.Flags().GetString("id")
params := &rpctypes.CreateTxIn{ params := &auty.VoteProposalBoard{
Execer: types.ExecName(pty.autonomyX), ProposalID: ID,
ActionName: pty.Action_Terminateautonomy, Approve: approve,
Payload: types.MustPBToJSON(&pty.autonomyTerminate{autonomyID: id}),
} }
var res string
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.VoteProposalBoardTx", params, &res)
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, nil)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
func queryWithdraw(cmd *cobra.Command, args []string) { // TerminateProposalBoard 撤销提案
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") func TerminateProposalBoardCmd() *cobra.Command {
paraName, _ := cmd.Flags().GetString("paraName") cmd := &cobra.Command{
Use: "terminateBoard",
id, _ := cmd.Flags().GetString("id") Short: "terminate proposal board",
cli, err := jsonclient.NewJSONClient(rpcLaddr) Run: terminateProposalBoard,
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
param := &rpctypes.Query4Jrpc{
Execer: getRealExecName(paraName, pty.autonomyX),
FuncName: "GetautonomyWithdraw",
Payload: types.MustPBToJSON(&types.ReqString{Data: id}),
}
var resp pty.ReplyQueryautonomyWithdraw
err = cli.Call("Chain33.Query", param, &resp)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
} }
addTerminateProposalBoardFlags(cmd)
jsonOutput(&resp) return cmd
} }
func show(cmd *cobra.Command, args []string) { func addTerminateProposalBoardFlags(cmd *cobra.Command) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
paraName, _ := cmd.Flags().GetString("paraName") cmd.MarkFlagRequired("proposalID")
id, _ := cmd.Flags().GetString("id")
cli, err := jsonclient.NewJSONClient(rpcLaddr)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
param := &rpctypes.Query4Jrpc{
Execer: getRealExecName(paraName, pty.autonomyX),
FuncName: "Getautonomy",
Payload: types.MustPBToJSON(&types.ReqString{Data: id}),
}
var resp pty.autonomy
err = cli.Call("Chain33.Query", param, &resp)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
jsonOutput(&resp)
} }
func getRealExecName(paraName string, name string) string { func terminateProposalBoard(cmd *cobra.Command, args []string) {
if strings.HasPrefix(name, "user.p.") { rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
return name ID, _ := cmd.Flags().GetString("proposalID")
}
return paraName + name
}
func jsonOutput(resp types.Message) { params := &auty.RevokeProposalBoard{
data, err := types.PBToJSON(resp) ProposalID: ID,
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
var buf bytes.Buffer
err = json.Indent(&buf, data, "", " ")
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
} }
fmt.Println(buf.String()) var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "autonomy.TerminateProposalBoardTx", params, &res)
ctx.RunWithoutMarshal()
} }
func listautonomyCmd() *cobra.Command { // ShowProposalBoardCmd 显示提案查询信息
func ShowProposalBoardCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "showInfo",
Short: "list autonomy", Short: "show proposal board info",
Run: listautonomy, Run: showProposalBoard,
} }
cmd.Flags().StringP("last_key", "l", "", "last key") addShowProposalBoardflags(cmd)
cmd.Flags().Int32P("count", "", 10, "list count")
cmd.Flags().Int32P("direction", "d", 0, "list direction: 0/1")
cmd.Flags().StringP("create", "c", "", "list by creator")
cmd.Flags().StringP("beneficiary", "b", "", "list by beneficiary")
return cmd return cmd
} }
func listautonomy(cmd *cobra.Command, args []string) { func addShowProposalBoardflags(cmd *cobra.Command) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") cmd.Flags().Uint32P("type", "t", 0, "type")
paraName, _ := cmd.Flags().GetString("paraName") cmd.MarkFlagRequired("type")
create, _ := cmd.Flags().GetString("create") cmd.Flags().Uint32P("status", "s", 0, "status")
beneficiary, _ := cmd.Flags().GetString("beneficiary") cmd.Flags().Int32P("count", "c", 0, "count")
if (len(create) == 0 && len(beneficiary) == 0) || (len(create) > 0 && len(beneficiary) > 0) { cmd.Flags().Int32P("direction", "d", 0, "direction")
fmt.Fprintln(os.Stderr, "must assign one of create or beneficiary") cmd.Flags().Int64P("index", "i", 0, "index")
return }
}
funcName := "ListautonomyByBeneficiary"
if len(create) > 0 {
funcName = "ListautonomyByCreator"
}
direction, _ := cmd.Flags().GetInt32("direction") func showProposalBoard(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
typ, _ := cmd.Flags().GetUint32("type")
status, _ := cmd.Flags().GetUint32("status")
count, _ := cmd.Flags().GetInt32("count") count, _ := cmd.Flags().GetInt32("count")
last_key, _ := cmd.Flags().GetString("last_key") direction, _ := cmd.Flags().GetInt32("direction")
index, _ := cmd.Flags().GetInt64("index")
req := &pty.Reqautonomys{
Direction: direction, var params rpctypes.Query4Jrpc
Count: count, var rep interface{}
FromKey: last_key, params.Execer = auty.AutonomyX
Initiator: create, if 0 == typ {
Beneficiary: beneficiary, req := auty.ReqQueryProposalBoard{
} Status: int32(status),
Count: count,
param := &rpctypes.Query4Jrpc{ Direction: direction,
Execer: getRealExecName(paraName, pty.autonomyX), Index: index,
FuncName: funcName, }
Payload: types.MustPBToJSON(req), params.FuncName = auty.GetProposalBoard
} params.Payload = types.MustPBToJSON(&req)
rep = &auty.ReplyQueryProposalBoard{}
cli, err := jsonclient.NewJSONClient(rpcLaddr) }
if err != nil {
fmt.Fprintln(os.Stderr, err) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, rep)
return ctx.Run()
}
var resp pty.Replyautonomys
err = cli.Call("Chain33.Query", param, &resp)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
jsonOutput(&resp)
} }
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"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) {
...@@ -25,7 +26,7 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD ...@@ -25,7 +26,7 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD
if err != nil { if err != nil {
return nil, err return nil, err
} }
kv := a.saveHeightIndex(&receipt) kv := saveHeightIndex(&receipt)
set = append(set, kv...) set = append(set, kv...)
} }
default: default:
...@@ -36,7 +37,7 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD ...@@ -36,7 +37,7 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD
return dbSet, nil return dbSet, nil
} }
func (c *Autonomy) saveHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue) { func saveHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue) {
// 先将之前的状态删除掉,再做更新 // 先将之前的状态删除掉,再做更新
if res.Current.Status > 1 { if res.Current.Status > 1 {
kv := &types.KeyValue{} kv := &types.KeyValue{}
...@@ -67,7 +68,7 @@ func (a *Autonomy) execDelLocalBoard(receiptData *types.ReceiptData) (*types.Loc ...@@ -67,7 +68,7 @@ func (a *Autonomy) execDelLocalBoard(receiptData *types.ReceiptData) (*types.Loc
if err != nil { if err != nil {
return nil, err return nil, err
} }
kv := a.delHeightIndex(&receipt) kv := delHeightIndex(&receipt)
set = append(set, kv...) set = append(set, kv...)
} }
default: default:
...@@ -78,7 +79,7 @@ func (a *Autonomy) execDelLocalBoard(receiptData *types.ReceiptData) (*types.Loc ...@@ -78,7 +79,7 @@ func (a *Autonomy) execDelLocalBoard(receiptData *types.ReceiptData) (*types.Loc
return dbSet, nil return dbSet, nil
} }
func (c *Autonomy) delHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue) { func delHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue) {
kv := &types.KeyValue{} kv := &types.KeyValue{}
kv.Key = calcBoardKey4StatusHeight(res.Current.Status, dapp.HeightIndexStr(res.Current.Height, int64(res.Current.Index))) kv.Key = calcBoardKey4StatusHeight(res.Current.Status, dapp.HeightIndexStr(res.Current.Height, int64(res.Current.Index)))
kv.Value = nil kv.Value = nil
...@@ -91,4 +92,45 @@ func (c *Autonomy) delHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types. ...@@ -91,4 +92,45 @@ func (c *Autonomy) delHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.
kvs = append(kvs, kv) kvs = append(kvs, kv)
} }
return kvs return kvs
}
// getProposalBoard
func (a *Autonomy) getProposalBoard(req *auty.ReqQueryProposalBoard) (types.Message, error) {
if req == nil {
return nil, types.ErrInvalidParam
}
var key []byte
var values [][]byte
var err error
localDb := a.GetLocalDB()
if req.GetIndex() == -1 {
key = nil
} else { //翻页查找指定的txhash列表
heightstr := genHeightIndexStr(req.GetIndex())
key = calcBoardKey4StatusHeight(req.Status, heightstr)
}
prefix := calcBoardKey4StatusHeight(req.Status, "")
values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
if err != nil {
return nil, err
}
if len(values) == 0 {
return nil, types.ErrNotFound
}
var rep auty.ReplyQueryProposalBoard
for _, value := range values {
prop := &auty.AutonomyProposalBoard{}
err = types.Decode(value, prop)
if err != nil {
return nil, err
}
rep.ProBoards = append(rep.ProBoards, prop)
}
return &rep, nil
}
func genHeightIndexStr(index int64) string {
return fmt.Sprintf("%018d", index)
} }
\ No newline at end of file
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
package executor package executor
import ( import (
"time"
dbm "github.com/33cn/chain33/common/db"
"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"
) )
// Query_GetUnfreezeWithdraw 查询合约可提币量 // Query_GetUnfreezeWithdraw 查询合约可提币量
func (u *Unfreeze) Query_GetUnfreezeWithdraw(in *types.ReqString) (types.Message, error) { func (a *Autonomy) Query_GetProposalBoard(in *auty.ReqQueryProposalBoard) (types.Message, error) {
return QueryWithdraw(u.GetStateDB(), in.GetData()) return a.getProposalBoard(in)
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ func init() { ...@@ -17,7 +17,7 @@ func init() {
Name: ptypes.PackageName, Name: ptypes.PackageName,
ExecName: executor.GetName(), ExecName: executor.GetName(),
Exec: executor.Init, Exec: executor.Init,
Cmd: commands.Cmd, Cmd: commands.AutonomyCmd,
RPC: rpc.Init, RPC: rpc.Init,
}) })
} }
...@@ -31,10 +31,4 @@ message AutonomyAction { ...@@ -31,10 +31,4 @@ message AutonomyAction {
TerminateProposalRule tmintPropRule = 12; TerminateProposalRule tmintPropRule = 12;
} }
int32 ty = 13; int32 ty = 13;
}
service autonomy {
rpc QueryProposalBoard(ReplyQueryProposalBoard) returns (ReplyProposalBoard) {}
rpc QueryProposalProject(ReplyQueryProposalProject) returns (ReplyProposalProject) {}
rpc QueryProposalRule(ReplyQueryProposalRule) returns (ReplyProposalRule) {}
} }
\ No newline at end of file
...@@ -61,10 +61,14 @@ message LocalProposalBoard { ...@@ -61,10 +61,14 @@ message LocalProposalBoard {
} }
// query // query
message ReplyQueryProposalBoard { message ReqQueryProposalBoard {
string proposalID = 1; //优先根据status查询
int32 status = 1;
int32 count = 2;
int32 direction = 3;
int64 index = 4;
} }
message ReplyProposalBoard { message ReplyQueryProposalBoard {
repeated LocalProposalBoard propBoards = 1; repeated AutonomyProposalBoard proBoards = 1;
} }
\ No newline at end of file
...@@ -38,6 +38,19 @@ func (c *Jrpc) RevokeProposalBoardTx(parm *auty.RevokeProposalBoard, result *int ...@@ -38,6 +38,19 @@ func (c *Jrpc) RevokeProposalBoardTx(parm *auty.RevokeProposalBoard, result *int
return nil return nil
} }
// VoteProposalBoardTx 投票提案董事会成员的RPC接口
func (c *Jrpc) VoteProposalBoardTx(parm *auty.VoteProposalBoard, result *interface{}) error {
if parm == nil {
return types.ErrInvalidParam
}
reply, err := c.cli.voteProposalBoard(context.Background(), parm)
if err != nil {
return err
}
*result = hex.EncodeToString(reply.Data)
return nil
}
// TerminateProposalBoardTx 终止提案董事会成员的RPC接口 // TerminateProposalBoardTx 终止提案董事会成员的RPC接口
func (c *Jrpc) TerminateProposalBoardTx(parm *auty.TerminateProposalBoard, result *interface{}) error { func (c *Jrpc) TerminateProposalBoardTx(parm *auty.TerminateProposalBoard, result *interface{}) error {
if parm == nil { if parm == nil {
......
...@@ -42,6 +42,21 @@ func (c *channelClient) revokeProposalBoard(ctx context.Context, head *auty.Revo ...@@ -42,6 +42,21 @@ func (c *channelClient) revokeProposalBoard(ctx context.Context, head *auty.Revo
return &types.UnsignTx{Data: data}, nil return &types.UnsignTx{Data: data}, nil
} }
func (c *channelClient) voteProposalBoard(ctx context.Context, head *auty.VoteProposalBoard) (*types.UnsignTx, error) {
val := &auty.AutonomyAction{
Ty: auty.AutonomyActionVotePropBoard,
Value: &auty.AutonomyAction_VotePropBoard{VotePropBoard: head},
}
tx := &types.Transaction{
Payload: types.Encode(val),
}
data, err := types.FormatTxEncode(types.ExecName(auty.AutonomyX), tx)
if err != nil {
return nil, err
}
return &types.UnsignTx{Data: data}, nil
}
func (c *channelClient) terminateProposalBoard(ctx context.Context, head *auty.TerminateProposalBoard) (*types.UnsignTx, error) { func (c *channelClient) terminateProposalBoard(ctx context.Context, head *auty.TerminateProposalBoard) (*types.UnsignTx, error) {
val := &auty.AutonomyAction{ val := &auty.AutonomyAction{
Ty: auty.AutonomyActionTmintPropBoard, Ty: auty.AutonomyActionTmintPropBoard,
......
...@@ -20,8 +20,8 @@ It has these top-level messages: ...@@ -20,8 +20,8 @@ It has these top-level messages:
TerminateProposalBoard TerminateProposalBoard
ReceiptProposalBoard ReceiptProposalBoard
LocalProposalBoard LocalProposalBoard
ReqQueryProposalBoard
ReplyQueryProposalBoard ReplyQueryProposalBoard
ReplyProposalBoard
VotesResult VotesResult
VotesRecord VotesRecord
AutonomyProposalProject AutonomyProposalProject
...@@ -47,11 +47,6 @@ import proto "github.com/golang/protobuf/proto" ...@@ -47,11 +47,6 @@ import proto "github.com/golang/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
...@@ -507,174 +502,31 @@ func init() { ...@@ -507,174 +502,31 @@ func init() {
proto.RegisterType((*AutonomyAction)(nil), "types.AutonomyAction") proto.RegisterType((*AutonomyAction)(nil), "types.AutonomyAction")
} }
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for Autonomy service
type AutonomyClient interface {
QueryProposalBoard(ctx context.Context, in *ReplyQueryProposalBoard, opts ...grpc.CallOption) (*ReplyProposalBoard, error)
QueryProposalProject(ctx context.Context, in *ReplyQueryProposalProject, opts ...grpc.CallOption) (*ReplyProposalProject, error)
QueryProposalRule(ctx context.Context, in *ReplyQueryProposalRule, opts ...grpc.CallOption) (*ReplyProposalRule, error)
}
type autonomyClient struct {
cc *grpc.ClientConn
}
func NewAutonomyClient(cc *grpc.ClientConn) AutonomyClient {
return &autonomyClient{cc}
}
func (c *autonomyClient) QueryProposalBoard(ctx context.Context, in *ReplyQueryProposalBoard, opts ...grpc.CallOption) (*ReplyProposalBoard, error) {
out := new(ReplyProposalBoard)
err := grpc.Invoke(ctx, "/types.autonomy/QueryProposalBoard", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *autonomyClient) QueryProposalProject(ctx context.Context, in *ReplyQueryProposalProject, opts ...grpc.CallOption) (*ReplyProposalProject, error) {
out := new(ReplyProposalProject)
err := grpc.Invoke(ctx, "/types.autonomy/QueryProposalProject", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *autonomyClient) QueryProposalRule(ctx context.Context, in *ReplyQueryProposalRule, opts ...grpc.CallOption) (*ReplyProposalRule, error) {
out := new(ReplyProposalRule)
err := grpc.Invoke(ctx, "/types.autonomy/QueryProposalRule", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Autonomy service
type AutonomyServer interface {
QueryProposalBoard(context.Context, *ReplyQueryProposalBoard) (*ReplyProposalBoard, error)
QueryProposalProject(context.Context, *ReplyQueryProposalProject) (*ReplyProposalProject, error)
QueryProposalRule(context.Context, *ReplyQueryProposalRule) (*ReplyProposalRule, error)
}
func RegisterAutonomyServer(s *grpc.Server, srv AutonomyServer) {
s.RegisterService(&_Autonomy_serviceDesc, srv)
}
func _Autonomy_QueryProposalBoard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReplyQueryProposalBoard)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AutonomyServer).QueryProposalBoard(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.autonomy/QueryProposalBoard",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AutonomyServer).QueryProposalBoard(ctx, req.(*ReplyQueryProposalBoard))
}
return interceptor(ctx, in, info, handler)
}
func _Autonomy_QueryProposalProject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReplyQueryProposalProject)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AutonomyServer).QueryProposalProject(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.autonomy/QueryProposalProject",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AutonomyServer).QueryProposalProject(ctx, req.(*ReplyQueryProposalProject))
}
return interceptor(ctx, in, info, handler)
}
func _Autonomy_QueryProposalRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReplyQueryProposalRule)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AutonomyServer).QueryProposalRule(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.autonomy/QueryProposalRule",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AutonomyServer).QueryProposalRule(ctx, req.(*ReplyQueryProposalRule))
}
return interceptor(ctx, in, info, handler)
}
var _Autonomy_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.autonomy",
HandlerType: (*AutonomyServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "QueryProposalBoard",
Handler: _Autonomy_QueryProposalBoard_Handler,
},
{
MethodName: "QueryProposalProject",
Handler: _Autonomy_QueryProposalProject_Handler,
},
{
MethodName: "QueryProposalRule",
Handler: _Autonomy_QueryProposalRule_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "autonomy.proto",
}
func init() { proto.RegisterFile("autonomy.proto", fileDescriptor0) } func init() { proto.RegisterFile("autonomy.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 436 bytes of a gzipped FileDescriptorProto // 366 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xcf, 0xae, 0xd2, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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0, 0x0b, 0x05, 0x13, 0x35, 0x1f, 0x2e, 0x5a, 0xf3, 0xd8, 0x75, 0xba, 0x94, 0x79, 0xe2,
0x69, 0xdb, 0xbe, 0xf8, 0x9e, 0x7c, 0x78, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xc2, 0xca, 0x38,
0x90, 0x04, 0x00, 0x00,
} }
...@@ -244,34 +244,59 @@ func (m *LocalProposalBoard) GetComments() []string { ...@@ -244,34 +244,59 @@ func (m *LocalProposalBoard) GetComments() []string {
} }
// query // query
type ReplyQueryProposalBoard struct { type ReqQueryProposalBoard struct {
ProposalID string `protobuf:"bytes,1,opt,name=proposalID" json:"proposalID,omitempty"` // 优先根据status查询
Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"`
Direction int32 `protobuf:"varint,3,opt,name=direction" json:"direction,omitempty"`
Index int64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"`
} }
func (m *ReplyQueryProposalBoard) Reset() { *m = ReplyQueryProposalBoard{} } func (m *ReqQueryProposalBoard) Reset() { *m = ReqQueryProposalBoard{} }
func (m *ReplyQueryProposalBoard) String() string { return proto.CompactTextString(m) } func (m *ReqQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalBoard) ProtoMessage() {} func (*ReqQueryProposalBoard) ProtoMessage() {}
func (*ReplyQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } func (*ReqQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
func (m *ReplyQueryProposalBoard) GetProposalID() string { func (m *ReqQueryProposalBoard) GetStatus() int32 {
if m != nil { if m != nil {
return m.ProposalID return m.Status
} }
return "" return 0
} }
type ReplyProposalBoard struct { func (m *ReqQueryProposalBoard) GetCount() int32 {
PropBoards []*LocalProposalBoard `protobuf:"bytes,1,rep,name=propBoards" json:"propBoards,omitempty"` if m != nil {
return m.Count
}
return 0
} }
func (m *ReplyProposalBoard) Reset() { *m = ReplyProposalBoard{} } func (m *ReqQueryProposalBoard) GetDirection() int32 {
func (m *ReplyProposalBoard) String() string { return proto.CompactTextString(m) } if m != nil {
func (*ReplyProposalBoard) ProtoMessage() {} return m.Direction
func (*ReplyProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } }
return 0
}
func (m *ReqQueryProposalBoard) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
type ReplyQueryProposalBoard struct {
ProBoards []*AutonomyProposalBoard `protobuf:"bytes,1,rep,name=proBoards" json:"proBoards,omitempty"`
}
func (m *ReplyQueryProposalBoard) Reset() { *m = ReplyQueryProposalBoard{} }
func (m *ReplyQueryProposalBoard) String() string { return proto.CompactTextString(m) }
func (*ReplyQueryProposalBoard) ProtoMessage() {}
func (*ReplyQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
func (m *ReplyProposalBoard) GetPropBoards() []*LocalProposalBoard { func (m *ReplyQueryProposalBoard) GetProBoards() []*AutonomyProposalBoard {
if m != nil { if m != nil {
return m.PropBoards return m.ProBoards
} }
return nil return nil
} }
...@@ -284,42 +309,44 @@ func init() { ...@@ -284,42 +309,44 @@ func init() {
proto.RegisterType((*TerminateProposalBoard)(nil), "types.TerminateProposalBoard") proto.RegisterType((*TerminateProposalBoard)(nil), "types.TerminateProposalBoard")
proto.RegisterType((*ReceiptProposalBoard)(nil), "types.ReceiptProposalBoard") proto.RegisterType((*ReceiptProposalBoard)(nil), "types.ReceiptProposalBoard")
proto.RegisterType((*LocalProposalBoard)(nil), "types.LocalProposalBoard") proto.RegisterType((*LocalProposalBoard)(nil), "types.LocalProposalBoard")
proto.RegisterType((*ReqQueryProposalBoard)(nil), "types.ReqQueryProposalBoard")
proto.RegisterType((*ReplyQueryProposalBoard)(nil), "types.ReplyQueryProposalBoard") proto.RegisterType((*ReplyQueryProposalBoard)(nil), "types.ReplyQueryProposalBoard")
proto.RegisterType((*ReplyProposalBoard)(nil), "types.ReplyProposalBoard")
} }
func init() { proto.RegisterFile("board.proto", fileDescriptor1) } func init() { proto.RegisterFile("board.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{ var fileDescriptor1 = []byte{
// 467 bytes of a gzipped FileDescriptorProto // 498 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5d, 0x8b, 0xd4, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x8b, 0xd4, 0x30,
0x14, 0xa5, 0x76, 0xda, 0xd9, 0xb9, 0xc3, 0xca, 0x1a, 0xc7, 0xb5, 0x2e, 0x22, 0xa5, 0x88, 0x14, 0x14, 0x25, 0x76, 0x3a, 0xb3, 0xbd, 0xcb, 0xca, 0x1a, 0x67, 0xd7, 0xb2, 0x2c, 0x52, 0x8a, 0x48,
0x1f, 0x06, 0x19, 0x3f, 0x70, 0x1f, 0x1d, 0x14, 0x14, 0x14, 0x35, 0x88, 0xef, 0xd9, 0xf6, 0xea, 0xf1, 0x61, 0x90, 0xf5, 0x03, 0xf1, 0xcd, 0x41, 0x41, 0x41, 0x41, 0x83, 0xfa, 0x9e, 0x6d, 0xaf,
0x0c, 0xdb, 0x36, 0x21, 0x49, 0x07, 0xfb, 0xe6, 0x5f, 0xf4, 0x57, 0xf8, 0x37, 0x24, 0xb7, 0x19, 0x4e, 0xd9, 0xb6, 0x89, 0x49, 0x3a, 0xd8, 0x37, 0xff, 0xa2, 0xbf, 0xc2, 0xbf, 0x21, 0x49, 0x33,
0x9d, 0xba, 0x83, 0x38, 0x6f, 0x39, 0x37, 0xe7, 0x24, 0xe7, 0x26, 0xe7, 0xc2, 0xf4, 0x42, 0x0a, 0x76, 0xba, 0x0e, 0xba, 0xfb, 0xd6, 0x73, 0x73, 0x6e, 0x72, 0x4f, 0x72, 0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a, 0xc6,
0xf9, 0x22, 0xa6, 0xd9, 0x7f, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xd3, 0xb7, 0x34, 0x20, 0xbb, 0x74, 0x28, 0x0c, 0x79, 0x98, 0x38, 0xcb, 0xf8, 0x3c, 0x7c, 0x82, 0x3b, 0x0c, 0x65, 0xd5,
0x04, 0x00, 0x00, 0xed, 0x38, 0xfc, 0xb9, 0x0b, 0xf9, 0xb2, 0xf7, 0x37, 0x49, 0x82, 0xff, 0x4a, 0x1d, 0xe8, 0xe7,
0x53, 0xf7, 0x07, 0x79, 0xf4, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x83, 0xda, 0x5e, 0xb4, 0x66, 0x04,
0x00, 0x00,
} }
...@@ -70,12 +70,15 @@ const ( ...@@ -70,12 +70,15 @@ const (
) )
const ( const (
// FuncNameQueryProposalBoard 查询方法名 // GetProposalBoard 用于在cmd里面的区分不同的查询
FuncNameQueryProposalBoard = "QueryProposalBoard" GetProposalBoard = "GetProposalBoard"
FuncNameQueryProposalProject = "QueryProposalProject" // GetProposalProject 用于在cmd里面的区分不同的查询
FuncNameQueryProposalRule = "QueryProposalRule" GetProposalProject = "GetProposalProject"
// GetProposalRule 用于在cmd里面的区分不同的查询
GetProposalRule = "GetProposalRule"
) )
//包的名字可以通过配置文件来配置 //包的名字可以通过配置文件来配置
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字 //建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//如果发生重名,可以通过配置文件修改这些名字 //如果发生重名,可以通过配置文件修改这些名字
......
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