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
a6754637
Commit
a6754637
authored
Dec 18, 2018
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
5c0ea3b1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
191 additions
and
198 deletions
+191
-198
game.go
plugin/dapp/guess/commands/game.go
+29
-31
exec.go
plugin/dapp/guess/executor/exec.go
+1
-2
exec_del_local.go
plugin/dapp/guess/executor/exec_del_local.go
+4
-5
exec_local.go
plugin/dapp/guess/executor/exec_local.go
+3
-4
guess.go
plugin/dapp/guess/executor/guess.go
+0
-1
guessdb.go
plugin/dapp/guess/executor/guessdb.go
+54
-54
keys.go
plugin/dapp/guess/executor/keys.go
+1
-1
jrpc.go
plugin/dapp/guess/rpc/jrpc.go
+0
-1
rpc.go
plugin/dapp/guess/rpc/rpc.go
+28
-27
const.go
plugin/dapp/guess/types/const.go
+15
-16
errors.go
plugin/dapp/guess/types/errors.go
+2
-2
guess.pb.go
plugin/dapp/guess/types/guess.pb.go
+2
-1
tx.go
plugin/dapp/guess/types/tx.go
+23
-23
types.go
plugin/dapp/guess/types/types.go
+29
-30
No files found.
plugin/dapp/guess/commands/game.go
View file @
a6754637
...
...
@@ -5,12 +5,13 @@
package
commands
import
(
"strings"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
"github.com/spf13/cobra"
"strings"
)
func
GuessCmd
()
*
cobra
.
Command
{
...
...
@@ -88,18 +89,18 @@ func guessStart(cmd *cobra.Command, args []string) {
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
params
:=
&
pkt
.
GuessStartTxReq
{
Topic
:
topic
,
Options
:
options
,
Category
:
category
,
MaxBetHeight
:
maxBetHeight
,
MaxBetsOneTime
:
maxBetsOneTime
*
1e8
,
MaxBetsNumber
:
maxBetsNumber
*
1e8
,
DevFeeFactor
:
devFeeFactor
,
DevFeeAddr
:
devFeeAddr
,
PlatFeeFactor
:
platFeeFactor
,
PlatFeeAddr
:
platFeeAddr
,
ExpireHeight
:
expireHeight
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
Topic
:
topic
,
Options
:
options
,
Category
:
category
,
MaxBetHeight
:
maxBetHeight
,
MaxBetsOneTime
:
maxBetsOneTime
*
1e8
,
MaxBetsNumber
:
maxBetsNumber
*
1e8
,
DevFeeFactor
:
devFeeFactor
,
DevFeeAddr
:
devFeeAddr
,
PlatFeeFactor
:
platFeeFactor
,
PlatFeeAddr
:
platFeeAddr
,
ExpireHeight
:
expireHeight
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
}
var
res
string
...
...
@@ -137,8 +138,8 @@ func guessBet(cmd *cobra.Command, args []string) {
params
:=
&
pkt
.
GuessBetTxReq
{
GameId
:
gameId
,
Option
:
option
,
Bets
:
betsNumber
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
Bets
:
betsNumber
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
}
var
res
string
...
...
@@ -169,7 +170,7 @@ func guessStopBet(cmd *cobra.Command, args []string) {
params
:=
&
pkt
.
GuessStopBetTxReq
{
GameId
:
gameId
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
Fee
:
int64
(
fee
*
float64
(
1e8
)),
}
var
res
string
...
...
@@ -177,7 +178,6 @@ func guessStopBet(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
}
func
GuessAbortRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"abort"
,
...
...
@@ -200,7 +200,7 @@ func guessAbort(cmd *cobra.Command, args []string) {
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
params
:=
&
pkt
.
GuessAbortTxReq
{
GameId
:
gameId
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
Fee
:
int64
(
fee
*
float64
(
1e8
)),
}
var
res
string
...
...
@@ -237,7 +237,7 @@ func guessPublish(cmd *cobra.Command, args []string) {
params
:=
&
pkt
.
GuessPublishTxReq
{
GameId
:
gameId
,
Result
:
result
,
Fee
:
int64
(
fee
*
float64
(
1e8
)),
Fee
:
int64
(
fee
*
float64
(
1e8
)),
}
var
res
string
...
...
@@ -245,7 +245,6 @@ func guessPublish(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
}
func
GuessQueryRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"query"
,
...
...
@@ -290,7 +289,7 @@ func guessQuery(cmd *cobra.Command, args []string) {
//6:QueryGameByAddrStatus,
//7:QueryGameByAdminStatus,
//8:QueryGameByCategoryStatus,
switch
ty
{
switch
ty
{
case
1
:
gameIds
:=
strings
.
Split
(
gameIDs
,
";"
)
req
:=
&
pkt
.
QueryGuessGameInfos
{
...
...
@@ -314,7 +313,7 @@ func guessQuery(cmd *cobra.Command, args []string) {
case
3
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
Addr
:
addr
,
Addr
:
addr
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByAddr
...
...
@@ -326,7 +325,7 @@ func guessQuery(cmd *cobra.Command, args []string) {
case
4
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
Status
:
status
,
Index
:
index
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByStatus
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
...
...
@@ -337,7 +336,7 @@ func guessQuery(cmd *cobra.Command, args []string) {
case
5
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
AdminAddr
:
adminAddr
,
Index
:
index
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByAdminAddr
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
...
...
@@ -347,9 +346,9 @@ func guessQuery(cmd *cobra.Command, args []string) {
case
6
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
Addr
:
addr
,
Addr
:
addr
,
Status
:
status
,
Index
:
index
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByAddrStatus
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
...
...
@@ -357,12 +356,11 @@ func guessQuery(cmd *cobra.Command, args []string) {
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
case
7
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
AdminAddr
:
adminAddr
,
Status
:
status
,
Index
:
index
,
Status
:
status
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByAdminStatus
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
...
...
@@ -373,8 +371,8 @@ func guessQuery(cmd *cobra.Command, args []string) {
case
8
:
req
:=
&
pkt
.
QueryGuessGameInfo
{
Category
:
category
,
Status
:
status
,
Index
:
index
,
Status
:
status
,
Index
:
index
,
}
params
.
FuncName
=
pkt
.
FuncName_QueryGameByCategoryStatus
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
...
...
plugin/dapp/guess/executor/exec.go
View file @
a6754637
...
...
@@ -32,4 +32,4 @@ func (c *Guess) Exec_Publish(payload *pkt.GuessGamePublish, tx *types.Transactio
func
(
c
*
Guess
)
Exec_Abort
(
payload
*
pkt
.
GuessGameAbort
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GameAbort
(
payload
)
}
\ No newline at end of file
}
plugin/dapp/guess/executor/exec_del_local.go
View file @
a6754637
...
...
@@ -11,10 +11,10 @@ import (
func
(
g
*
Guess
)
rollbackIndex
(
log
*
pkt
.
ReceiptGuessGame
)
(
kvs
[]
*
types
.
KeyValue
)
{
//新创建游戏,将增加的记录都删除掉
if
log
.
Status
==
pkt
.
GuessGameStatusStart
{
if
log
.
Status
==
pkt
.
GuessGameStatusStart
{
//kvs = append(kvs, addGuessGameAddrIndexKey(log.Status, log.Addr, log.GameId, log.Index))
kvs
=
append
(
kvs
,
delGuessGameStatusIndexKey
(
log
.
Status
,
log
.
Index
))
kvs
=
append
(
kvs
,
delGuessGameAdminIndexKey
(
log
.
AdminAddr
,
log
.
Index
))
kvs
=
append
(
kvs
,
delGuessGameAdminIndexKey
(
log
.
AdminAddr
,
log
.
Index
))
kvs
=
append
(
kvs
,
delGuessGameAdminStatusIndexKey
(
log
.
Status
,
log
.
AdminAddr
,
log
.
Index
))
kvs
=
append
(
kvs
,
delGuessGameCategoryStatusIndexKey
(
log
.
Status
,
log
.
Category
,
log
.
Index
))
}
else
if
log
.
Status
==
pkt
.
GuessGameStatusBet
{
...
...
@@ -32,7 +32,7 @@ func (g *Guess) rollbackIndex(log *pkt.ReceiptGuessGame) (kvs []*types.KeyValue)
kvs
=
append
(
kvs
,
delGuessGameAdminStatusIndexKey
(
log
.
Status
,
log
.
AdminAddr
,
log
.
Index
))
kvs
=
append
(
kvs
,
delGuessGameCategoryStatusIndexKey
(
log
.
Status
,
log
.
Category
,
log
.
Index
))
}
}
else
if
log
.
StatusChange
{
}
else
if
log
.
StatusChange
{
//其他状态时的状态发生变化的情况,要将老状态对应的记录恢复,同时删除新加的状态记录;对于每个地址的下注记录也需要遍历处理。
kvs
=
append
(
kvs
,
addGuessGameStatusIndexKey
(
log
.
PreStatus
,
log
.
GameId
,
log
.
PreIndex
))
kvs
=
append
(
kvs
,
addGuessGameAdminStatusIndexKey
(
log
.
PreStatus
,
log
.
AdminAddr
,
log
.
GameId
,
log
.
PreIndex
))
...
...
@@ -90,4 +90,4 @@ func (g *Guess) ExecDelLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Tr
func
(
g
*
Guess
)
ExecDelLocal_Abort
(
payload
*
pkt
.
GuessGameAbort
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execLocal
(
receiptData
)
}
\ No newline at end of file
}
plugin/dapp/guess/executor/exec_local.go
View file @
a6754637
...
...
@@ -11,7 +11,7 @@ import (
func
(
g
*
Guess
)
updateIndex
(
log
*
pkt
.
ReceiptGuessGame
)
(
kvs
[]
*
types
.
KeyValue
)
{
//新创建游戏
if
log
.
Status
==
pkt
.
GuessGameStatusStart
{
if
log
.
Status
==
pkt
.
GuessGameStatusStart
{
//kvs = append(kvs, addGuessGameAddrIndexKey(log.Status, log.Addr, log.GameId, log.Index))
kvs
=
append
(
kvs
,
addGuessGameStatusIndexKey
(
log
.
Status
,
log
.
GameId
,
log
.
Index
))
kvs
=
append
(
kvs
,
addGuessGameAdminIndexKey
(
log
.
Status
,
log
.
AdminAddr
,
log
.
GameId
,
log
.
Index
))
...
...
@@ -31,7 +31,7 @@ func (g *Guess) updateIndex(log *pkt.ReceiptGuessGame) (kvs []*types.KeyValue) {
kvs
=
append
(
kvs
,
delGuessGameAdminStatusIndexKey
(
log
.
PreStatus
,
log
.
AdminAddr
,
log
.
PreIndex
))
kvs
=
append
(
kvs
,
delGuessGameCategoryStatusIndexKey
(
log
.
PreStatus
,
log
.
Category
,
log
.
PreIndex
))
}
}
else
if
log
.
StatusChange
{
}
else
if
log
.
StatusChange
{
//其他状态时的状态发生变化,要将老状态对应的记录删除,同时加入新状态记录;对于每个地址的下注记录也需要遍历处理。
kvs
=
append
(
kvs
,
addGuessGameStatusIndexKey
(
log
.
Status
,
log
.
GameId
,
log
.
Index
))
kvs
=
append
(
kvs
,
addGuessGameAdminStatusIndexKey
(
log
.
Status
,
log
.
AdminAddr
,
log
.
GameId
,
log
.
Index
))
...
...
@@ -93,4 +93,4 @@ func (g *Guess) ExecLocal_Publish(payload *pkt.GuessGamePublish, tx *types.Trans
func
(
g
*
Guess
)
ExecLocal_Abort
(
payload
*
pkt
.
GuessGameAbort
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execLocal
(
receiptData
)
}
\ No newline at end of file
}
plugin/dapp/guess/executor/guess.go
View file @
a6754637
...
...
@@ -26,7 +26,6 @@ type subConfig struct {
var
cfg
subConfig
// Init Guess
func
Init
(
name
string
,
sub
[]
byte
)
{
driverName
:=
GetName
()
...
...
plugin/dapp/guess/executor/guessdb.go
View file @
a6754637
...
...
@@ -7,11 +7,12 @@ package executor
import
(
"context"
"fmt"
"github.com/33cn/chain33/client"
"google.golang.org/grpc"
"strings"
"time"
"github.com/33cn/chain33/client"
"google.golang.org/grpc"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
...
...
@@ -24,22 +25,22 @@ const (
ListDESC
=
int32
(
0
)
ListASC
=
int32
(
1
)
DefaultCount
=
int32
(
20
)
//默认一次取多少条记录
DefaultCategory
=
"default"
DefaultCount
=
int32
(
20
)
//默认一次取多少条记录
DefaultCategory
=
"default"
MaxBetsOneTime
=
10000e8
//一次最多下多少注
MaxBetsNumber
=
10000000e8
//一局游戏最多接受多少注
MaxBetHeight
=
1000000
//距离游戏创建区块的最大可下注高度差
MaxBetsOneTime
=
10000e8
//一次最多下多少注
MaxBetsNumber
=
10000000e8
//一局游戏最多接受多少注
MaxBetHeight
=
1000000
//距离游戏创建区块的最大可下注高度差
MaxExpireHeight
=
1000000
//距离游戏创建区块的最大过期高度差
MinBetBlockNum
=
720
//从创建游戏开始,一局游戏最少的可下注区块数量
MinBetTimeInterval
=
"2h"
//从创建游戏开始,一局游戏最短的可下注时间
MinBetTimeoutNum
=
8640
//从游戏结束下注开始,一局游戏最少的超时块数
MinBetBlockNum
=
720
//从创建游戏开始,一局游戏最少的可下注区块数量
MinBetTimeInterval
=
"2h"
//从创建游戏开始,一局游戏最短的可下注时间
MinBetTimeoutNum
=
8640
//从游戏结束下注开始,一局游戏最少的超时块数
MinBetTimeoutInterval
=
"24h"
//从游戏结束下注开始,一局游戏最短的超时时间
grpcRecSize
int
=
5
*
30
*
1024
*
1024
grpcRecSize
int
=
5
*
30
*
1024
*
1024
retryNum
=
10
retryNum
=
10
)
type
Action
struct
{
...
...
@@ -76,17 +77,17 @@ func NewAction(guess *Guess, tx *types.Transaction, index int) *Action {
return
&
Action
{
coinsAccount
:
guess
.
GetCoinsAccount
(),
db
:
guess
.
GetStateDB
(),
txhash
:
hash
,
fromaddr
:
fromAddr
,
blocktime
:
guess
.
GetBlockTime
(),
height
:
guess
.
GetHeight
(),
execaddr
:
dapp
.
ExecAddress
(
string
(
tx
.
Execer
)),
localDB
:
guess
.
GetLocalDB
(),
index
:
index
,
api
:
guess
.
GetAPI
(),
conn
:
conn
,
grpcClient
:
grpcClient
,
db
:
guess
.
GetStateDB
(),
txhash
:
hash
,
fromaddr
:
fromAddr
,
blocktime
:
guess
.
GetBlockTime
(),
height
:
guess
.
GetHeight
(),
execaddr
:
dapp
.
ExecAddress
(
string
(
tx
.
Execer
)),
localDB
:
guess
.
GetLocalDB
(),
index
:
index
,
api
:
guess
.
GetAPI
(),
conn
:
conn
,
grpcClient
:
grpcClient
,
}
}
...
...
@@ -342,21 +343,21 @@ func (action *Action) readGame(id string) (*pkt.GuessGame, error) {
// 新建一局游戏
func
(
action
*
Action
)
newGame
(
gameId
string
,
start
*
pkt
.
GuessGameStart
)
(
*
pkt
.
GuessGame
,
error
)
{
game
:=
&
pkt
.
GuessGame
{
GameId
:
gameId
,
Status
:
pkt
.
GuessGameActionStart
,
GameId
:
gameId
,
Status
:
pkt
.
GuessGameActionStart
,
//StartTime: action.blocktime,
StartTxHash
:
gameId
,
Topic
:
start
.
Topic
,
Category
:
start
.
Category
,
Options
:
start
.
Options
,
StartTxHash
:
gameId
,
Topic
:
start
.
Topic
,
Category
:
start
.
Category
,
Options
:
start
.
Options
,
MaxBetHeight
:
start
.
MaxBetHeight
,
MaxBetsOneTime
:
start
.
MaxBetsOneTime
,
MaxBetsNumber
:
start
.
MaxBetsNumber
,
DevFeeFactor
:
start
.
DevFeeFactor
,
DevFeeAddr
:
start
.
DevFeeAddr
,
PlatFeeFactor
:
start
.
PlatFeeFactor
,
PlatFeeAddr
:
start
.
PlatFeeAddr
,
ExpireHeight
:
start
.
ExpireHeight
,
MaxBetsOneTime
:
start
.
MaxBetsOneTime
,
MaxBetsNumber
:
start
.
MaxBetsNumber
,
DevFeeFactor
:
start
.
DevFeeFactor
,
DevFeeAddr
:
start
.
DevFeeAddr
,
PlatFeeFactor
:
start
.
PlatFeeFactor
,
PlatFeeAddr
:
start
.
PlatFeeAddr
,
ExpireHeight
:
start
.
ExpireHeight
,
//AdminAddr: action.fromaddr,
BetsNumber
:
0
,
//Index: action.getIndex(game),
...
...
@@ -366,7 +367,6 @@ func (action *Action) newGame(gameId string, start *pkt.GuessGameStart) (*pkt.Gu
return
game
,
nil
}
func
(
action
*
Action
)
GameStart
(
start
*
pkt
.
GuessGameStart
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
...
...
@@ -433,8 +433,8 @@ func (action *Action) GameStart(start *pkt.GuessGameStart) (*types.Receipt, erro
game
.
PreIndex
=
0
game
.
Index
=
action
.
getIndex
()
game
.
Status
=
pkt
.
GuessGameStatusStart
game
.
BetStat
=
&
pkt
.
GuessBetStat
{
TotalBetTimes
:
0
,
TotalBetsNumber
:
0
}
for
i
:=
0
;
i
<
len
(
options
);
i
++
{
game
.
BetStat
=
&
pkt
.
GuessBetStat
{
TotalBetTimes
:
0
,
TotalBetsNumber
:
0
}
for
i
:=
0
;
i
<
len
(
options
);
i
++
{
item
:=
&
pkt
.
GuessBetStatItem
{
Option
:
options
[
i
],
BetsNumber
:
0
,
BetsTimes
:
0
}
game
.
BetStat
.
Items
=
append
(
game
.
BetStat
.
Items
,
item
)
}
...
...
@@ -484,7 +484,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
//检查竞猜选项是否合法
options
,
legal
:=
GetOptions
(
game
.
GetOptions
())
if
!
legal
||
len
(
options
)
==
0
{
if
!
legal
||
len
(
options
)
==
0
{
logger
.
Error
(
"GameBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Game Options illegal"
,
game
.
GetOptions
())
return
nil
,
types
.
ErrInvalidParam
...
...
@@ -501,7 +501,7 @@ func (action *Action) GameBet(pbBet *pkt.GuessGameBet) (*types.Receipt, error) {
pbBet
.
BetsNum
=
game
.
GetMaxBetsOneTime
()
}
if
game
.
BetsNumber
+
pbBet
.
GetBetsNum
()
>
game
.
MaxBetsNumber
{
if
game
.
BetsNumber
+
pbBet
.
GetBetsNum
()
>
game
.
MaxBetsNumber
{
logger
.
Error
(
"GameBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"MaxBetsNumber over limit"
,
game
.
MaxBetsNumber
,
"current Bets Number"
,
game
.
BetsNumber
)
return
nil
,
types
.
ErrInvalidParam
...
...
@@ -550,7 +550,7 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
return
nil
,
err
}
if
game
.
Status
!=
pkt
.
GuessGameStatusStart
&&
game
.
Status
!=
pkt
.
GuessGameStatusBet
{
if
game
.
Status
!=
pkt
.
GuessGameStatusStart
&&
game
.
Status
!=
pkt
.
GuessGameStatusBet
{
logger
.
Error
(
"GameBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Status error"
,
game
.
GetStatus
())
return
nil
,
pkt
.
ErrGuessStatus
...
...
@@ -577,11 +577,11 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
}
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
}
bet
:=
&
pkt
.
GuessBet
{
Option
:
pbBet
.
GetOption
(),
BetsNumber
:
pbBet
.
BetsNum
,
Index
:
game
.
Index
}
player
:=
&
pkt
.
GuessPlayer
{
Addr
:
action
.
fromaddr
,
Bet
:
bet
}
game
.
Plays
=
append
(
game
.
Plays
,
player
)
for
i
:=
0
;
i
<
len
(
game
.
BetStat
.
Items
);
i
++
{
for
i
:=
0
;
i
<
len
(
game
.
BetStat
.
Items
);
i
++
{
if
game
.
BetStat
.
Items
[
i
]
.
Option
==
pbBet
.
GetOption
()
{
//针对具体选项更新统计项
game
.
BetStat
.
Items
[
i
]
.
BetsNumber
+=
pbBet
.
GetBetsNum
()
...
...
@@ -615,7 +615,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
return
nil
,
pkt
.
ErrNoPrivilege
}
if
game
.
Status
!=
pkt
.
GuessGameStatusStart
&&
game
.
Status
!=
pkt
.
GuessGameStatusBet
&&
game
.
Status
!=
pkt
.
GuessGameStatusStopBet
{
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
,
pkt
.
ErrGuessStatus
...
...
@@ -623,7 +623,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
//检查竞猜选项是否合法
options
,
legal
:=
GetOptions
(
game
.
GetOptions
())
if
!
legal
||
len
(
options
)
==
0
{
if
!
legal
||
len
(
options
)
==
0
{
logger
.
Error
(
"GamePublish"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Game Options illegal"
,
game
.
GetOptions
())
return
nil
,
types
.
ErrInvalidParam
...
...
@@ -731,7 +731,7 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
}
var
receiptLog
*
types
.
ReceiptLog
action
.
ChangeAllAddrIndex
(
game
)
action
.
ChangeAllAddrIndex
(
game
)
receiptLog
=
action
.
GetReceiptLog
(
game
,
true
)
logs
=
append
(
logs
,
receiptLog
)
...
...
@@ -751,7 +751,7 @@ func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, erro
return
nil
,
err
}
if
game
.
Status
==
pkt
.
GuessGameStatusPublish
||
game
.
Status
==
pkt
.
GuessGameStatusAbort
{
if
game
.
Status
==
pkt
.
GuessGameStatusPublish
||
game
.
Status
==
pkt
.
GuessGameStatusAbort
{
logger
.
Error
(
"GameAbort"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"game status not allow abort"
,
game
.
Status
)
...
...
@@ -804,11 +804,11 @@ func (action *Action) GameAbort(pbend *pkt.GuessGameAbort) (*types.Receipt, erro
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
GetOptions
(
strOptions
string
)
(
options
[]
string
,
legal
bool
){
func
GetOptions
(
strOptions
string
)
(
options
[]
string
,
legal
bool
)
{
legal
=
true
items
:=
strings
.
Split
(
strOptions
,
";"
)
for
i
:=
0
;
i
<
len
(
items
);
i
++
{
item
:=
strings
.
Split
(
items
[
i
],
":"
)
for
i
:=
0
;
i
<
len
(
items
);
i
++
{
item
:=
strings
.
Split
(
items
[
i
],
":"
)
for
j
:=
0
;
j
<
len
(
options
);
j
++
{
if
item
[
0
]
==
options
[
j
]
{
legal
=
false
...
...
@@ -844,7 +844,7 @@ func (action *Action) ChangeStatus(game *pkt.GuessGame, destStatus int32) {
}
func
(
action
*
Action
)
ChangeAllAddrIndex
(
game
*
pkt
.
GuessGame
)
{
for
i
:=
0
;
i
<
len
(
game
.
Plays
)
;
i
++
{
for
i
:=
0
;
i
<
len
(
game
.
Plays
);
i
++
{
player
:=
game
.
Plays
[
i
]
player
.
Bet
.
PreIndex
=
player
.
Bet
.
Index
player
.
Bet
.
Index
=
game
.
Index
...
...
@@ -888,7 +888,7 @@ func (action *Action) RefreshStatusByTime(game *pkt.GuessGame) (canBet bool) {
}
canBet
=
false
return
canBet
return
canBet
}
canBet
=
true
...
...
plugin/dapp/guess/executor/keys.go
View file @
a6754637
...
...
@@ -2,6 +2,7 @@ package executor
import
(
"fmt"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
...
...
@@ -189,4 +190,3 @@ func delGuessGameCategoryStatusIndexKey(status int32, category string, index int
kv
.
Value
=
nil
return
kv
}
plugin/dapp/guess/rpc/jrpc.go
View file @
a6754637
...
...
@@ -80,4 +80,3 @@ func (c *Jrpc) GuessPublishTx(parm *pb.GuessPublishTxReq, result *interface{}) e
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
plugin/dapp/guess/rpc/rpc.go
View file @
a6754637
...
...
@@ -6,6 +6,7 @@ package rpc
import
(
"context"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/types"
pb
"github.com/33cn/plugin/plugin/dapp/guess/types"
...
...
@@ -13,17 +14,17 @@ import (
func
(
c
*
channelClient
)
GuessStart
(
ctx
context
.
Context
,
parm
*
pb
.
GuessStartTxReq
)
(
*
types
.
UnsignTx
,
error
)
{
v
:=
&
pb
.
GuessGameStart
{
Topic
:
parm
.
Topic
,
Options
:
parm
.
Options
,
Category
:
parm
.
Category
,
MaxBetHeight
:
parm
.
MaxBetHeight
,
Topic
:
parm
.
Topic
,
Options
:
parm
.
Options
,
Category
:
parm
.
Category
,
MaxBetHeight
:
parm
.
MaxBetHeight
,
MaxBetsOneTime
:
parm
.
MaxBetsOneTime
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
DevFeeFactor
:
parm
.
DevFeeFactor
,
DevFeeAddr
:
parm
.
DevFeeAddr
,
PlatFeeFactor
:
parm
.
PlatFeeFactor
,
PlatFeeAddr
:
parm
.
PlatFeeAddr
,
ExpireHeight
:
parm
.
ExpireHeight
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
DevFeeFactor
:
parm
.
DevFeeFactor
,
DevFeeAddr
:
parm
.
DevFeeAddr
,
PlatFeeFactor
:
parm
.
PlatFeeFactor
,
PlatFeeAddr
:
parm
.
PlatFeeAddr
,
ExpireHeight
:
parm
.
ExpireHeight
,
}
val
:=
&
pb
.
GuessGameAction
{
...
...
@@ -33,10 +34,10 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq
name
:=
types
.
ExecName
(
pb
.
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
...
...
@@ -49,8 +50,8 @@ func (c *channelClient) GuessStart(ctx context.Context, parm *pb.GuessStartTxReq
func
(
c
*
channelClient
)
GuessBet
(
ctx
context
.
Context
,
parm
*
pb
.
GuessBetTxReq
)
(
*
types
.
UnsignTx
,
error
)
{
v
:=
&
pb
.
GuessGameBet
{
GameId
:
parm
.
GameId
,
Option
:
parm
.
Option
,
GameId
:
parm
.
GameId
,
Option
:
parm
.
Option
,
BetsNum
:
parm
.
Bets
,
}
...
...
@@ -61,10 +62,10 @@ func (c *channelClient) GuessBet(ctx context.Context, parm *pb.GuessBetTxReq) (*
name
:=
types
.
ExecName
(
pb
.
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
...
...
@@ -87,10 +88,10 @@ func (c *channelClient) GuessStopBet(ctx context.Context, parm *pb.GuessStopBetT
name
:=
types
.
ExecName
(
pb
.
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
...
...
@@ -112,10 +113,10 @@ func (c *channelClient) GuessAbort(ctx context.Context, parm *pb.GuessAbortTxReq
}
name
:=
types
.
ExecName
(
pb
.
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
...
...
@@ -139,10 +140,10 @@ func (c *channelClient) GuessPublish(ctx context.Context, parm *pb.GuessPublishT
name
:=
types
.
ExecName
(
pb
.
GuessX
)
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Execer
:
[]
byte
(
types
.
ExecName
(
pb
.
GuessX
)),
Payload
:
types
.
Encode
(
val
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
Fee
:
parm
.
Fee
,
To
:
address
.
ExecAddress
(
name
),
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
...
...
plugin/dapp/guess/types/const.go
View file @
a6754637
...
...
@@ -27,10 +27,10 @@ const (
)
const
(
TyLogGuessGameStart
=
901
TyLogGuessGameBet
=
902
TyLogGuessGameStart
=
901
TyLogGuessGameBet
=
902
TyLogGuessGameStopBet
=
903
TyLogGuessGameAbort
=
904
TyLogGuessGameAbort
=
904
TyLogGuessGamePublish
=
905
TyLogGuessGameTimeout
=
906
)
...
...
@@ -39,24 +39,24 @@ const (
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//如果发生重名,可以通过配置文件修改这些名字
var
(
JRPCName
=
"guess"
GuessX
=
"guess"
JRPCName
=
"guess"
GuessX
=
"guess"
ExecerGuess
=
[]
byte
(
GuessX
)
)
const
(
//查询方法名
FuncName_QueryGamesByIds
=
"QueryGamesByIds"
FuncName_QueryGameById
=
"QueryGameById"
FuncName_QueryGameByAddr
=
"QueryGamesByAddr"
FuncName_QueryGameByStatus
=
"QueryGamesByStatus"
FuncName_QueryGameByAdminAddr
=
"QueryGamesByAdminAddr"
FuncName_QueryGameByAddrStatus
=
"QueryGamesByAddrStatus"
FuncName_QueryGameByAdminStatus
=
"QueryGamesByAdminStatus"
FuncName_QueryGameByCategoryStatus
=
"QueryGamesByCategoryStatus"
FuncName_QueryGamesByIds
=
"QueryGamesByIds"
FuncName_QueryGameById
=
"QueryGameById"
FuncName_QueryGameByAddr
=
"QueryGamesByAddr"
FuncName_QueryGameByStatus
=
"QueryGamesByStatus"
FuncName_QueryGameByAdminAddr
=
"QueryGamesByAdminAddr"
FuncName_QueryGameByAddrStatus
=
"QueryGamesByAddrStatus"
FuncName_QueryGameByAdminStatus
=
"QueryGamesByAdminStatus"
FuncName_QueryGameByCategoryStatus
=
"QueryGamesByCategoryStatus"
)
const
(
DevShareAddr
=
"1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
DevShareAddr
=
"1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
PlatformShareAddr
=
"1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
)
\ No newline at end of file
)
plugin/dapp/guess/types/errors.go
View file @
a6754637
...
...
@@ -8,6 +8,6 @@ import "errors"
// Errors for lottery
var
(
ErrNoPrivilege
=
errors
.
New
(
"ErrNoPrivilege"
)
ErrGuessStatus
=
errors
.
New
(
"ErrGuessStatus"
)
ErrNoPrivilege
=
errors
.
New
(
"ErrNoPrivilege"
)
ErrGuessStatus
=
errors
.
New
(
"ErrGuessStatus"
)
)
plugin/dapp/guess/types/guess.pb.go
View file @
a6754637
...
...
@@ -6,10 +6,11 @@ package types
import
(
context
"context"
fmt
"fmt"
math
"math"
types
"github.com/33cn/chain33/types"
proto
"github.com/golang/protobuf/proto"
grpc
"google.golang.org/grpc"
math
"math"
)
// Reference imports to suppress errors if they are not otherwise used.
...
...
plugin/dapp/guess/types/tx.go
View file @
a6754637
...
...
@@ -5,39 +5,39 @@
package
types
type
GuessGameStartTx
struct
{
Topic
string
`json:"topic,omitempty"`
Options
string
`json:"options,omitempty"`
Category
string
`json:"category,omitempty"`
MaxBetHeight
int64
`json:"maxHeight,omitempty"`
MaxBets
int64
`json:"maxBets,omitempty"`
MaxBetsNumber
int64
`json:"maxBetsNumber,omitempty"`
DevFeeFactor
int64
`json:"devFeeFactor,omitempty"`
DevFeeAddr
string
`json:"devFeeAddr,omitempty"`
PlatFeeFactor
int64
`json:"platFeeFactor,omitempty"`
PlatFeeAddr
string
`json:"platFeeAddr,omitempty"`
ExpireHeight
int64
`json:"expireHeight,omitempty"`
Fee
int64
`json:"fee,omitempty"`
Topic
string
`json:"topic,omitempty"`
Options
string
`json:"options,omitempty"`
Category
string
`json:"category,omitempty"`
MaxBetHeight
int64
`json:"maxHeight,omitempty"`
MaxBets
int64
`json:"maxBets,omitempty"`
MaxBetsNumber
int64
`json:"maxBetsNumber,omitempty"`
DevFeeFactor
int64
`json:"devFeeFactor,omitempty"`
DevFeeAddr
string
`json:"devFeeAddr,omitempty"`
PlatFeeFactor
int64
`json:"platFeeFactor,omitempty"`
PlatFeeAddr
string
`json:"platFeeAddr,omitempty"`
ExpireHeight
int64
`json:"expireHeight,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
GuessGameBetTx
struct
{
GameId
string
`json:"gameId,omitempty"`
Option
string
`json:"option,omitempty"`
BetsNum
int64
`json:"betsNum,omitempty"`
Fee
int64
`json:"fee,omitempty"`
GameId
string
`json:"gameId,omitempty"`
Option
string
`json:"option,omitempty"`
BetsNum
int64
`json:"betsNum,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
GuessGameStopBetTx
struct
{
GameId
string
`json:"gameId,omitempty"`
Fee
int64
`json:"fee,omitempty"`
GameId
string
`json:"gameId,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
GuessGamePublishTx
struct
{
GameId
string
`json:"gameId,omitempty"`
Result
string
`json:"result,omitempty"`
Fee
int64
`json:"fee,omitempty"`
GameId
string
`json:"gameId,omitempty"`
Result
string
`json:"result,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
type
GuessGameAbortTx
struct
{
GameId
string
`json:"gameId,omitempty"`
Fee
int64
`json:"fee,omitempty"`
GameId
string
`json:"gameId,omitempty"`
Fee
int64
`json:"fee,omitempty"`
}
plugin/dapp/guess/types/types.go
View file @
a6754637
...
...
@@ -6,15 +6,16 @@ package types
import
(
"encoding/json"
"github.com/33cn/chain33/common/address"
"reflect"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/common/address"
log
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
)
var
(
llog
=
log
.
New
(
"module"
,
"exectype."
+
GuessX
)
llog
=
log
.
New
(
"module"
,
"exectype."
+
GuessX
)
)
func
init
()
{
...
...
@@ -41,23 +42,23 @@ func (t *GuessType) GetPayload() types.Message {
func
(
t
*
GuessType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Start"
:
GuessGameActionStart
,
"Bet"
:
GuessGameActionBet
,
"StopBet"
:
GuessGameActionStopBet
,
"Abort"
:
GuessGameActionAbort
,
"Start"
:
GuessGameActionStart
,
"Bet"
:
GuessGameActionBet
,
"StopBet"
:
GuessGameActionStopBet
,
"Abort"
:
GuessGameActionAbort
,
"Publish"
:
GuessGameActionPublish
,
"Query"
:
GuessGameActionQuery
,
"Query"
:
GuessGameActionQuery
,
}
}
func
(
t
*
GuessType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogGuessGameStart
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameStart"
},
TyLogGuessGameBet
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameBet"
},
TyLogGuessGameStopBet
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameStopBet"
},
TyLogGuessGameAbort
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameAbort"
},
TyLogGuessGamePublish
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGamePublish"
},
TyLogGuessGameTimeout
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameTimeout"
},
TyLogGuessGameStart
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameStart"
},
TyLogGuessGameBet
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameBet"
},
TyLogGuessGameStopBet
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameStopBet"
},
TyLogGuessGameAbort
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameAbort"
},
TyLogGuessGamePublish
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGamePublish"
},
TyLogGuessGameTimeout
:
{
reflect
.
TypeOf
(
ReceiptGuessGame
{}),
"TyLogGuessGameTimeout"
},
}
}
...
...
@@ -117,18 +118,18 @@ func CreateRawGuessStartTx(parm *GuessGameStartTx) (*types.Transaction, error) {
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
GuessGameStart
{
Topic
:
parm
.
Topic
,
Options
:
parm
.
Options
,
Category
:
parm
.
Category
,
MaxBetHeight
:
parm
.
MaxBetHeight
,
v
:=
&
GuessGameStart
{
Topic
:
parm
.
Topic
,
Options
:
parm
.
Options
,
Category
:
parm
.
Category
,
MaxBetHeight
:
parm
.
MaxBetHeight
,
MaxBetsOneTime
:
parm
.
MaxBets
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
DevFeeFactor
:
parm
.
DevFeeFactor
,
DevFeeAddr
:
parm
.
DevFeeAddr
,
PlatFeeFactor
:
parm
.
PlatFeeFactor
,
PlatFeeAddr
:
parm
.
PlatFeeAddr
,
ExpireHeight
:
parm
.
ExpireHeight
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
DevFeeFactor
:
parm
.
DevFeeFactor
,
DevFeeAddr
:
parm
.
DevFeeAddr
,
PlatFeeFactor
:
parm
.
PlatFeeFactor
,
PlatFeeAddr
:
parm
.
PlatFeeAddr
,
ExpireHeight
:
parm
.
ExpireHeight
,
}
val
:=
&
GuessGameAction
{
...
...
@@ -159,8 +160,8 @@ func CreateRawGuessBetTx(parm *GuessGameBetTx) (*types.Transaction, error) {
}
v
:=
&
GuessGameBet
{
GameId
:
parm
.
GameId
,
Option
:
parm
.
Option
,
GameId
:
parm
.
GameId
,
Option
:
parm
.
Option
,
BetsNum
:
parm
.
BetsNum
,
}
val
:=
&
GuessGameAction
{
...
...
@@ -249,7 +250,7 @@ func CreateRawGuessAbortTx(parm *GuessGameAbortTx) (*types.Transaction, error) {
return
nil
,
types
.
ErrInvalidParam
}
v
:=
&
GuessGameAbort
{
v
:=
&
GuessGameAbort
{
GameId
:
parm
.
GameId
,
}
...
...
@@ -271,5 +272,3 @@ func CreateRawGuessAbortTx(parm *GuessGameAbortTx) (*types.Transaction, error) {
}
return
tx
,
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