Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
a8e53ba4
Commit
a8e53ba4
authored
Dec 03, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guess
parent
82b582dc
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
721 additions
and
330 deletions
+721
-330
game.go
plugin/dapp/guess/commands/game.go
+14
-8
doc.go
plugin/dapp/guess/executor/doc.go
+17
-9
exec.go
plugin/dapp/guess/executor/exec.go
+5
-0
guessdb.go
plugin/dapp/guess/executor/guessdb.go
+229
-27
query.go
plugin/dapp/guess/executor/query.go
+49
-4
guess.proto
plugin/dapp/guess/proto/guess.proto
+42
-25
jrpc.go
plugin/dapp/guess/rpc/jrpc.go
+4
-3
tx.go
plugin/dapp/guess/rpc/tx.go
+35
-13
const.go
plugin/dapp/guess/types/const.go
+7
-0
guess.pb.go
plugin/dapp/guess/types/guess.pb.go
+292
-241
types.go
plugin/dapp/guess/types/types.go
+27
-0
No files found.
plugin/dapp/guess/commands/game.go
View file @
a8e53ba4
...
...
@@ -62,9 +62,13 @@ func addGuessStartFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Uint32P
(
"maxBetsNumber"
,
"n"
,
100000
,
"max bets number"
)
//cmd.MarkFlagRequired("maxBetsNumber")
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"fee
"
)
cmd
.
Flags
()
.
Int64P
(
"devFeeFactor"
,
"df"
,
0
,
"dev fee factor, unit: 1/1000
"
)
cmd
.
Flags
()
.
StringP
(
"feeAddr"
,
"a"
,
""
,
"fee address"
)
cmd
.
Flags
()
.
StringP
(
"devFeeAddr"
,
"dfa"
,
""
,
"dev address to receive share"
)
cmd
.
Flags
()
.
Int64P
(
"platFeeFactor"
,
"pf"
,
0
,
"plat fee factor, unit: 1/1000"
)
cmd
.
Flags
()
.
StringP
(
"platFeeAddr"
,
"pfa"
,
""
,
"plat address to receive share"
)
cmd
.
Flags
()
.
StringP
(
"expire"
,
"ex"
,
""
,
"expire time of the game, after this any addr can abort it"
)
...
...
@@ -82,13 +86,13 @@ func guessStart(cmd *cobra.Command, args []string) {
oneBet
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"oneBet"
)
maxBets
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"maxBets"
)
maxBetsNumber
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"maxBetsNumber"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
feeAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"feeAddr"
)
devFeeFactor
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"devFeeFactor"
)
devFeeAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"devFeeAddr"
)
platFeeFactor
,
_
:=
cmd
.
Flags
()
.
GetInt64
(
"platFeeFactor"
)
platFeeAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"platFeeAddr"
)
expire
,
_
:=
cmd
.
Flags
()
.
GetString
(
"expire"
)
expireHeight
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"expireHeight"
)
feeInt64
:=
uint64
(
fee
*
1e4
)
params
:=
&
pkt
.
GuessStartTxReq
{
Topic
:
topic
,
Options
:
options
,
...
...
@@ -99,8 +103,10 @@ func guessStart(cmd *cobra.Command, args []string) {
OneBet
:
oneBet
,
MaxBets
:
maxBets
,
MaxBetsNumber
:
maxBetsNumber
,
Fee
:
feeInt64
,
FeeAddr
:
feeAddr
,
DevFeeFactor
:
devFeeFactor
,
DevFeeAddr
:
devFeeAddr
,
PlatFeeFactor
:
platFeeFactor
,
PlatFeeAddr
:
platFeeAddr
,
Expire
:
expire
,
ExpireHeight
:
expireHeight
,
}
...
...
plugin/dapp/guess/executor/doc.go
View file @
a8e53ba4
...
...
@@ -8,8 +8,8 @@ package executor
区块链游戏:竞猜
一、玩法简介:
菠菜
平台的管理员可以发布竞猜游戏,玩家可以对竞猜游戏进行投注.
截止
时间达到后
,玩家不能再进行投注,等待管理员公布结果.
博彩
平台的管理员可以发布竞猜游戏,玩家可以对竞猜游戏进行投注.
截止
投注时间达到后,管理员改变游戏状态为停止投注状态
,玩家不能再进行投注,等待管理员公布结果.
竞猜内容的结果出来以后,管理员根据竞猜内容的真实结果触发智能合约进行输赢判断及结算。
二、创建及参与游戏
...
...
@@ -19,7 +19,7 @@ package executor
三、制胜策略
1、竞猜游戏对应的现实世界的结果出来以后,游戏管理员向区块链合约公布胜出的竞猜选项。
2、合约将投注的所有赌注向压注正确选项的玩家进行分配,分配原则根据每个地址实际投注的数额占比进行分配,比如一个地址投注占了正确选项投注总额的1/2,则该地址将获得所有赌注总额的1/2。
3、如果因为现实世界的突发异常导致竞猜不能继续(比如某场足球比赛因为不可抗力取消了),则管理员可以终止竞猜,合约将把所有地址的投注返还。
3、如果因为现实世界的突发异常导致竞猜不能继续(比如某场足球比赛因为不可抗力取消了
,比如自然灾害、政治事件等
),则管理员可以终止竞猜,合约将把所有地址的投注返还。
四、游戏过程和状态
1、创建游戏,一个地址可以作为本局竞猜游戏的管理员发起竞猜游戏。
...
...
@@ -31,16 +31,24 @@ package executor
单次最多可下注数量(比如100注)、
截止下注时间(比如UTC时间2018-12-12 10:00:00或者区块高度1000000)
游戏超时时间(比如UTC时间2018-12-20 10:00:00或者区块高度1080000)
可下注的最大
地址数量(比如20000个
)
3、截止下注时间之前,玩家可根据游戏要求进行下注,下注金额注入合约地址。如果投注
地址数量已经超过上限,则不允许新的地址
投注。
可下注的最大
数量(比如20000个BTY
)
3、截止下注时间之前,玩家可根据游戏要求进行下注,下注金额注入合约地址。如果投注
数量已经超过上限,则不允许新的
投注。
4、截止下注时间达到后,玩家不可再下注。
5、现实世界的竞猜结果出现后,管理员在游戏超时时间之前公布游戏结果。
6、
合约根据管理员输入的正确结果,对每个地址的投注进行输赢判断,并将所有赌注对所有竞猜正确的地址按各自的投注额占比进行比例分配
。
6、
(1)合约先对所有赌注收取一定比例的佣金,比如5‰给开发者地址,5‰给平台地址,(2)合约根据管理员输入的正确结果,对每个投注地址进行输赢判断,并将提取佣金后的剩余所有赌注对所有竞猜正确的地址按各自的投注额占比进行比例分配(比如A选项正确,所有选A的赌注共10000个BTY,某个地址向A下注100BTY,则该地址分得1/100)
。
7、如果因为现实世界的突发异常导致竞猜不能继续(比如某场足球比赛因为不可抗力取消了),则管理员可以终止竞猜,合约将把所有地址的投注返还。
8、如果游戏超时,管理员仍未公布结果,则任何地址都可以触发合约异常终止竞猜,合约中的投注返还给投注地址。
8、如果游戏超时,管理员仍未公布结果,则任何地址都可以触发合约异常终止竞猜,合约中的投注返还给
原
投注地址。
8、游戏状态:
start(管理员)->bet(玩家)->publish(管理员)
start(管理员)->bet(玩家)->stopbet(管理员)->publish(管理员)
start(管理员)->bet(玩家)->stopbet(管理员)->abort(管理员)
start(管理员)->bet(玩家)->abort(管理员)
start(管理员)->abort(管理员)
start(管理员)->bet(玩家)->stopbet(管理员)->timeout->abort(任何人)
start(管理员)->bet(玩家)->timeout->abort(任何人)
说明:这里的管理员不是特殊地址,而是谁创建竞猜游戏,谁就是本局竞猜游戏的管理员。
start(管理员)->timeout->abort(任何人)
start(管理员)->stopbet(管理员)->publish(管理员)
start(管理员)->bet(玩家)->publish(管理员)
start(管理员)->publish(管理员)
说明:这里的管理员不是特殊地址,而是谁创建本局竞猜游戏,谁就是本局竞猜游戏的管理员。
*/
plugin/dapp/guess/executor/exec.go
View file @
a8e53ba4
...
...
@@ -19,6 +19,11 @@ func (c *Guess) Exec_Bet(payload *pkt.GuessGameBet, tx *types.Transaction, index
return
action
.
GameBet
(
payload
)
}
func
(
c
*
Guess
)
Exec_StopBet
(
payload
*
pkt
.
GuessGameStopBet
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GameStopBet
(
payload
)
}
func
(
c
*
Guess
)
Exec_Publish
(
payload
*
pkt
.
GuessGamePublish
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GamePublish
(
payload
)
...
...
plugin/dapp/guess/executor/guessdb.go
View file @
a8e53ba4
...
...
@@ -5,11 +5,11 @@
package
executor
import
(
"context"
"errors"
"fmt"
"github.com/33cn/chain33/client"
"sort"
"strconv"
"google.golang.org/grpc"
"strings"
"time"
...
...
@@ -36,6 +36,10 @@ const (
MinBetTimeoutInterval
=
"24h"
//从游戏结束下注开始,一局游戏最短的超时时间
MinOneBet
=
1
grpcRecSize
int
=
5
*
30
*
1024
*
1024
retryNum
=
10
)
type
Action
struct
{
...
...
@@ -49,12 +53,22 @@ type Action struct {
localDB
dbm
.
Lister
index
int
api
client
.
QueueProtocolAPI
conn
*
grpc
.
ClientConn
grpcClient
types
.
Chain33Client
}
func
NewAction
(
guess
*
Guess
,
tx
*
types
.
Transaction
,
index
int
)
*
Action
{
hash
:=
tx
.
Hash
()
fromAddr
:=
tx
.
From
()
msgRecvOp
:=
grpc
.
WithMaxMsgSize
(
grpcRecSize
)
conn
,
err
:=
grpc
.
Dial
(
cfg
.
ParaRemoteGrpcClient
,
grpc
.
WithInsecure
(),
msgRecvOp
)
if
err
!=
nil
{
panic
(
err
)
}
grpcClient
:=
types
.
NewChain33Client
(
conn
)
return
&
Action
{
coinsAccount
:
guess
.
GetCoinsAccount
(),
db
:
guess
.
GetStateDB
(),
...
...
@@ -66,6 +80,8 @@ func NewAction(guess *Guess, tx *types.Transaction, index int) *Action {
localDB
:
guess
.
GetLocalDB
(),
index
:
index
,
api
:
guess
.
GetApi
(),
conn
:
conn
,
grpcClient
:
grpcClient
,
}
}
...
...
@@ -124,17 +140,42 @@ func getGameListByAddr(db dbm.Lister, addr string, index int64) (types.Message,
return
nil
,
err
}
var
gameIds
[]
*
pkt
.
GuessGameRecord
var
records
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
records
=
append
(
records
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
records
},
nil
}
func
getGameListByAdminAddr
(
db
dbm
.
Lister
,
addr
string
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcGuessGameAdminPrefix
(
addr
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcGuessGameAdminPrefix
(
addr
),
calcGuessGameAdminKey
(
addr
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
records
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
gameIds
=
append
(
gameI
ds
,
&
record
)
records
=
append
(
recor
ds
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
gameI
ds
},
nil
return
&
pkt
.
GuessGameRecords
{
Records
:
recor
ds
},
nil
}
func
getGameListByStatus
(
db
dbm
.
Lister
,
status
int32
,
index
int64
)
(
types
.
Message
,
error
)
{
...
...
@@ -149,19 +190,93 @@ func getGameListByStatus(db dbm.Lister, status int32, index int64) (types.Messag
return
nil
,
err
}
var
gameI
ds
[]
*
pkt
.
GuessGameRecord
var
recor
ds
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
gameIds
=
append
(
gameI
ds
,
&
record
)
records
=
append
(
recor
ds
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
gameI
ds
},
nil
return
&
pkt
.
GuessGameRecords
{
Records
:
recor
ds
},
nil
}
func
getGameListByAddrStatus
(
db
dbm
.
Lister
,
addr
string
,
status
int32
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcGuessGameAddrStatusPrefix
(
addr
,
status
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcGuessGameAddrStatusPrefix
(
addr
,
status
),
calcGuessGameAddrStatusKey
(
addr
,
status
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
records
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
records
=
append
(
records
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
records
},
nil
}
func
getGameListByAdminStatus
(
db
dbm
.
Lister
,
admin
string
,
status
int32
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcGuessGameAdminStatusPrefix
(
admin
,
status
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcGuessGameAdminStatusPrefix
(
admin
,
status
),
calcGuessGameAdminStatusKey
(
admin
,
status
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
records
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
records
=
append
(
records
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
records
},
nil
}
func
getGameListByCategoryStatus
(
db
dbm
.
Lister
,
category
string
,
status
int32
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcGuessGameCategoryStatusPrefix
(
category
,
status
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcGuessGameCategoryStatusPrefix
(
category
,
status
),
calcGuessGameCategoryStatusKey
(
category
,
status
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
records
[]
*
pkt
.
GuessGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
GuessGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
records
=
append
(
records
,
&
record
)
}
return
&
pkt
.
GuessGameRecords
{
Records
:
records
},
nil
}
func
(
action
*
Action
)
saveGame
(
game
*
pkt
.
GuessGame
)
(
kvset
[]
*
types
.
KeyValue
)
{
value
:=
types
.
Encode
(
game
)
...
...
@@ -234,8 +349,10 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu
OneBet
:
start
.
OneBet
,
MaxBets
:
start
.
MaxBets
,
MaxBetsNumber
:
start
.
MaxBetsNumber
,
Fee
:
start
.
Fee
,
FeeAddr
:
start
.
FeeAddr
,
DevFeeFactor
:
start
.
DevFeeFactor
,
DevFeeAddr
:
start
.
DevFeeAddr
,
PlatFeeFactor
:
start
.
PlatFeeFactor
,
PlatFeeAddr
:
start
.
PlatFeeAddr
,
Expire
:
start
.
Expire
,
ExpireHeight
:
start
.
ExpireHeight
,
//AdminAddr: action.fromaddr,
...
...
@@ -417,6 +534,47 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
action
*
Action
)
GameStopBet
(
pbBet
*
pkt
.
GuessGameStopBet
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
game
,
err
:=
action
.
readGame
(
pbBet
.
GetGameId
())
if
err
!=
nil
{
logger
.
Error
(
"GameStopBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"get game failed"
,
pbBet
.
GetGameId
(),
"err"
,
err
)
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"
)
}
//只有adminAddr可以发起publish
if
game
.
AdminAddr
!=
action
.
fromaddr
{
logger
.
Error
(
"GameStopBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"fromAddr is not adminAddr"
,
action
.
fromaddr
,
"adminAddr"
,
game
.
AdminAddr
)
return
nil
,
types
.
ErrInvalidParam
}
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
)
}
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveGame
(
game
)
...
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
(
action
*
Action
)
AddGuessBet
(
game
*
pkt
.
GuessGame
,
pbBet
*
pkt
.
GuessGameBet
)
{
bet
:=
&
pkt
.
GuessBet
{
Option
:
pbBet
.
GetOption
(),
BetsNumber
:
pbBet
.
BetsNum
,
Index
:
game
.
Index
}
player
:=
&
pkt
.
GuessPlayer
{
Addr
:
action
.
fromaddr
,
Bet
:
bet
}
...
...
@@ -479,14 +637,14 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
game
.
Result
=
publish
.
Result
//先遍历所有下注数据,
对于输家,
转移资金到Admin账户合约地址;
//先遍历所有下注数据,转移资金到Admin账户合约地址;
for
i
:=
0
;
i
<
len
(
game
.
Plays
);
i
++
{
player
:=
game
.
Plays
[
i
]
value
:=
int64
(
player
.
Bet
.
BetsNumber
*
game
.
OneBet
)
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
player
.
Addr
,
game
.
AdminAddr
,
action
.
execaddr
,
value
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
game
.
AdminAddr
,
action
.
execaddr
,
value
)
// rollback
logger
.
Error
(
"GamePublish"
,
"addr"
,
game
.
Admin
Addr
,
"execaddr"
,
action
.
execaddr
,
logger
.
Error
(
"GamePublish"
,
"addr"
,
player
.
Addr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
value
,
"err"
,
err
)
return
nil
,
err
}
...
...
@@ -504,11 +662,51 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
}
//按创建游戏时设定的比例,转移佣金到开发者账户和平台账户
devAddr
:=
pkt
.
DevShareAddr
platAddr
:=
pkt
.
PlatformShareAddr
devFee
:=
int64
(
0
)
platFee
:=
int64
(
0
)
if
len
(
game
.
DevFeeAddr
)
>
0
{
devAddr
=
game
.
DevFeeAddr
}
if
len
(
game
.
PlatFeeAddr
)
>
0
{
platAddr
=
game
.
PlatFeeAddr
}
if
game
.
DevFeeFactor
>
0
{
devFee
=
int64
(
totalBetsNumber
)
*
game
.
DevFeeFactor
*
int64
(
game
.
OneBet
)
/
1000
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
game
.
AdminAddr
,
devAddr
,
action
.
execaddr
,
devFee
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
game
.
AdminAddr
,
action
.
execaddr
,
devFee
)
// rollback
logger
.
Error
(
"GamePublish"
,
"adminAddr"
,
game
.
AdminAddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
devFee
,
"err"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
if
game
.
PlatFeeFactor
>
0
{
platFee
=
int64
(
totalBetsNumber
)
*
game
.
PlatFeeFactor
*
int64
(
game
.
OneBet
)
/
1000
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
game
.
AdminAddr
,
platAddr
,
action
.
execaddr
,
platFee
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
game
.
AdminAddr
,
action
.
execaddr
,
platFee
)
// rollback
logger
.
Error
(
"GamePublish"
,
"adminAddr"
,
game
.
AdminAddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
platFee
,
"err"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
//再遍历赢家,按照投注占比分配所有筹码
winValue
:=
int64
(
totalBetsNumber
*
game
.
OneBet
)
-
devFee
-
platFee
for
j
:=
0
;
j
<
len
(
game
.
Plays
);
j
++
{
player
:=
game
.
Plays
[
j
]
if
player
.
Bet
.
Option
==
game
.
Result
{
value
:=
int64
(
player
.
Bet
.
BetsNumber
*
totalBetsNumber
*
game
.
OneBet
/
winBetsNumber
)
value
:=
int64
(
player
.
Bet
.
BetsNumber
*
uint32
(
winValue
)
/
winBetsNumber
)
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
game
.
AdminAddr
,
player
.
Addr
,
action
.
execaddr
,
value
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
player
.
Addr
,
action
.
execaddr
,
value
)
// rollback
...
...
@@ -518,22 +716,11 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
player
.
Bet
.
IsWinner
=
true
player
.
Bet
.
Profit
=
value
}
}
//如果设置了手续费专用地址,则将本局游戏收取的手续费转移到专用地址
if
game
.
Fee
>
0
&&
len
(
game
.
FeeAddr
)
!=
0
&&
game
.
FeeAddr
!=
game
.
AdminAddr
{
value
:=
int64
(
uint32
(
game
.
Fee
)
*
uint32
(
len
(
game
.
Plays
))
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
game
.
AdminAddr
,
game
.
FeeAddr
,
action
.
execaddr
,
value
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
game
.
FeeAddr
,
action
.
execaddr
,
value
)
// rollback
logger
.
Error
(
"GamePublish"
,
"addr"
,
game
.
FeeAddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
value
,
"err"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
var
receiptLog
*
types
.
ReceiptLog
if
prevStatus
!=
game
.
Status
{
action
.
ChangeAllAddrIndex
(
game
)
...
...
@@ -581,7 +768,7 @@ 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
+
uint32
(
game
.
Fee
)
)
value
:=
int64
(
player
.
Bet
.
BetsNumber
*
game
.
OneBet
)
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
)
...
...
@@ -746,3 +933,18 @@ func (action *Action) CheckTime(start *pkt.GuessGameStart) bool {
return
false
}
// GetMainHeightByTxHash get Block height
func
(
action
*
Action
)
GetMainHeightByTxHash
(
txHash
[]
byte
)
int64
{
for
i
:=
0
;
i
<
retryNum
;
i
++
{
req
:=
&
types
.
ReqHash
{
Hash
:
txHash
}
txDetail
,
err
:=
action
.
grpcClient
.
QueryTransaction
(
context
.
Background
(),
req
)
if
err
!=
nil
{
time
.
Sleep
(
time
.
Second
)
}
else
{
return
txDetail
.
GetHeight
()
}
}
return
-
1
}
plugin/dapp/guess/executor/query.go
View file @
a8e53ba4
...
...
@@ -22,19 +22,64 @@ func (g *Guess) Query_QueryGameById(in *pkt.QueryGuessGameInfo) (types.Message,
}
func
(
g
*
Guess
)
Query_QueryGameByAddr
(
in
*
pkt
.
QueryGuessGameInfo
)
(
types
.
Message
,
error
)
{
gameI
ds
,
err
:=
getGameListByAddr
(
g
.
GetLocalDB
(),
in
.
Addr
,
in
.
Index
)
recor
ds
,
err
:=
getGameListByAddr
(
g
.
GetLocalDB
(),
in
.
Addr
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
gameIds
,
nil
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
)
{
gameIds
,
err
:=
getGameListByStatus
(
g
.
GetLocalDB
(),
in
.
Status
,
in
.
Index
)
records
,
err
:=
getGameListByStatus
(
g
.
GetLocalDB
(),
in
.
Status
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
records
,
nil
}
func
(
g
*
Guess
)
Query_QueryGameByAdminAddr
(
in
*
pkt
.
QueryGuessGameInfo
)
(
types
.
Message
,
error
)
{
records
,
err
:=
getGameListByAdminAddr
(
g
.
GetLocalDB
(),
in
.
AdminAddr
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
records
,
nil
}
func
(
g
*
Guess
)
Query_QueryGameByAddrStatusAddr
(
in
*
pkt
.
QueryGuessGameInfo
)
(
types
.
Message
,
error
)
{
records
,
err
:=
getGameListByAddrStatus
(
g
.
GetLocalDB
(),
in
.
Addr
,
in
.
Status
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
records
,
nil
}
func
(
g
*
Guess
)
Query_QueryGameByAdminStatusAddr
(
in
*
pkt
.
QueryGuessGameInfo
)
(
types
.
Message
,
error
)
{
records
,
err
:=
getGameListByAdminStatus
(
g
.
GetLocalDB
(),
in
.
AdminAddr
,
in
.
Status
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
records
,
nil
}
func
(
g
*
Guess
)
Query_QueryGameByCategoryStatusAddr
(
in
*
pkt
.
QueryGuessGameInfo
)
(
types
.
Message
,
error
)
{
records
,
err
:=
getGameListByCategoryStatus
(
g
.
GetLocalDB
(),
in
.
Category
,
in
.
Status
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
gameI
ds
,
nil
return
recor
ds
,
nil
}
plugin/dapp/guess/proto/guess.proto
View file @
a8e53ba4
...
...
@@ -21,17 +21,19 @@ message GuessGame {
uint32
oneBet
=
13
;
//一注等于多少bty或者token
uint32
maxBets
=
14
;
//单次可以下多少注,默认100
uint32
maxBetsNumber
=
15
;
//最多可以下多少注
int64
fee
=
16
;
//收取费用,不带则表示不收费
string
feeAddr
=
17
;
//收费地址
string
expire
=
18
;
//游戏过期时间
int64
expireHeight
=
19
;
//游戏过期区块高度
string
adminAddr
=
20
;
//游戏创建者地址,只有该地址可以开奖
uint32
betsNumber
=
21
;
//已下注数,如果数量达到maxBetsNumber,则不允许再下注
repeated
GuessPlayer
plays
=
22
;
//参与游戏下注的玩家投注信息
string
result
=
23
;
//公布的中奖结果
GuessBetStat
betStat
=
24
;
int64
index
=
25
;
int64
preIndex
=
26
;
int64
devFeeFactor
=
16
;
//开发者抽成比例
string
devFeeAddr
=
17
;
//开发者地址
int64
platFeeFactor
=
18
;
//平台抽成比例
string
platFeeAddr
=
19
;
//平台地址
string
expire
=
20
;
//游戏过期时间
int64
expireHeight
=
21
;
//游戏过期区块高度
string
adminAddr
=
22
;
//游戏创建者地址,只有该地址可以开奖
uint32
betsNumber
=
23
;
//已下注数,如果数量达到maxBetsNumber,则不允许再下注
repeated
GuessPlayer
plays
=
24
;
//参与游戏下注的玩家投注信息
string
result
=
25
;
//公布的中奖结果
GuessBetStat
betStat
=
26
;
int64
index
=
27
;
int64
preIndex
=
28
;
}
message
GuessPlayer
{
...
...
@@ -43,7 +45,7 @@ message GuessBet {
string
option
=
1
;
uint32
betsNumber
=
2
;
bool
isWinner
=
3
;
uint32
profit
=
4
;
int64
profit
=
4
;
int64
index
=
5
;
int64
preIndex
=
6
;
}
...
...
@@ -65,11 +67,12 @@ message GuessGameAction {
oneof
value
{
GuessGameStart
start
=
1
;
GuessGameBet
bet
=
2
;
GuessGameAbort
abort
=
3
;
GuessGamePublish
publish
=
4
;
GuessGameQuery
query
=
5
;
GuessGameStopBet
stopBet
=
3
;
GuessGameAbort
abort
=
4
;
GuessGamePublish
publish
=
5
;
GuessGameQuery
query
=
6
;
}
uint32
ty
=
6
;
uint32
ty
=
7
;
}
//游戏启动
...
...
@@ -78,16 +81,19 @@ message GuessGameStart{
string
options
=
2
;
string
category
=
3
;
string
maxTime
=
4
;
int64
maxHeight
=
5
;
int64
maxHeight
=
5
;
string
symbol
=
6
;
string
exec
=
7
;
uint32
oneBet
=
8
;
uint32
maxBets
=
9
;
uint32
maxBetsNumber
=
10
;
int64
fee
=
11
;
string
feeAddr
=
12
;
string
expire
=
13
;
int64
expireHeight
=
14
;
int64
devFeeFactor
=
11
;
//开发者抽成比例
string
devFeeAddr
=
12
;
//开发者地址
int64
platFeeFactor
=
13
;
//平台抽成比例
string
platFeeAddr
=
14
;
//平台地址
string
expire
=
15
;
int64
expireHeight
=
16
;
int64
fee
=
17
;
}
//参与游戏下注
...
...
@@ -98,6 +104,12 @@ message GuessGameBet{
int64
fee
=
4
;
}
//游戏停止下注
message
GuessGameStopBet
{
string
gameId
=
1
;
int64
fee
=
2
;
}
//游戏异常终止,退还下注
message
GuessGameAbort
{
string
gameId
=
1
;
...
...
@@ -124,6 +136,8 @@ message QueryGuessGameInfo {
string
addr
=
2
;
int32
status
=
3
;
int64
index
=
4
;
string
adminAddr
=
5
;
string
category
=
6
;
}
message
ReplyGuessGameInfo
{
...
...
@@ -161,10 +175,13 @@ message GuessStartTxReq {
uint32
oneBet
=
8
;
uint32
maxBets
=
9
;
uint32
maxBetsNumber
=
10
;
uint64
fee
=
11
;
string
feeAddr
=
12
;
string
expire
=
13
;
uint32
expireHeight
=
14
;
int64
devFeeFactor
=
11
;
string
devFeeAddr
=
12
;
int64
platFeeFactor
=
13
;
string
platFeeAddr
=
14
;
string
feeAddr
=
15
;
string
expire
=
16
;
uint32
expireHeight
=
17
;
}
message
GuessBetTxReq
{
...
...
plugin/dapp/guess/rpc/jrpc.go
View file @
a8e53ba4
...
...
@@ -25,11 +25,12 @@ func (c *Jrpc) GuessStartTx(parm *pb.GuessStartTxReq, result *interface{}) error
OneBet
:
parm
.
OneBet
,
MaxBets
:
parm
.
MaxBets
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
Fee
:
parm
.
Fee
,
FeeAddr
:
parm
.
FeeAddr
,
DevFeeFactor
:
parm
.
DevFeeFactor
,
DevFeeAddr
:
parm
.
DevFeeAddr
,
PlatFeeFactor
:
parm
.
PlatFeeFactor
,
PlatFeeAddr
:
parm
.
PlatFeeAddr
,
}
reply
,
err
:=
c
.
cli
.
GuessStart
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
...
...
plugin/dapp/guess/rpc/tx.go
View file @
a8e53ba4
...
...
@@ -4,23 +4,45 @@
package
rpc
type
PokerBullStartTx
struct
{
Value
int64
`json:"value"`
PlayerNum
int32
`json:"playerNum"`
Fee
int64
`json:"fee"`
type
GuessGameStart
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"`
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"`
DevFeeAddr
string
`json:"devFeeAddr,omitempty"`
PlatFeeFactor
int64
`json:"platFeeFactor,omitempty"`
PlatFeeAddr
string
`json:"platFeeAddr,omitempty"`
Expire
string
`json:"expire,omitempty"`
ExpireHeight
int64
`json:"expireHeight,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
PBContinueTxReq
struct
{
GameId
string
`json:"gameId"`
Fee
int64
`json:"fee"`
type
GuessGameBet
struct
{
GameId
string
`json:"gameId,omitempty"`
Option
string
`json:"option,omitempty"`
BetsNum
uint32
`json:"betsNum,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
PBQuitTxReq
struct
{
GameId
string
`json:"gameId
"`
Fee
int64
`json:"fee
"`
type
GuessGameStopBet
struct
{
GameId
string
`json:"gameId,omitempty
"`
Fee
int64
`json:"fee,omitempty
"`
}
type
PBQueryReq
struct
{
GameId
string
`json:"GameId"`
Fee
int64
`json:"fee"`
type
GuessGamePublish
struct
{
GameId
string
`json:"gameId,omitempty"`
Result
string
`json:"result,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
GuessGameAbort
struct
{
GameId
string
`json:"gameId,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
plugin/dapp/guess/types/const.go
View file @
a8e53ba4
...
...
@@ -13,6 +13,7 @@ const (
GuessGameActionStart
=
iota
+
1
GuessGameActionBet
GuessGameActionStopBet
GuessGameActionAbort
GuessGameActionPublish
GuessGameActionQuery
...
...
@@ -52,3 +53,8 @@ const (
//FuncName_QueryGameByAdminAddr = "QueryGameByAdminAddr"
//FuncName_QueryGameByCategory = "QueryGameByCategory"
)
const
(
DevShareAddr
=
"1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
PlatformShareAddr
=
"1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
)
\ No newline at end of file
plugin/dapp/guess/types/guess.pb.go
View file @
a8e53ba4
...
...
@@ -40,17 +40,19 @@ type GuessGame struct {
OneBet
uint32
`protobuf:"varint,13,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets
uint32
`protobuf:"varint,14,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsNumber
uint32
`protobuf:"varint,15,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
Fee
int64
`protobuf:"varint,16,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,17,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
Expire
string
`protobuf:"bytes,18,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight
int64
`protobuf:"varint,19,opt,name=expireHeight,proto3" json:"expireHeight,omitempty"`
AdminAddr
string
`protobuf:"bytes,20,opt,name=adminAddr,proto3" json:"adminAddr,omitempty"`
BetsNumber
uint32
`protobuf:"varint,21,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
Plays
[]
*
GuessPlayer
`protobuf:"bytes,22,rep,name=plays,proto3" json:"plays,omitempty"`
Result
string
`protobuf:"bytes,23,opt,name=result,proto3" json:"result,omitempty"`
BetStat
*
GuessBetStat
`protobuf:"bytes,24,opt,name=betStat,proto3" json:"betStat,omitempty"`
Index
int64
`protobuf:"varint,25,opt,name=index,proto3" json:"index,omitempty"`
PreIndex
int64
`protobuf:"varint,26,opt,name=preIndex,proto3" json:"preIndex,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"`
PlatFeeFactor
int64
`protobuf:"varint,18,opt,name=platFeeFactor,proto3" json:"platFeeFactor,omitempty"`
PlatFeeAddr
string
`protobuf:"bytes,19,opt,name=platFeeAddr,proto3" json:"platFeeAddr,omitempty"`
Expire
string
`protobuf:"bytes,20,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight
int64
`protobuf:"varint,21,opt,name=expireHeight,proto3" json:"expireHeight,omitempty"`
AdminAddr
string
`protobuf:"bytes,22,opt,name=adminAddr,proto3" json:"adminAddr,omitempty"`
BetsNumber
uint32
`protobuf:"varint,23,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
Plays
[]
*
GuessPlayer
`protobuf:"bytes,24,rep,name=plays,proto3" json:"plays,omitempty"`
Result
string
`protobuf:"bytes,25,opt,name=result,proto3" json:"result,omitempty"`
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"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -186,16 +188,30 @@ func (m *GuessGame) GetMaxBetsNumber() uint32 {
return
0
}
func
(
m
*
GuessGame
)
Get
Fee
()
int64
{
func
(
m
*
GuessGame
)
Get
DevFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
return
m
.
DevFeeFactor
}
return
0
}
func
(
m
*
GuessGame
)
GetFeeAddr
()
string
{
func
(
m
*
GuessGame
)
Get
Dev
FeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
return
m
.
DevFeeAddr
}
return
""
}
func
(
m
*
GuessGame
)
GetPlatFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
PlatFeeFactor
}
return
0
}
func
(
m
*
GuessGame
)
GetPlatFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
PlatFeeAddr
}
return
""
}
...
...
@@ -314,7 +330,7 @@ type GuessBet struct {
Option
string
`protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"`
BetsNumber
uint32
`protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
IsWinner
bool
`protobuf:"varint,3,opt,name=isWinner,proto3" json:"isWinner,omitempty"`
Profit
uint32
`protobuf:"varint,4,opt,name=profit,proto3" json:"profit,omitempty"`
Profit
int64
`protobuf:"varint,4,opt,name=profit,proto3" json:"profit,omitempty"`
Index
int64
`protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
PreIndex
int64
`protobuf:"varint,6,opt,name=preIndex,proto3" json:"preIndex,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
...
...
@@ -368,7 +384,7 @@ func (m *GuessBet) GetIsWinner() bool {
return
false
}
func
(
m
*
GuessBet
)
GetProfit
()
uint32
{
func
(
m
*
GuessBet
)
GetProfit
()
int64
{
if
m
!=
nil
{
return
m
.
Profit
}
...
...
@@ -504,11 +520,12 @@ type GuessGameAction struct {
// Types that are valid to be assigned to Value:
// *GuessGameAction_Start
// *GuessGameAction_Bet
// *GuessGameAction_StopBet
// *GuessGameAction_Abort
// *GuessGameAction_Publish
// *GuessGameAction_Query
Value
isGuessGameAction_Value
`protobuf_oneof:"value"`
Ty
uint32
`protobuf:"varint,
6
,opt,name=ty,proto3" json:"ty,omitempty"`
Ty
uint32
`protobuf:"varint,
7
,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -551,22 +568,28 @@ type GuessGameAction_Bet struct {
Bet
*
GuessGameBet
`protobuf:"bytes,2,opt,name=bet,proto3,oneof"`
}
type
GuessGameAction_StopBet
struct
{
StopBet
*
GuessGameStopBet
`protobuf:"bytes,3,opt,name=stopBet,proto3,oneof"`
}
type
GuessGameAction_Abort
struct
{
Abort
*
GuessGameAbort
`protobuf:"bytes,
3
,opt,name=abort,proto3,oneof"`
Abort
*
GuessGameAbort
`protobuf:"bytes,
4
,opt,name=abort,proto3,oneof"`
}
type
GuessGameAction_Publish
struct
{
Publish
*
GuessGamePublish
`protobuf:"bytes,
4
,opt,name=publish,proto3,oneof"`
Publish
*
GuessGamePublish
`protobuf:"bytes,
5
,opt,name=publish,proto3,oneof"`
}
type
GuessGameAction_Query
struct
{
Query
*
GuessGameQuery
`protobuf:"bytes,
5
,opt,name=query,proto3,oneof"`
Query
*
GuessGameQuery
`protobuf:"bytes,
6
,opt,name=query,proto3,oneof"`
}
func
(
*
GuessGameAction_Start
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Bet
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_StopBet
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Abort
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Publish
)
isGuessGameAction_Value
()
{}
...
...
@@ -594,6 +617,13 @@ func (m *GuessGameAction) GetBet() *GuessGameBet {
return
nil
}
func
(
m
*
GuessGameAction
)
GetStopBet
()
*
GuessGameStopBet
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_StopBet
);
ok
{
return
x
.
StopBet
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetAbort
()
*
GuessGameAbort
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Abort
);
ok
{
return
x
.
Abort
...
...
@@ -627,6 +657,7 @@ func (*GuessGameAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffe
return
_GuessGameAction_OneofMarshaler
,
_GuessGameAction_OneofUnmarshaler
,
_GuessGameAction_OneofSizer
,
[]
interface
{}{
(
*
GuessGameAction_Start
)(
nil
),
(
*
GuessGameAction_Bet
)(
nil
),
(
*
GuessGameAction_StopBet
)(
nil
),
(
*
GuessGameAction_Abort
)(
nil
),
(
*
GuessGameAction_Publish
)(
nil
),
(
*
GuessGameAction_Query
)(
nil
),
...
...
@@ -647,18 +678,23 @@ func _GuessGameAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
if
err
:=
b
.
EncodeMessage
(
x
.
Bet
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_
Abor
t
:
case
*
GuessGameAction_
StopBe
t
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
StopBet
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Abort
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Abort
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Publish
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Publish
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Query
:
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
b
.
EncodeVarint
(
6
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Query
);
err
!=
nil
{
return
err
}
...
...
@@ -688,7 +724,15 @@ func _GuessGameAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *prot
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Bet
{
msg
}
return
true
,
err
case
3
:
// value.abort
case
3
:
// value.stopBet
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGameStopBet
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_StopBet
{
msg
}
return
true
,
err
case
4
:
// value.abort
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
...
...
@@ -696,7 +740,7 @@ func _GuessGameAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *prot
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Abort
{
msg
}
return
true
,
err
case
4
:
// value.publish
case
5
:
// value.publish
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
...
...
@@ -704,7 +748,7 @@ func _GuessGameAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *prot
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Publish
{
msg
}
return
true
,
err
case
5
:
// value.query
case
6
:
// value.query
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
...
...
@@ -731,6 +775,11 @@ func _GuessGameAction_OneofSizer(msg proto.Message) (n int) {
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_StopBet
:
s
:=
proto
.
Size
(
x
.
StopBet
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_Abort
:
s
:=
proto
.
Size
(
x
.
Abort
)
n
+=
1
// tag and wire
...
...
@@ -765,10 +814,13 @@ type GuessGameStart struct {
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"`
Fee
int64
`protobuf:"varint,11,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,12,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
Expire
string
`protobuf:"bytes,13,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight
int64
`protobuf:"varint,14,opt,name=expireHeight,proto3" json:"expireHeight,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"`
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"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -869,16 +921,30 @@ func (m *GuessGameStart) GetMaxBetsNumber() uint32 {
return
0
}
func
(
m
*
GuessGameStart
)
Get
Fee
()
int64
{
func
(
m
*
GuessGameStart
)
Get
DevFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
return
m
.
DevFeeFactor
}
return
0
}
func
(
m
*
GuessGameStart
)
GetFeeAddr
()
string
{
func
(
m
*
GuessGameStart
)
Get
Dev
FeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
return
m
.
DevFeeAddr
}
return
""
}
func
(
m
*
GuessGameStart
)
GetPlatFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
PlatFeeFactor
}
return
0
}
func
(
m
*
GuessGameStart
)
GetPlatFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
PlatFeeAddr
}
return
""
}
...
...
@@ -897,6 +963,13 @@ func (m *GuessGameStart) GetExpireHeight() int64 {
return
0
}
func
(
m
*
GuessGameStart
)
GetFee
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
//参与游戏下注
type
GuessGameBet
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
...
...
@@ -961,6 +1034,54 @@ func (m *GuessGameBet) GetFee() int64 {
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:"-"`
}
func
(
m
*
GuessGameStopBet
)
Reset
()
{
*
m
=
GuessGameStopBet
{}
}
func
(
m
*
GuessGameStopBet
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameStopBet
)
ProtoMessage
()
{}
func
(
*
GuessGameStopBet
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
8
}
}
func
(
m
*
GuessGameStopBet
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameStopBet
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameStopBet
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameStopBet
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameStopBet
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameStopBet
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameStopBet
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameStopBet
.
Size
(
m
)
}
func
(
m
*
GuessGameStopBet
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameStopBet
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameStopBet
proto
.
InternalMessageInfo
func
(
m
*
GuessGameStopBet
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
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"`
...
...
@@ -974,7 +1095,7 @@ func (m *GuessGameAbort) Reset() { *m = GuessGameAbort{} }
func
(
m
*
GuessGameAbort
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameAbort
)
ProtoMessage
()
{}
func
(
*
GuessGameAbort
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
8
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
9
}
}
func
(
m
*
GuessGameAbort
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1023,7 +1144,7 @@ func (m *GuessGamePublish) Reset() { *m = GuessGamePublish{} }
func
(
m
*
GuessGamePublish
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGamePublish
)
ProtoMessage
()
{}
func
(
*
GuessGamePublish
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
9
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
10
}
}
func
(
m
*
GuessGamePublish
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1079,7 +1200,7 @@ func (m *GuessGameQuery) Reset() { *m = GuessGameQuery{} }
func
(
m
*
GuessGameQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameQuery
)
ProtoMessage
()
{}
func
(
*
GuessGameQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
0
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
1
}
}
func
(
m
*
GuessGameQuery
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1126,6 +1247,8 @@ type QueryGuessGameInfo struct {
Addr
string
`protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
Status
int32
`protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
Index
int64
`protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
AdminAddr
string
`protobuf:"bytes,5,opt,name=adminAddr,proto3" json:"adminAddr,omitempty"`
Category
string
`protobuf:"bytes,6,opt,name=category,proto3" json:"category,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -1135,7 +1258,7 @@ func (m *QueryGuessGameInfo) Reset() { *m = QueryGuessGameInfo{} }
func
(
m
*
QueryGuessGameInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
QueryGuessGameInfo
)
ProtoMessage
()
{}
func
(
*
QueryGuessGameInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
1
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
2
}
}
func
(
m
*
QueryGuessGameInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1184,6 +1307,20 @@ func (m *QueryGuessGameInfo) GetIndex() int64 {
return
0
}
func
(
m
*
QueryGuessGameInfo
)
GetAdminAddr
()
string
{
if
m
!=
nil
{
return
m
.
AdminAddr
}
return
""
}
func
(
m
*
QueryGuessGameInfo
)
GetCategory
()
string
{
if
m
!=
nil
{
return
m
.
Category
}
return
""
}
type
ReplyGuessGameInfo
struct
{
Game
*
GuessGame
`protobuf:"bytes,1,opt,name=game,proto3" json:"game,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
...
...
@@ -1195,7 +1332,7 @@ func (m *ReplyGuessGameInfo) Reset() { *m = ReplyGuessGameInfo{} }
func
(
m
*
ReplyGuessGameInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyGuessGameInfo
)
ProtoMessage
()
{}
func
(
*
ReplyGuessGameInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
2
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
3
}
}
func
(
m
*
ReplyGuessGameInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1234,7 +1371,7 @@ func (m *QueryGuessGameInfos) Reset() { *m = QueryGuessGameInfos{} }
func
(
m
*
QueryGuessGameInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
QueryGuessGameInfos
)
ProtoMessage
()
{}
func
(
*
QueryGuessGameInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
3
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
4
}
}
func
(
m
*
QueryGuessGameInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1273,7 +1410,7 @@ func (m *ReplyGuessGameInfos) Reset() { *m = ReplyGuessGameInfos{} }
func
(
m
*
ReplyGuessGameInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyGuessGameInfos
)
ProtoMessage
()
{}
func
(
*
ReplyGuessGameInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
4
}
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
5
}
}
func
(
m
*
ReplyGuessGameInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1301,117 +1438,6 @@ func (m *ReplyGuessGameInfos) GetGames() []*GuessGame {
return
nil
}
type
ReceiptPBGame
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Addr
string
`protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
Index
int64
`protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
PrevIndex
int64
`protobuf:"varint,5,opt,name=prevIndex,proto3" json:"prevIndex,omitempty"`
PlayerNum
int32
`protobuf:"varint,6,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
Value
int64
`protobuf:"varint,7,opt,name=value,proto3" json:"value,omitempty"`
IsWaiting
bool
`protobuf:"varint,8,opt,name=isWaiting,proto3" json:"isWaiting,omitempty"`
Players
[]
string
`protobuf:"bytes,9,rep,name=players,proto3" json:"players,omitempty"`
PreStatus
int32
`protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReceiptPBGame
)
Reset
()
{
*
m
=
ReceiptPBGame
{}
}
func
(
m
*
ReceiptPBGame
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptPBGame
)
ProtoMessage
()
{}
func
(
*
ReceiptPBGame
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
15
}
}
func
(
m
*
ReceiptPBGame
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReceiptPBGame
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReceiptPBGame
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptPBGame
.
Merge
(
m
,
src
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptPBGame
.
Size
(
m
)
}
func
(
m
*
ReceiptPBGame
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReceiptPBGame
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReceiptPBGame
proto
.
InternalMessageInfo
func
(
m
*
ReceiptPBGame
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
ReceiptPBGame
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
func
(
m
*
ReceiptPBGame
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetPrevIndex
()
int64
{
if
m
!=
nil
{
return
m
.
PrevIndex
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetPlayerNum
()
int32
{
if
m
!=
nil
{
return
m
.
PlayerNum
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetValue
()
int64
{
if
m
!=
nil
{
return
m
.
Value
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetIsWaiting
()
bool
{
if
m
!=
nil
{
return
m
.
IsWaiting
}
return
false
}
func
(
m
*
ReceiptPBGame
)
GetPlayers
()
[]
string
{
if
m
!=
nil
{
return
m
.
Players
}
return
nil
}
func
(
m
*
ReceiptPBGame
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
type
ReceiptGuessGame
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
PreStatus
int32
`protobuf:"varint,2,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
...
...
@@ -1526,10 +1552,13 @@ type GuessStartTxReq struct {
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"`
Fee
uint64
`protobuf:"varint,11,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,12,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
Expire
string
`protobuf:"bytes,13,opt,name=expire,proto3" json:"expire,omitempty"`
ExpireHeight
uint32
`protobuf:"varint,14,opt,name=expireHeight,proto3" json:"expireHeight,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"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
...
@@ -1630,13 +1659,34 @@ func (m *GuessStartTxReq) GetMaxBetsNumber() uint32 {
return
0
}
func
(
m
*
GuessStartTxReq
)
Get
Fee
()
u
int64
{
func
(
m
*
GuessStartTxReq
)
Get
DevFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
return
m
.
DevFeeFactor
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetDevFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
DevFeeAddr
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetPlatFeeFactor
()
int64
{
if
m
!=
nil
{
return
m
.
PlatFeeFactor
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetPlatFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
PlatFeeAddr
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
...
...
@@ -1950,6 +2000,7 @@ func init() {
proto
.
RegisterType
((
*
GuessGameAction
)(
nil
),
"types.GuessGameAction"
)
proto
.
RegisterType
((
*
GuessGameStart
)(
nil
),
"types.GuessGameStart"
)
proto
.
RegisterType
((
*
GuessGameBet
)(
nil
),
"types.GuessGameBet"
)
proto
.
RegisterType
((
*
GuessGameStopBet
)(
nil
),
"types.GuessGameStopBet"
)
proto
.
RegisterType
((
*
GuessGameAbort
)(
nil
),
"types.GuessGameAbort"
)
proto
.
RegisterType
((
*
GuessGamePublish
)(
nil
),
"types.GuessGamePublish"
)
proto
.
RegisterType
((
*
GuessGameQuery
)(
nil
),
"types.GuessGameQuery"
)
...
...
@@ -1957,7 +2008,6 @@ func init() {
proto
.
RegisterType
((
*
ReplyGuessGameInfo
)(
nil
),
"types.ReplyGuessGameInfo"
)
proto
.
RegisterType
((
*
QueryGuessGameInfos
)(
nil
),
"types.QueryGuessGameInfos"
)
proto
.
RegisterType
((
*
ReplyGuessGameInfos
)(
nil
),
"types.ReplyGuessGameInfos"
)
proto
.
RegisterType
((
*
ReceiptPBGame
)(
nil
),
"types.ReceiptPBGame"
)
proto
.
RegisterType
((
*
ReceiptGuessGame
)(
nil
),
"types.ReceiptGuessGame"
)
proto
.
RegisterType
((
*
GuessStartTxReq
)(
nil
),
"types.GuessStartTxReq"
)
proto
.
RegisterType
((
*
GuessBetTxReq
)(
nil
),
"types.GuessBetTxReq"
)
...
...
@@ -1971,87 +2021,88 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"guess.proto"
,
fileDescriptor_7574406c5d3430e8
)
}
var
fileDescriptor_7574406c5d3430e8
=
[]
byte
{
// 1267 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xcc
,
0x58
,
0x4b
,
0x6f
,
0xdb
,
0xc6
,
0x13
,
0x8f
,
0x48
,
0x51
,
0x8f
,
0x91
,
0x65
,
0x2b
,
0xeb
,
0x3c
,
0xf6
,
0x6f
,
0x04
,
0x7f
,
0xa8
,
0x44
,
0xd0
,
0xaa
,
0x87
,
0xa4
,
0x85
,
0x02
,
0xf4
,
0x60
,
0xa0
,
0x07
,
0x2b
,
0x01
,
0x62
,
0xf7
,
0x50
,
0xb8
,
0x6b
,
0x17
,
0x3e
,
0x53
,
0xd2
,
0x5a
,
0x66
,
0x21
,
0x91
,
0x0c
,
0xb9
,
0x0a
,
0xa4
,
0x5b
,
0x81
,
0xf6
,
0xda
,
0x43
,
0x0f
,
0xfd
,
0x0e
,
0xfd
,
0x66
,
0x05
,
0xfa
,
0x29
,
0x8a
,
0x99
,
0x5d
,
0x8a
,
0x0f
,
0x51
,
0x32
,
0x1c
,
0xf4
,
0xd0
,
0x1b
,
0xe7
,
0xb1
,
0xb3
,
0x33
,
0xb3
,
0x33
,
0xbf
,
0x19
,
0x09
,
0x3a
,
0xb3
,
0xa5
,
0x4c
,
0x92
,
0xd7
,
0x51
,
0x1c
,
0xaa
,
0x90
,
0x39
,
0x6a
,
0x1d
,
0xc9
,
0xe4
,
0xe4
,
0xb1
,
0x8a
,
0xbd
,
0x20
,
0xf1
,
0x26
,
0xca
,
0x0f
,
0x03
,
0x2d
,
0x71
,
0xff
,
0x76
,
0xa0
,
0xfd
,
0x1e
,
0x35
,
0xdf
,
0x7b
,
0x0b
,
0xc9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a9
,
0x5a
,
0xff
,
0xcf
,
0x0a
,
0x38
,
0xf4
,
0x9f
,
0x01
,
0xfb
,
0x1e
,
0x20
,
0x6b
,
0x59
,
0x56
,
0xbe
,
0xc6
,
0x9e
,
0xa6
,
0xbf
,
0x5d
,
0x7e
,
0x9d
,
0x27
,
0xc1
,
0x64
,
0x7e
,
0xb3
,
0x74
,
0x1f
,
0xb0
,
0xbe
,
0xf1
,
0xbb
,
0xa5
,
0x6c
,
0x9f
,
0x2d
,
0x3b
,
0x93
,
0xfa
,
0x52
,
0x73
,
0xb5
,
0x7c
,
0x4b
,
0x2d
,
0x3b
,
0x77
,
0xae
,
0xb7
,
0x87
,
0x74
,
0xa6
,
0x6e
,
0x5b
,
0x57
,
0x4b
,
0xce
,
0x0e
,
0x6b
,
0xf4
,
0xd7
,
0xc7
,
0x8b
,
0x7f
,
0x02
,
0x00
,
0x00
,
0xff
,
0xff
,
0x64
,
0x6d
,
0x1d
,
0xe5
,
0x23
,
0x11
,
0x00
,
0x00
,
}
// Reference imports to suppress errors if they are not otherwise used.
...
...
plugin/dapp/guess/types/types.go
View file @
a8e53ba4
...
...
@@ -43,6 +43,7 @@ func (t *GuessType) GetTypeMap() map[string]int32 {
return
map
[
string
]
int32
{
"Start"
:
GuessGameActionStart
,
"Bet"
:
GuessGameActionBet
,
"StopBet"
:
GuessGameActionStopBet
,
"Abort"
:
GuessGameActionAbort
,
"Publish"
:
GuessGameActionPublish
,
"Query"
:
GuessGameActionQuery
,
...
...
@@ -153,6 +154,32 @@ func CreateRawGuessBetTx(parm *GuessGameBet) (*types.Transaction, error) {
return
tx
,
nil
}
// CreateRawGuessStopBetTx method
func
CreateRawGuessBetTx
(
parm
*
GuessGameStopBet
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
llog
.
Error
(
"CreateRawGuessBet"
,
"parm"
,
parm
)
return
nil
,
types
.
ErrInvalidParam
}
val
:=
&
GuessGameAction
{
Ty
:
GuessGameActionStopBet
,
Value
:
&
GuessGameAction_StopBet
{
StopBet
:
parm
},
}
name
:=
types
.
ExecName
(
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
return
tx
,
nil
}
// CreateRawGuessPublishTx method
func
CreateRawGuessPublishTx
(
parm
*
GuessGamePublish
)
(
*
types
.
Transaction
,
error
)
{
if
parm
==
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment