Commit baf4c3b1 authored by 张振华's avatar 张振华

guess

parent a8e53ba4
......@@ -5,9 +5,12 @@
package commands
import (
"fmt"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/types"
pkt "github.com/33cn/plugin/plugin/dapp/guess/types"
"github.com/spf13/cobra"
"strings"
)
func GuessCmd() *cobra.Command {
......@@ -45,45 +48,38 @@ func addGuessStartFlags(cmd *cobra.Command) {
cmd.Flags().StringP("options", "o", "", "options")
cmd.MarkFlagRequired("options")
cmd.Flags().StringP("maxTime", "mt", "", "max time to bet, after this bet is forbidden")
cmd.Flags().Uint32P("maxHeight", "h", 0, "max height to bet, after this bet is forbidden")
cmd.MarkFlagRequired("maxHeight")
cmd.Flags().StringP("maxBetTime", "b", "", "max time to bet, after this bet is forbidden")
cmd.Flags().Int64P("maxBetHeight", "c", 0, "max height to bet, after this bet is forbidden")
cmd.Flags().StringP("symbol", "s", "bty", "token symbol")
cmd.Flags().StringP("exec", "e", "coins", "excutor name")
cmd.Flags().Uint32P("oneBet", "b", 10, "one bet number, eg:10 bty / 10 token")
//cmd.MarkFlagRequired("oneBet")
cmd.Flags().Uint32P("maxBets", "m", 10000, "max bets one time")
cmd.Flags().Uint32P("maxBetsOneTime", "m", 10000, "max bets one time")
//cmd.MarkFlagRequired("maxBets")
cmd.Flags().Uint32P("maxBetsNumber", "n", 100000, "max bets number")
//cmd.MarkFlagRequired("maxBetsNumber")
cmd.Flags().Int64P("devFeeFactor", "df", 0, "dev fee factor, unit: 1/1000")
cmd.Flags().Int64P("devFeeFactor", "d", 0, "dev fee factor, unit: 1/1000")
cmd.Flags().StringP("devFeeAddr", "dfa", "", "dev address to receive share")
cmd.Flags().StringP("devFeeAddr", "f", "", "dev address to receive share")
cmd.Flags().Int64P("platFeeFactor", "pf", 0, "plat fee factor, unit: 1/1000")
cmd.Flags().Int64P("platFeeFactor", "p", 0, "plat fee factor, unit: 1/1000")
cmd.Flags().StringP("platFeeAddr", "pfa", "", "plat address to receive share")
cmd.Flags().StringP("platFeeAddr", "q", "", "plat address to receive share")
cmd.Flags().StringP("expire", "ex", "", "expire time of the game, after this any addr can abort it")
cmd.Flags().StringP("expire", "x", "", "expire time of the game, after this any addr can abort it")
cmd.Flags().Uint32P("expireHeight", "eh", 0, "expire height of the game, after this any addr can abort it")
cmd.Flags().Int64P("expireHeight", "y", 0, "expire height of the game, after this any addr can abort it")
}
func guessStart(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
topic, _ := cmd.Flags().GetString("topic")
options, _ := cmd.Flags().GetString("options")
maxTime, _ := cmd.Flags().GetString("maxTime")
maxHeight, _ := cmd.Flags().GetUint32("maxHeight")
maxBetTime, _ := cmd.Flags().GetString("maxBetTime")
maxBetHeight, _ := cmd.Flags().GetInt64("maxBetHeight")
symbol, _ := cmd.Flags().GetString("symbol")
exec, _ := cmd.Flags().GetString("exec")
oneBet, _ := cmd.Flags().GetUint32("oneBet")
maxBets, _ := cmd.Flags().GetUint32("maxBets")
maxBetsNumber, _ := cmd.Flags().GetUint32("maxBetsNumber")
devFeeFactor, _ := cmd.Flags().GetInt64("devFeeFactor")
......@@ -91,17 +87,16 @@ func guessStart(cmd *cobra.Command, args []string) {
platFeeFactor, _ := cmd.Flags().GetInt64("platFeeFactor")
platFeeAddr, _ := cmd.Flags().GetString("platFeeAddr")
expire, _ := cmd.Flags().GetString("expire")
expireHeight, _ := cmd.Flags().GetUint32("expireHeight")
expireHeight, _ := cmd.Flags().GetInt64("expireHeight")
params := &pkt.GuessStartTxReq{
Topic: topic,
Options: options,
MaxTime: maxTime,
MaxHeight: maxHeight,
MaxBetTime: maxBetTime,
MaxBetHeight: maxBetHeight,
Symbol: symbol,
Exec: exec,
OneBet: oneBet,
MaxBets: maxBets,
MaxBetsOneTime: maxBets,
MaxBetsNumber: maxBetsNumber,
DevFeeFactor: devFeeFactor,
DevFeeAddr: devFeeAddr,
......@@ -217,7 +212,7 @@ func guessPublish(cmd *cobra.Command, args []string) {
func GuessQueryRawTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Short: "Query result",
Short: "query info",
Run: guessQuery,
}
addGuessQueryFlags(cmd)
......@@ -225,62 +220,130 @@ func GuessQueryRawTxCmd() *cobra.Command {
}
func addGuessQueryFlags(cmd *cobra.Command) {
cmd.Flags().StringP("gameID", "g", "", "game ID")
cmd.Flags().StringP("address", "a", "", "address")
cmd.Flags().StringP("index", "i", "", "index")
cmd.Flags().StringP("status", "s", "", "status")
cmd.Flags().Int32P("type", "t", 1, "query type, 1:QueryGamesByIds,2:QueryGameById,3:QueryGameByAddr,4:QueryGameByAddrStatus,5:QueryGameByStatus,6:QueryGameByAdminAddr,7:QueryGameByAddrStatusAddr,8:QueryGameByAdminStatusAddr,9:QueryGameByCategoryStatusAddr")
cmd.Flags().StringP("gameId", "g", "", "game Id")
cmd.Flags().StringP("addr", "a", "", "address")
cmd.Flags().StringP("adminAddr", "m", "", "admin address")
cmd.Flags().Int64P("index", "i", 0, "index")
cmd.Flags().Int32P("status", "s", 0, "status")
cmd.Flags().StringP("gameIDs", "d", "", "gameIDs")
cmd.Flags().StringP("category", "c", "default", "game category")
}
func guessQuery(cmd *cobra.Command, args []string) {
/*
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameID, _ := cmd.Flags().GetString("gameID")
address, _ := cmd.Flags().GetString("address")
statusStr, _ := cmd.Flags().GetString("status")
status, _ := strconv.ParseInt(statusStr, 10, 32)
indexstr, _ := cmd.Flags().GetString("index")
index, _ := strconv.ParseInt(indexstr, 10, 64)
ty, _ := cmd.Flags().GetInt32("type")
gameId, _ := cmd.Flags().GetString("gameId")
addr, _ := cmd.Flags().GetString("addr")
adminAddr, _ := cmd.Flags().GetString("adminAddr")
status, _ := cmd.Flags().GetInt32("status")
index, _ := cmd.Flags().GetInt64("index")
gameIDs, _ := cmd.Flags().GetString("gameIDs")
category, _ := cmd.Flags().GetString("category")
fmt.Println("ooo")
var params types.Query4Cli
params.Execer = pkt.GuessX
req := &pkt.QueryGuessGameInfo{
GameId: gameID,
Addr: address,
Status: int32(status),
Index: index,
}
params.Payload = req
if gameID != "" {
//query type,
//1:QueryGamesByIds,
//2:QueryGameById,
//3:QueryGameByAddr,
//4:QueryGameByStatus,
//5:QueryGameByAdminAddr,
//6:QueryGameByAddrStatus,
//7:QueryGameByAdminStatus,
//8:QueryGameByCategoryStatus,
switch ty{
case 1:
gameIds := strings.Split(gameIDs, ";")
req := &pkt.QueryGuessGameInfos{
GameIds: gameIds,
}
params.FuncName = pkt.FuncName_QueryGamesByIds
params.Payload = req
var res pkt.ReplyGuessGameInfos
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
case 2:
req := &pkt.QueryGuessGameInfo{
GameId: gameId,
}
params.FuncName = pkt.FuncName_QueryGameById
params.Payload = req
var res pkt.ReplyGuessGameInfo
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
} else if address != "" {
case 3:
req := &pkt.QueryGuessGameInfo{
Addr: addr,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByAddr
var res pkt.PBGameRecords
params.Payload = req
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
} else if statusStr != "" {
case 4:
req := &pkt.QueryGuessGameInfo{
Status: status,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByStatus
var res pkt.PBGameRecords
params.Payload = req
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
} else if gameIDs != "" {
params.FuncName = pkt.FuncName_QueryGameListByIds
var gameIDsS []string
gameIDsS = append(gameIDsS, gameIDs)
gameIDsS = append(gameIDsS, gameIDs)
req := &pkt.QueryPBGameInfos{gameIDsS}
case 5:
req := &pkt.QueryGuessGameInfo{
AdminAddr: adminAddr,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByAdminAddr
params.Payload = req
var res pkt.ReplyGuessGameInfos
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
case 6:
req := &pkt.QueryGuessGameInfo{
Addr: addr,
Status: status,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByAddrStatus
params.Payload = req
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
case 7:
req := &pkt.QueryGuessGameInfo{
AdminAddr: adminAddr,
Status: status,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByAdminStatus
params.Payload = req
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
case 8:
req := &pkt.QueryGuessGameInfo{
Category: category,
Status: status,
Index: index,
}
params.FuncName = pkt.FuncName_QueryGameByCategoryStatus
params.Payload = req
var res pkt.GuessGameRecords
ctx := jsonrpc.NewRpcCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
} else {
fmt.Println("Error: requeres at least one of gameID, address or status")
cmd.Help()
}
*/
}
......@@ -48,7 +48,7 @@ func (g *Guess) rollbackIndex(log *pkt.ReceiptGuessGame) (kvs []*types.KeyValue)
for i := 0; i < len(game.Plays); i++ {
player := game.Plays[i]
kvs = append(kvs, addGuessGameAddrStatusIndexKey(log.PreStatus, player.Addr, log.GameId, player.Bet.PreIndex))
kvs = append(kvs, delGuessGameAddrStatusIndexKey(log.Status, player.Addr, log.Index)
kvs = append(kvs, delGuessGameAddrStatusIndexKey(log.Status, player.Addr, log.Index))
}
}
}
......
......@@ -47,7 +47,7 @@ func (g *Guess) updateIndex(log *pkt.ReceiptGuessGame) (kvs []*types.KeyValue) {
for i := 0; i < len(game.Plays); i++ {
player := game.Plays[i]
kvs = append(kvs, addGuessGameAddrStatusIndexKey(log.Status, player.Addr, log.GameId, log.Index))
kvs = append(kvs, delGuessGameAddrStatusIndexKey(log.PreStatus, player.Addr, player.Bet.PreIndex)
kvs = append(kvs, delGuessGameAddrStatusIndexKey(log.PreStatus, player.Addr, player.Bet.PreIndex))
}
}
}
......
......@@ -6,7 +6,6 @@ package executor
import (
"context"
"errors"
"fmt"
"github.com/33cn/chain33/client"
"google.golang.org/grpc"
......@@ -26,17 +25,15 @@ const (
ListASC = int32(1)
DefaultCount = int32(20) //默认一次取多少条记录
MaxBets = 10000 //一次最多下多少注
MaxBetsOneTime = 10000 //一次最多下多少注
MaxBetsNumber = 100000 //一局游戏最多接受多少注
MaxHeight = 10000000000 //最大区块高度
MaxBetHeight = 10000000000 //最大区块高度
MinBetBlockNum = 720 //从创建游戏开始,一局游戏最少的可下注区块数量
MinBetTimeInterval = "2h" //从创建游戏开始,一局游戏最短的可下注时间
MinBetTimeoutNum = 8640 //从游戏结束下注开始,一局游戏最少的超时块数
MinBetTimeoutInterval = "24h" //从游戏结束下注开始,一局游戏最短的超时时间
MinOneBet = 1
grpcRecSize int = 5 * 30 * 1024 * 1024
retryNum = 10
......@@ -281,7 +278,7 @@ func getGameListByCategoryStatus(db dbm.Lister, category string, status int32, i
func (action *Action) saveGame(game *pkt.GuessGame) (kvset []*types.KeyValue) {
value := types.Encode(game)
action.db.Set(Key(game.GetGameId()), value)
kvset = append(kvset, &types.KeyValue{Key: Key(game.GameId), value})
kvset = append(kvset, &types.KeyValue{Key: Key(game.GameId), Value: value})
return kvset
}
......@@ -342,12 +339,11 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu
Topic: start.Topic,
Category: start.Category,
Options: start.Options,
MaxTime: start.MaxTime,
MaxHeight: start.MaxHeight,
MaxBetTime: start.MaxBetTime,
MaxBetHeight: start.MaxBetHeight,
Symbol: start.Symbol,
Exec: start.Exec,
OneBet: start.OneBet,
MaxBets: start.MaxBets,
MaxBetsOneTime: start.MaxBetsOneTime,
MaxBetsNumber: start.MaxBetsNumber,
DevFeeFactor: start.DevFeeFactor,
DevFeeAddr: start.DevFeeAddr,
......@@ -358,6 +354,7 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu
//AdminAddr: action.fromaddr,
BetsNumber: 0,
//Index: action.getIndex(game),
DrivenByAdmin: start.DrivenByAdmin,
}
return game, nil
......@@ -368,9 +365,9 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
var logs []*types.ReceiptLog
var kv []*types.KeyValue
if start.MaxHeight >= MaxHeight {
if start.MaxBetHeight >= MaxBetHeight {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr,
"err", fmt.Sprintf("The maximum height number is %d which is less thanstart.MaxHeight %d", MaxHeight, start.MaxHeight))
"err", fmt.Sprintf("The maximum height number is %d which is less thanstart.MaxHeight %d", MaxBetHeight, start.MaxBetHeight))
return nil, types.ErrInvalidParam
}
......@@ -393,9 +390,9 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
return nil, types.ErrInvalidParam
}
if !action.CheckTime() {
if !action.CheckTime(start) {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr,
"err", fmt.Sprintf("The height and time parameters are illegal:MaxTime %s MaxHeight %d Expire %s, ExpireHeight %d", start.MaxTime, start.MaxHeight, start.Expire, start.ExpireHeight))
"err", fmt.Sprintf("The height and time parameters are illegal:MaxTime %s MaxHeight %d Expire %s, ExpireHeight %d", start.MaxBetTime, start.MaxBetHeight, start.Expire, start.ExpireHeight))
return nil, types.ErrInvalidParam
}
......@@ -407,19 +404,12 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
start.Exec = "coins"
}
if start.OneBet < MinOneBet {
start.OneBet = MinOneBet
}
if start.MaxBets >= MaxBets {
start.MaxBets = MaxBets
if start.MaxBetsOneTime >= MaxBetsOneTime {
start.MaxBetsOneTime = MaxBetsOneTime
}
gameId := common.ToHex(action.txhash)
game, err := action.newGame(gameId, start)
if err != nil {
return nil, err
}
game, _ := action.newGame(gameId, start)
game.StartTime = action.blocktime
game.AdminAddr = action.fromaddr
game.PreIndex = 0
......@@ -454,7 +444,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
if game.Status != pkt.GuessGameStatusStart && game.Status != pkt.GuessGameStatusBet && game.Status != pkt.GuessGameStatusStopBet{
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "Status error",
game.GetStatus())
return nil, errors.New("ErrGameStatus")
return nil, pkt.ErrGuessStatus
}
canBet := action.RefreshStatusByTime(game)
......@@ -490,8 +480,8 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
}
//检查下注金额是否超限,如果超限,按最大值
if pbBet.GetBetsNum() > game.GetMaxBets() {
pbBet.BetsNum = game.GetMaxBets()
if pbBet.GetBetsNum() > game.GetMaxBetsOneTime() {
pbBet.BetsNum = game.GetMaxBetsOneTime()
}
if game.BetsNumber + pbBet.GetBetsNum() > game.MaxBetsNumber {
......@@ -501,7 +491,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
}
// 检查余额账户余额
checkValue := int64(game.GetOneBet() * pbBet.BetsNum)
checkValue := int64(pbBet.BetsNum)
if !action.CheckExecAccountBalance(action.fromaddr, checkValue, 0) {
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "id",
pbBet.GetGameId(), "err", types.ErrNoBalance)
......@@ -545,11 +535,10 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
return nil, err
}
prevStatus := game.Status
if game.Status != pkt.GuessGameStatusStart && game.Status != pkt.GuessGameStatusBet{
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "Status error",
game.GetStatus())
return nil, errors.New("ErrGameStatus")
return nil, pkt.ErrGuessStatus
}
//只有adminAddr可以发起publish
......@@ -562,13 +551,10 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
action.ChangeStatus(game, pkt.GuessGameStatusStopBet)
var receiptLog *types.ReceiptLog
if prevStatus != game.Status {
//状态发生变化,更新所有addr对应记录的index
action.ChangeAllAddrIndex(game)
receiptLog = action.GetReceiptLog(game, true)
} else {
receiptLog = action.GetReceiptLog(game, false)
}
//状态发生变化,更新所有addr对应记录的index
action.ChangeAllAddrIndex(game)
receiptLog = action.GetReceiptLog(game, true)
logs = append(logs, receiptLog)
kv = append(kv, action.saveGame(game)...)
......@@ -614,11 +600,10 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
return nil, types.ErrInvalidParam
}
prevStatus := game.Status
if game.Status != pkt.GuessGameStatusStart && game.Status != pkt.GuessGameStatusBet && game.Status != pkt.GuessGameStatusStopBet{
logger.Error("GamePublish", "addr", action.fromaddr, "execaddr", action.execaddr, "Status error",
game.GetStatus())
return nil, errors.New("ErrGameStatus")
return nil, pkt.ErrGuessStatus
}
//检查竞猜选项是否合法
......@@ -640,7 +625,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
//先遍历所有下注数据,转移资金到Admin账户合约地址;
for i := 0; i < len(game.Plays); i++ {
player := game.Plays[i]
value := int64(player.Bet.BetsNumber * game.OneBet)
value := int64(player.Bet.BetsNumber)
receipt, err := action.coinsAccount.ExecTransfer(player.Addr, game.AdminAddr, action.execaddr, value)
if err != nil {
action.coinsAccount.ExecFrozen(game.AdminAddr, action.execaddr, value) // rollback
......@@ -676,7 +661,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
if game.DevFeeFactor > 0 {
devFee = int64(totalBetsNumber) * game.DevFeeFactor * int64(game.OneBet)/ 1000
devFee = int64(totalBetsNumber) * game.DevFeeFactor / 1000
receipt, err := action.coinsAccount.ExecTransfer(game.AdminAddr, devAddr, action.execaddr, devFee)
if err != nil {
action.coinsAccount.ExecFrozen(game.AdminAddr, action.execaddr, devFee) // rollback
......@@ -689,7 +674,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
if game.PlatFeeFactor > 0 {
platFee = int64(totalBetsNumber) * game.PlatFeeFactor * int64(game.OneBet) / 1000
platFee = int64(totalBetsNumber) * game.PlatFeeFactor / 1000
receipt, err := action.coinsAccount.ExecTransfer(game.AdminAddr, platAddr, action.execaddr, platFee)
if err != nil {
action.coinsAccount.ExecFrozen(game.AdminAddr, action.execaddr, platFee) // rollback
......@@ -702,7 +687,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
//再遍历赢家,按照投注占比分配所有筹码
winValue := int64(totalBetsNumber * game.OneBet) - devFee - platFee
winValue := int64(totalBetsNumber) - devFee - platFee
for j := 0; j < len(game.Plays); j++ {
player := game.Plays[j]
if player.Bet.Option == game.Result {
......@@ -722,12 +707,9 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
var receiptLog *types.ReceiptLog
if prevStatus != game.Status {
action.ChangeAllAddrIndex(game)
receiptLog = action.GetReceiptLog(game, true)
} else {
receiptLog = action.GetReceiptLog(game, false)
}
action.ChangeAllAddrIndex(game)
receiptLog = action.GetReceiptLog(game, true)
logs = append(logs, receiptLog)
kv = append(kv, action.saveGame(game)...)
......@@ -768,12 +750,13 @@ func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, erro
//激活冻结账户
for i := 0; i < len(game.Plays); i++ {
player := game.Plays[i]
value := int64(player.Bet.BetsNumber * game.OneBet)
value := int64(player.Bet.BetsNumber)
receipt, err := action.coinsAccount.ExecActive(player.Addr, action.execaddr, value)
if err != nil {
logger.Error("GameAbort", "addr", player.Addr, "execaddr", action.execaddr, "amount", value, "err", err)
continue
}
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
}
......@@ -842,10 +825,15 @@ func (action *Action) ChangeAllAddrIndex(game *pkt.GuessGame) {
}
func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
//如果完全由管理员驱动状态变化,则不需要做如下判断保护。
if game.DrivenByAdmin {
return true
}
// 检查区块高度是否超过最大下注高度限制,看是否可以下注
if game.GetMaxHeight() <= action.height {
if game.GetMaxBetHeight() <= action.height {
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "Height over limit",
action.height, "MaxHeight", game.GetMaxHeight())
action.height, "MaxHeight", game.GetMaxBetHeight())
if game.GetExpireHeight() > action.height {
action.ChangeStatus(game, pkt.GuessGameStatusStopBet)
} else {
......@@ -857,11 +845,11 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
}
// 检查区块高度是否超过下注时间限制,看是否可以下注
if len(game.GetMaxTime()) > 0 {
tMax, err := time.Parse("2006-01-02 15:04:05", game.GetMaxTime())
if len(game.GetMaxBetTime()) > 0 {
tMax, err := time.Parse("2006-01-02 15:04:05", game.GetMaxBetTime())
if err != nil {
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "Parse MaxTime failed",
game.GetMaxTime())
game.GetMaxBetTime())
canBet = true
return canBet
}
......@@ -877,7 +865,7 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
tNow := time.Now()
if tNow.After(tMax) {
logger.Error("GameBet", "addr", action.fromaddr, "execaddr", action.execaddr, "Time over MaxTime",
game.GetMaxTime())
game.GetMaxBetTime())
if tNow.After(tExpire) {
action.ChangeStatus(game, pkt.GuessGameStatusTimeOut)
......@@ -895,28 +883,34 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
}
func (action *Action) CheckTime(start *pkt.GuessGameStart) bool {
if action.height + MinBetBlockNum > start.MaxHeight || start.MaxHeight + MinBetTimeoutNum > start.ExpireHeight {
if len(start.MaxBetTime) == 0 && len(start.Expire) == 0 && start.MaxBetHeight == 0 && start.ExpireHeight == 0 {
//如果上述字段都不携带,则认为完全由admin的指令驱动。
start.DrivenByAdmin = true
return true
}
if action.height + MinBetBlockNum > start.MaxBetHeight || start.MaxBetHeight + MinBetTimeoutNum > start.ExpireHeight {
return false
}
tNow := time.Now()
d1, _ := time.ParseDuration(MinBetTimeInterval) //最短开奖时间
d2, _ := time.ParseDuration(MinBetTimeoutInterval) //最短游戏过期时间
if len(start.GetMaxTime()) == 0 {
if len(start.GetMaxBetTime()) == 0 {
tNow.Add(d1)
start.MaxTime = tNow.Format("2006-01-02 15:04:05")
start.MaxBetTime = tNow.Format("2006-01-02 15:04:05")
}
if len(start.GetExpire()) == 0 {
tMax, _ := time.Parse("2006-01-02 15:04:05", start.GetMaxTime())
tMax, _ := time.Parse("2006-01-02 15:04:05", start.GetMaxBetTime())
tMax.Add(d2)
start.Expire = tMax.Format("2006-01-02 15:04:05")
}
tMax, err := time.Parse("2006-01-02 15:04:05", start.GetMaxTime())
tMax, err := time.Parse("2006-01-02 15:04:05", start.GetMaxBetTime())
if err != nil {
logger.Error("CheckTime", "addr", action.fromaddr, "execaddr", action.execaddr, "Parse MaxTime failed",
start.GetMaxTime())
start.GetMaxBetTime())
return false
}
......
......@@ -30,15 +30,6 @@ func (g *Guess) Query_QueryGameByAddr(in *pkt.QueryGuessGameInfo) (types.Message
return records, nil
}
func (g *Guess) Query_QueryGameByAddrStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAddr(g.GetLocalDB(), in.Addr, in.Index)
if err != nil {
return nil, err
}
return records, nil
}
func (g *Guess) Query_QueryGameByStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByStatus(g.GetLocalDB(), in.Status, in.Index)
if err != nil {
......@@ -57,7 +48,7 @@ func (g *Guess) Query_QueryGameByAdminAddr(in *pkt.QueryGuessGameInfo) (types.Me
return records, nil
}
func (g *Guess) Query_QueryGameByAddrStatusAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) {
func (g *Guess) Query_QueryGameByAddrStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAddrStatus(g.GetLocalDB(), in.Addr, in.Status, in.Index)
if err != nil {
return nil, err
......@@ -66,7 +57,7 @@ func (g *Guess) Query_QueryGameByAddrStatusAddr(in *pkt.QueryGuessGameInfo) (typ
return records, nil
}
func (g *Guess) Query_QueryGameByAdminStatusAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) {
func (g *Guess) Query_QueryGameByAdminStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByAdminStatus(g.GetLocalDB(), in.AdminAddr, in.Status, in.Index)
if err != nil {
return nil, err
......@@ -75,7 +66,7 @@ func (g *Guess) Query_QueryGameByAdminStatusAddr(in *pkt.QueryGuessGameInfo) (ty
return records, nil
}
func (g *Guess) Query_QueryGameByCategoryStatusAddr(in *pkt.QueryGuessGameInfo) (types.Message, error) {
func (g *Guess) Query_QueryGameByCategoryStatus(in *pkt.QueryGuessGameInfo) (types.Message, error) {
records, err := getGameListByCategoryStatus(g.GetLocalDB(), in.Category, in.Status, in.Index)
if err != nil {
return nil, err
......
......@@ -14,12 +14,11 @@ message GuessGame {
string topic = 6; //主题
string category = 7; //分类
string options = 8; //选项
string maxTime = 9; //截止下注时间
int64 maxHeight = 10; //截止下注的块高
string maxBetTime = 9; //截止下注时间
int64 maxBetHeight = 10; //截止下注的块高
string symbol = 11; //bty或者具体token
string exec = 12; //coins或者token
uint32 oneBet = 13; //一注等于多少bty或者token
uint32 maxBets = 14; //单次可以下多少注,默认100
uint32 maxBetsOneTime= 14; //单次可以下多少注,默认100
uint32 maxBetsNumber = 15; //最多可以下多少注
int64 devFeeFactor = 16; //开发者抽成比例
string devFeeAddr = 17; //开发者地址
......@@ -34,6 +33,7 @@ message GuessGame {
GuessBetStat betStat = 26;
int64 index = 27;
int64 preIndex = 28;
bool drivenByAdmin = 29;
}
message GuessPlayer {
......@@ -80,12 +80,11 @@ message GuessGameStart{
string topic = 1;
string options = 2;
string category = 3;
string maxTime = 4;
int64 maxHeight = 5;
string maxBetTime = 4;
int64 maxBetHeight = 5;
string symbol = 6;
string exec = 7;
uint32 oneBet = 8;
uint32 maxBets = 9;
uint32 maxBetsOneTime= 9;
uint32 maxBetsNumber = 10;
int64 devFeeFactor = 11; //开发者抽成比例
string devFeeAddr = 12; //开发者地址
......@@ -93,7 +92,7 @@ message GuessGameStart{
string platFeeAddr = 14; //平台地址
string expire = 15;
int64 expireHeight = 16;
int64 fee = 17;
bool drivenByAdmin = 17;
}
//参与游戏下注
......@@ -101,33 +100,28 @@ message GuessGameBet{
string gameId = 1;
string option = 2;
uint32 betsNum = 3;
int64 fee = 4;
}
//游戏停止下注
message GuessGameStopBet{
string gameId = 1;
int64 fee = 2;
}
//游戏异常终止,退还下注
message GuessGameAbort{
string gameId = 1;
int64 fee = 2;
}
//游戏结果揭晓
message GuessGamePublish{
string gameId = 1;
string result = 2;
int64 fee = 3;
}
//查询游戏结果
message GuessGameQuery{
string gameId = 1;
uint32 ty = 2;
int64 fee = 3;
}
......@@ -168,20 +162,19 @@ message GuessStartTxReq {
string topic = 1;
string options = 2;
int64 startTime = 3;
string maxTime = 4;
uint32 maxHeight = 5;
string maxBetTime = 4;
int64 maxBetHeight = 5;
string symbol = 6;
string exec = 7;
uint32 oneBet = 8;
uint32 maxBets = 9;
uint32 maxBetsNumber = 10;
int64 devFeeFactor = 11;
string devFeeAddr = 12;
int64 platFeeFactor = 13;
string platFeeAddr = 14;
string feeAddr = 15;
string expire = 16;
uint32 expireHeight = 17;
uint32 maxBetsOneTime = 8;
uint32 maxBetsNumber = 9;
int64 devFeeFactor = 10;
string devFeeAddr = 11;
int64 platFeeFactor = 12;
string platFeeAddr = 13;
string feeAddr = 14;
string expire = 15;
int64 expireHeight = 16;
}
message GuessBetTxReq {
......
......@@ -19,16 +19,18 @@ func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error
head := &pb.GuessGameStart{
Topic: parm.Topic,
Options: parm.Options,
MaxHeight: parm.MaxHeight,
MaxBetTime: parm.MaxBetTime,
MaxBetHeight: parm.MaxBetHeight,
Symbol: parm.Symbol,
Exec: parm.Exec,
OneBet: parm.OneBet,
MaxBets: parm.MaxBets,
MaxBetsOneTime: parm.MaxBetsOneTime,
MaxBetsNumber: parm.MaxBetsNumber,
DevFeeFactor: parm.DevFeeFactor,
DevFeeAddr: parm.DevFeeAddr,
PlatFeeFactor: parm.PlatFeeFactor,
PlatFeeAddr: parm.PlatFeeAddr,
Expire: parm.Expire,
ExpireHeight: parm.ExpireHeight,
}
reply, err := c.cli.GuessStart(context.Background(), head)
......
......@@ -46,12 +46,14 @@ var (
const (
//查询方法名
FuncName_QueryGameListByIds = "QueryGameListByIds"
FuncName_QueryGameById = "QueryGameById"
FuncName_QueryGameByAddr = "QueryGameByAddr"
FuncName_QueryGameByStatus = "QueryGameByStatus"
//FuncName_QueryGameByAdminAddr = "QueryGameByAdminAddr"
//FuncName_QueryGameByCategory = "QueryGameByCategory"
FuncName_QueryGamesByIds = "QueryGamesByIds"
FuncName_QueryGameById = "QueryGameById"
FuncName_QueryGameByAddr = "QueryGameByAddr"
FuncName_QueryGameByStatus = "QueryGameByStatus"
FuncName_QueryGameByAdminAddr = "QueryGameByAdminAddr"
FuncName_QueryGameByAddrStatus = "QueryGameByAddrStatus"
FuncName_QueryGameByAdminStatus = "QueryGameByAdminStatus"
FuncName_QueryGameByCategoryStatus="QueryGameByCategoryStatus"
)
const (
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
import "errors"
// Errors for lottery
var (
ErrNoPrivilege = errors.New("ErrNoPrivilege")
ErrGuessStatus = errors.New("ErrGuessStatus")
)
......@@ -33,12 +33,11 @@ type GuessGame struct {
Topic string `protobuf:"bytes,6,opt,name=topic,proto3" json:"topic,omitempty"`
Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"`
Options string `protobuf:"bytes,8,opt,name=options,proto3" json:"options,omitempty"`
MaxTime string `protobuf:"bytes,9,opt,name=maxTime,proto3" json:"maxTime,omitempty"`
MaxHeight int64 `protobuf:"varint,10,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
MaxBetTime string `protobuf:"bytes,9,opt,name=maxBetTime,proto3" json:"maxBetTime,omitempty"`
MaxBetHeight int64 `protobuf:"varint,10,opt,name=maxBetHeight,proto3" json:"maxBetHeight,omitempty"`
Symbol string `protobuf:"bytes,11,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec string `protobuf:"bytes,12,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet uint32 `protobuf:"varint,13,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets uint32 `protobuf:"varint,14,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsOneTime uint32 `protobuf:"varint,14,opt,name=maxBetsOneTime,proto3" json:"maxBetsOneTime,omitempty"`
MaxBetsNumber uint32 `protobuf:"varint,15,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
DevFeeFactor int64 `protobuf:"varint,16,opt,name=devFeeFactor,proto3" json:"devFeeFactor,omitempty"`
DevFeeAddr string `protobuf:"bytes,17,opt,name=devFeeAddr,proto3" json:"devFeeAddr,omitempty"`
......@@ -53,6 +52,7 @@ type GuessGame struct {
BetStat *GuessBetStat `protobuf:"bytes,26,opt,name=betStat,proto3" json:"betStat,omitempty"`
Index int64 `protobuf:"varint,27,opt,name=index,proto3" json:"index,omitempty"`
PreIndex int64 `protobuf:"varint,28,opt,name=preIndex,proto3" json:"preIndex,omitempty"`
DrivenByAdmin bool `protobuf:"varint,29,opt,name=drivenByAdmin,proto3" json:"drivenByAdmin,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -139,16 +139,16 @@ func (m *GuessGame) GetOptions() string {
return ""
}
func (m *GuessGame) GetMaxTime() string {
func (m *GuessGame) GetMaxBetTime() string {
if m != nil {
return m.MaxTime
return m.MaxBetTime
}
return ""
}
func (m *GuessGame) GetMaxHeight() int64 {
func (m *GuessGame) GetMaxBetHeight() int64 {
if m != nil {
return m.MaxHeight
return m.MaxBetHeight
}
return 0
}
......@@ -167,16 +167,9 @@ func (m *GuessGame) GetExec() string {
return ""
}
func (m *GuessGame) GetOneBet() uint32 {
func (m *GuessGame) GetMaxBetsOneTime() uint32 {
if m != nil {
return m.OneBet
}
return 0
}
func (m *GuessGame) GetMaxBets() uint32 {
if m != nil {
return m.MaxBets
return m.MaxBetsOneTime
}
return 0
}
......@@ -279,6 +272,13 @@ func (m *GuessGame) GetPreIndex() int64 {
return 0
}
func (m *GuessGame) GetDrivenByAdmin() bool {
if m != nil {
return m.DrivenByAdmin
}
return false
}
type GuessPlayer struct {
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
Bet *GuessBet `protobuf:"bytes,2,opt,name=bet,proto3" json:"bet,omitempty"`
......@@ -807,12 +807,11 @@ type GuessGameStart struct {
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"`
MaxTime string `protobuf:"bytes,4,opt,name=maxTime,proto3" json:"maxTime,omitempty"`
MaxHeight int64 `protobuf:"varint,5,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
MaxBetTime string `protobuf:"bytes,4,opt,name=maxBetTime,proto3" json:"maxBetTime,omitempty"`
MaxBetHeight int64 `protobuf:"varint,5,opt,name=maxBetHeight,proto3" json:"maxBetHeight,omitempty"`
Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec string `protobuf:"bytes,7,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet uint32 `protobuf:"varint,8,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets uint32 `protobuf:"varint,9,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsOneTime uint32 `protobuf:"varint,9,opt,name=maxBetsOneTime,proto3" json:"maxBetsOneTime,omitempty"`
MaxBetsNumber uint32 `protobuf:"varint,10,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
DevFeeFactor int64 `protobuf:"varint,11,opt,name=devFeeFactor,proto3" json:"devFeeFactor,omitempty"`
DevFeeAddr string `protobuf:"bytes,12,opt,name=devFeeAddr,proto3" json:"devFeeAddr,omitempty"`
......@@ -820,7 +819,7 @@ type GuessGameStart struct {
PlatFeeAddr string `protobuf:"bytes,14,opt,name=platFeeAddr,proto3" json:"platFeeAddr,omitempty"`
Expire string `protobuf:"bytes,15,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight int64 `protobuf:"varint,16,opt,name=expireHeight,proto3" json:"expireHeight,omitempty"`
Fee int64 `protobuf:"varint,17,opt,name=fee,proto3" json:"fee,omitempty"`
DrivenByAdmin bool `protobuf:"varint,17,opt,name=drivenByAdmin,proto3" json:"drivenByAdmin,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -872,16 +871,16 @@ func (m *GuessGameStart) GetCategory() string {
return ""
}
func (m *GuessGameStart) GetMaxTime() string {
func (m *GuessGameStart) GetMaxBetTime() string {
if m != nil {
return m.MaxTime
return m.MaxBetTime
}
return ""
}
func (m *GuessGameStart) GetMaxHeight() int64 {
func (m *GuessGameStart) GetMaxBetHeight() int64 {
if m != nil {
return m.MaxHeight
return m.MaxBetHeight
}
return 0
}
......@@ -900,16 +899,9 @@ func (m *GuessGameStart) GetExec() string {
return ""
}
func (m *GuessGameStart) GetOneBet() uint32 {
func (m *GuessGameStart) GetMaxBetsOneTime() uint32 {
if m != nil {
return m.OneBet
}
return 0
}
func (m *GuessGameStart) GetMaxBets() uint32 {
if m != nil {
return m.MaxBets
return m.MaxBetsOneTime
}
return 0
}
......@@ -963,11 +955,11 @@ func (m *GuessGameStart) GetExpireHeight() int64 {
return 0
}
func (m *GuessGameStart) GetFee() int64 {
func (m *GuessGameStart) GetDrivenByAdmin() bool {
if m != nil {
return m.Fee
return m.DrivenByAdmin
}
return 0
return false
}
//参与游戏下注
......@@ -975,7 +967,6 @@ type GuessGameBet struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Option string `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"`
BetsNum uint32 `protobuf:"varint,3,opt,name=betsNum,proto3" json:"betsNum,omitempty"`
Fee int64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1027,17 +1018,9 @@ func (m *GuessGameBet) GetBetsNum() uint32 {
return 0
}
func (m *GuessGameBet) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
}
//游戏停止下注
type GuessGameStopBet struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1075,17 +1058,9 @@ func (m *GuessGameStopBet) GetGameId() string {
return ""
}
func (m *GuessGameStopBet) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
}
//游戏异常终止,退还下注
type GuessGameAbort struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee int64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1123,18 +1098,10 @@ func (m *GuessGameAbort) GetGameId() string {
return ""
}
func (m *GuessGameAbort) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
}
//游戏结果揭晓
type GuessGamePublish struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
Fee int64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1179,18 +1146,10 @@ func (m *GuessGamePublish) GetResult() string {
return ""
}
func (m *GuessGamePublish) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
}
//查询游戏结果
type GuessGameQuery struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Ty uint32 `protobuf:"varint,2,opt,name=ty,proto3" json:"ty,omitempty"`
Fee int64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1235,13 +1194,6 @@ func (m *GuessGameQuery) GetTy() uint32 {
return 0
}
func (m *GuessGameQuery) GetFee() int64 {
if m != nil {
return m.Fee
}
return 0
}
type QueryGuessGameInfo struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
......@@ -1545,20 +1497,19 @@ type GuessStartTxReq struct {
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
StartTime int64 `protobuf:"varint,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
MaxTime string `protobuf:"bytes,4,opt,name=maxTime,proto3" json:"maxTime,omitempty"`
MaxHeight uint32 `protobuf:"varint,5,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
MaxBetTime string `protobuf:"bytes,4,opt,name=maxBetTime,proto3" json:"maxBetTime,omitempty"`
MaxBetHeight int64 `protobuf:"varint,5,opt,name=maxBetHeight,proto3" json:"maxBetHeight,omitempty"`
Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec string `protobuf:"bytes,7,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet uint32 `protobuf:"varint,8,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets uint32 `protobuf:"varint,9,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsNumber uint32 `protobuf:"varint,10,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
DevFeeFactor int64 `protobuf:"varint,11,opt,name=devFeeFactor,proto3" json:"devFeeFactor,omitempty"`
DevFeeAddr string `protobuf:"bytes,12,opt,name=devFeeAddr,proto3" json:"devFeeAddr,omitempty"`
PlatFeeFactor int64 `protobuf:"varint,13,opt,name=platFeeFactor,proto3" json:"platFeeFactor,omitempty"`
PlatFeeAddr string `protobuf:"bytes,14,opt,name=platFeeAddr,proto3" json:"platFeeAddr,omitempty"`
FeeAddr string `protobuf:"bytes,15,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
Expire string `protobuf:"bytes,16,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight uint32 `protobuf:"varint,17,opt,name=expireHeight,proto3" json:"expireHeight,omitempty"`
MaxBetsOneTime uint32 `protobuf:"varint,8,opt,name=maxBetsOneTime,proto3" json:"maxBetsOneTime,omitempty"`
MaxBetsNumber uint32 `protobuf:"varint,9,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
DevFeeFactor int64 `protobuf:"varint,10,opt,name=devFeeFactor,proto3" json:"devFeeFactor,omitempty"`
DevFeeAddr string `protobuf:"bytes,11,opt,name=devFeeAddr,proto3" json:"devFeeAddr,omitempty"`
PlatFeeFactor int64 `protobuf:"varint,12,opt,name=platFeeFactor,proto3" json:"platFeeFactor,omitempty"`
PlatFeeAddr string `protobuf:"bytes,13,opt,name=platFeeAddr,proto3" json:"platFeeAddr,omitempty"`
FeeAddr string `protobuf:"bytes,14,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
Expire string `protobuf:"bytes,15,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight int64 `protobuf:"varint,16,opt,name=expireHeight,proto3" json:"expireHeight,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -1610,16 +1561,16 @@ func (m *GuessStartTxReq) GetStartTime() int64 {
return 0
}
func (m *GuessStartTxReq) GetMaxTime() string {
func (m *GuessStartTxReq) GetMaxBetTime() string {
if m != nil {
return m.MaxTime
return m.MaxBetTime
}
return ""
}
func (m *GuessStartTxReq) GetMaxHeight() uint32 {
func (m *GuessStartTxReq) GetMaxBetHeight() int64 {
if m != nil {
return m.MaxHeight
return m.MaxBetHeight
}
return 0
}
......@@ -1638,16 +1589,9 @@ func (m *GuessStartTxReq) GetExec() string {
return ""
}
func (m *GuessStartTxReq) GetOneBet() uint32 {
if m != nil {
return m.OneBet
}
return 0
}
func (m *GuessStartTxReq) GetMaxBets() uint32 {
func (m *GuessStartTxReq) GetMaxBetsOneTime() uint32 {
if m != nil {
return m.MaxBets
return m.MaxBetsOneTime
}
return 0
}
......@@ -1701,7 +1645,7 @@ func (m *GuessStartTxReq) GetExpire() string {
return ""
}
func (m *GuessStartTxReq) GetExpireHeight() uint32 {
func (m *GuessStartTxReq) GetExpireHeight() int64 {
if m != nil {
return m.ExpireHeight
}
......@@ -2021,88 +1965,88 @@ func init() {
func init() { proto.RegisterFile("guess.proto", fileDescriptor_7574406c5d3430e8) }
var fileDescriptor_7574406c5d3430e8 = []byte{
// 1281 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4b, 0x6f, 0xdb, 0xc6,
0x13, 0x8f, 0x48, 0x51, 0x8f, 0x91, 0x65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a, 0x2c, 0xa6, 0xdf, 0xf6,
0x17, 0xaa, 0xaa, 0x08, 0x58, 0xb7, 0x6e, 0x6b, 0xbf, 0x84, 0x63, 0x39, 0x50, 0x4b, 0x64, 0xdd,
0x19, 0x43, 0x21, 0xbc, 0xbe, 0xd7, 0x26, 0x35, 0x87, 0x8f, 0x82, 0x68, 0x7c, 0xef, 0xef, 0xe1,
0x55, 0x7f, 0x95, 0xb5, 0xfe, 0xb2, 0x5f, 0xc1, 0x03, 0x0d, 0x60, 0xc6, 0x7c, 0xb1, 0x63, 0xf7,
0xd5, 0x2e, 0x46, 0x76, 0x97, 0x4e, 0x2e, 0xbc, 0x98, 0x7d, 0x0d, 0xb5, 0x48, 0xfe, 0x54, 0x50,
0xf5, 0x68, 0x0d, 0xaa, 0xc8, 0xec, 0x24, 0x6e, 0xfd, 0x3f, 0x4b, 0x60, 0xd2, 0x3f, 0x03, 0xec,
0x1b, 0x80, 0xb4, 0x69, 0x59, 0xf1, 0x10, 0x7a, 0x9a, 0x7c, 0x79, 0xfc, 0xe4, 0xc7, 0xde, 0xc4,
0x7f, 0xb7, 0xb0, 0x0f, 0x58, 0x5f, 0xfb, 0xea, 0x28, 0x9a, 0x46, 0x8b, 0xd6, 0x24, 0x67, 0x49,
0x8e, 0x2c, 0x9e, 0x31, 0x8b, 0xd6, 0xbd, 0x50, 0x2c, 0x9f, 0x30, 0xe6, 0xa6, 0x61, 0xb3, 0x60,
0xed, 0xb0, 0x4a, 0x7f, 0x70, 0x3c, 0xff, 0x27, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x17, 0xde, 0x9c,
0x09, 0x11, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc
package types
type GuessGameStart struct {
type GuessGameStartTx struct {
Topic string `json:"topic,omitempty"`
Options string `json:"options,omitempty"`
Category string `json:"category,omitempty"`
MaxTime string `json:"maxTime,omitempty"`
MaxHeight int64 `json:"maxHeight,omitempty"`
MaxBetTime string `json:"maxTime,omitempty"`
MaxBetHeight int64 `json:"maxHeight,omitempty"`
Symbol string `json:"symbol,omitempty"`
Exec string `json:"exec,omitempty"`
OneBet uint32 `json:"oneBet,omitempty"`
MaxBets uint32 `json:"maxBets,omitempty"`
MaxBetsNumber uint32 `json:"maxBetsNumber,omitempty"`
DevFeeFactor int64 `json:"devFeeFactor,omitempty"`
......@@ -24,25 +23,25 @@ type GuessGameStart struct {
Fee int64 `json:"fee,omitempty"`
}
type GuessGameBet struct {
type GuessGameBetTx struct {
GameId string `json:"gameId,omitempty"`
Option string `json:"option,omitempty"`
BetsNum uint32 `json:"betsNum,omitempty"`
Fee int64 `json:"fee,omitempty"`
}
type GuessGameStopBet struct {
type GuessGameStopBetTx struct {
GameId string `json:"gameId,omitempty"`
Fee int64 `json:"fee,omitempty"`
}
type GuessGamePublish struct {
type GuessGamePublishTx struct {
GameId string `json:"gameId,omitempty"`
Result string `json:"result,omitempty"`
Fee int64 `json:"fee,omitempty"`
}
type GuessGameAbort struct {
type GuessGameAbortTx struct {
GameId string `json:"gameId,omitempty"`
Fee int64 `json:"fee,omitempty"`
}
......@@ -66,7 +66,7 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra
llog.Debug("Guess.CreateTx", "action", action)
if action == "GuessStart" {
var param GuessStartTxReq
var param GuessGameStartTx
err := json.Unmarshal(message, &param)
if err != nil {
llog.Error("CreateTx.GuessStart", "Error", err)
......@@ -74,15 +74,23 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra
}
return CreateRawGuessStartTx(&param)
} else if action == "GuessBet" {
var param GuessBetTxReq
var param GuessGameBetTx
err := json.Unmarshal(message, &param)
if err != nil {
llog.Error("CreateTx.GuessBet", "Error", err)
return nil, types.ErrInvalidParam
}
return CreateRawGuessBetTx(&param)
} else if action == "GuessStopBet" {
var param GuessGameStopBetTx
err := json.Unmarshal(message, &param)
if err != nil {
llog.Error("CreateTx.GuessStopBet", "Error", err)
return nil, types.ErrInvalidParam
}
return CreateRawGuessStopBetTx(&param)
} else if action == "GuessPublish" {
var param GuessPublishTxReq
var param GuessGamePublishTx
err := json.Unmarshal(message, &param)
if err != nil {
llog.Error("CreateTx.GuessPublish", "Error", err)
......@@ -90,7 +98,7 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra
}
return CreateRawGuessPublishTx(&param)
} else if action == "GuessAbort" {
var param GuessAbortTxReq
var param GuessGameAbortTx
err := json.Unmarshal(message, &param)
if err != nil {
llog.Error("CreateTx.GuessAbort", "Error", err)
......@@ -103,15 +111,33 @@ func (t *GuessType) CreateTx(action string, message json.RawMessage) (*types.Tra
}
// CreateRawLotteryCreateTx method
func CreateRawGuessStartTx(parm *GuessGameStart) (*types.Transaction, error) {
func CreateRawGuessStartTx(parm *GuessGameStartTx) (*types.Transaction, error) {
if parm == nil {
llog.Error("CreateRawGuessStartTx", "parm", parm)
return nil, types.ErrInvalidParam
}
v := &GuessGameStart {
Topic: parm.Topic,
Options: parm.Options,
Category: parm.Category,
MaxBetTime: parm.MaxBetTime,
MaxBetHeight: parm.MaxBetHeight,
Symbol: parm.Symbol,
Exec: parm.Exec,
MaxBetsOneTime: parm.MaxBets,
MaxBetsNumber: parm.MaxBetsNumber,
DevFeeFactor: parm.DevFeeFactor,
DevFeeAddr: parm.DevFeeAddr,
PlatFeeFactor: parm.PlatFeeFactor,
PlatFeeAddr: parm.PlatFeeAddr,
Expire: parm.Expire,
ExpireHeight: parm.ExpireHeight,
}
val := &GuessGameAction{
Ty: GuessGameActionStart,
Value: &GuessGameAction_Start{Start: parm},
Value: &GuessGameAction_Start{Start: v},
}
name := types.ExecName(GuessX)
tx := &types.Transaction{
......@@ -129,15 +155,20 @@ func CreateRawGuessStartTx(parm *GuessGameStart) (*types.Transaction, error) {
}
// CreateRawGuessBetTx method
func CreateRawGuessBetTx(parm *GuessGameBet) (*types.Transaction, error) {
func CreateRawGuessBetTx(parm *GuessGameBetTx) (*types.Transaction, error) {
if parm == nil {
llog.Error("CreateRawGuessBet", "parm", parm)
return nil, types.ErrInvalidParam
}
v := &GuessGameBet{
GameId: parm.GameId,
Option: parm.Option,
BetsNum: parm.BetsNum,
}
val := &GuessGameAction{
Ty: GuessGameActionBet,
Value: &GuessGameAction_Bet{Bet: parm},
Value: &GuessGameAction_Bet{Bet: v},
}
name := types.ExecName(GuessX)
tx := &types.Transaction{
......@@ -155,15 +186,18 @@ func CreateRawGuessBetTx(parm *GuessGameBet) (*types.Transaction, error) {
}
// CreateRawGuessStopBetTx method
func CreateRawGuessBetTx(parm *GuessGameStopBet) (*types.Transaction, error) {
func CreateRawGuessStopBetTx(parm *GuessGameStopBetTx) (*types.Transaction, error) {
if parm == nil {
llog.Error("CreateRawGuessBet", "parm", parm)
return nil, types.ErrInvalidParam
}
v := &GuessGameStopBet{
GameId: parm.GameId,
}
val := &GuessGameAction{
Ty: GuessGameActionStopBet,
Value: &GuessGameAction_StopBet{StopBet: parm},
Value: &GuessGameAction_StopBet{StopBet: v},
}
name := types.ExecName(GuessX)
tx := &types.Transaction{
......@@ -181,15 +215,20 @@ func CreateRawGuessBetTx(parm *GuessGameStopBet) (*types.Transaction, error) {
}
// CreateRawGuessPublishTx method
func CreateRawGuessPublishTx(parm *GuessGamePublish) (*types.Transaction, error) {
func CreateRawGuessPublishTx(parm *GuessGamePublishTx) (*types.Transaction, error) {
if parm == nil {
llog.Error("CreateRawGuessPublish", "parm", parm)
return nil, types.ErrInvalidParam
}
v := &GuessGamePublish{
GameId: parm.GameId,
Result: parm.Result,
}
val := &GuessGameAction{
Ty: GuessGameActionPublish,
Value: &GuessGameAction_Publish{Publish: parm},
Value: &GuessGameAction_Publish{Publish: v},
}
name := types.ExecName(GuessX)
tx := &types.Transaction{
......@@ -207,15 +246,19 @@ func CreateRawGuessPublishTx(parm *GuessGamePublish) (*types.Transaction, error)
}
// CreateRawGuessAbortTx method
func CreateRawGuessAbortTx(parm *GuessGameAbort) (*types.Transaction, error) {
func CreateRawGuessAbortTx(parm *GuessGameAbortTx) (*types.Transaction, error) {
if parm == nil {
llog.Error("CreateRawGuessAbortTx", "parm", parm)
return nil, types.ErrInvalidParam
}
v := &GuessGameAbort {
GameId: parm.GameId,
}
val := &GuessGameAction{
Ty: GuessGameActionAbort,
Value: &GuessGameAction_Abort{Abort: parm},
Value: &GuessGameAction_Abort{Abort: v},
}
name := types.ExecName(GuessX)
tx := &types.Transaction{
......
......@@ -9,6 +9,7 @@ import (
_ "github.com/33cn/plugin/plugin/dapp/cert"
_ "github.com/33cn/plugin/plugin/dapp/evm"
_ "github.com/33cn/plugin/plugin/dapp/game"
_ "github.com/33cn/plugin/plugin/dapp/guess"
_ "github.com/33cn/plugin/plugin/dapp/hashlock"
_ "github.com/33cn/plugin/plugin/dapp/lottery"
_ "github.com/33cn/plugin/plugin/dapp/norm"
......
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