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
2d0bd9cc
Commit
2d0bd9cc
authored
Dec 05, 2018
by
heyubin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into multisig
parents
711b2b26
4914e587
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
644 additions
and
376 deletions
+644
-376
lottery_test.go
plugin/dapp/lottery/executor/lottery_test.go
+302
-0
lotteryblock.go
plugin/dapp/lottery/executor/lotteryblock.go
+0
-104
lotterydb.go
plugin/dapp/lottery/executor/lotterydb.go
+144
-147
query.go
plugin/dapp/lottery/executor/query.go
+7
-5
lottery.proto
plugin/dapp/lottery/proto/lottery.proto
+15
-7
errors.go
plugin/dapp/lottery/types/errors.go
+1
-0
lottery.go
plugin/dapp/lottery/types/lottery.go
+4
-2
lottery.pb.go
plugin/dapp/lottery/types/lottery.pb.go
+166
-108
tx.go
plugin/dapp/lottery/types/tx.go
+5
-3
No files found.
plugin/dapp/lottery/executor/lottery_test.go
0 → 100644
View file @
2d0bd9cc
// 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
executor
import
(
"bytes"
"errors"
"fmt"
"math/rand"
"testing"
"github.com/33cn/chain33/client"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/executor"
"github.com/33cn/chain33/queue"
drivers
"github.com/33cn/chain33/system/dapp"
pty
"github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types"
rt
"github.com/33cn/plugin/plugin/dapp/lottery/types"
)
var
(
creatorAddr
string
buyAddr
string
buyPriv
crypto
.
PrivKey
creatorPriv
crypto
.
PrivKey
testNormErr
error
lottery
drivers
.
Driver
r
*
rand
.
Rand
mydb
db
.
KV
lotteryID
string
)
func
init
()
{
creatorAddr
,
creatorPriv
=
genaddress
()
buyAddr
,
buyPriv
=
genaddress
()
testNormErr
=
errors
.
New
(
"Err"
)
lottery
=
constructLotteryInstance
()
r
=
rand
.
New
(
rand
.
NewSource
(
types
.
Now
()
.
UnixNano
()))
}
func
TestExecCreateLottery
(
t
*
testing
.
T
)
{
var
targetReceipt
types
.
Receipt
var
targetErr
=
rt
.
ErrNoPrivilege
var
receipt
*
types
.
Receipt
var
err
error
targetReceipt
.
Ty
=
2
tx
:=
ConstructCreateTx
()
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
// ErrNoPrivilege case
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
var
item
types
.
ConfigItem
item
.
Key
=
"lottery-creator"
item
.
Addr
=
creatorAddr
item
.
Ty
=
pty
.
ConfigItemArrayConfig
emptyValue
:=
&
types
.
ArrayConfig
{
Value
:
make
([]
string
,
0
)}
arr
:=
types
.
ConfigItem_Arr
{
Arr
:
emptyValue
}
item
.
Value
=
&
arr
item
.
GetArr
()
.
Value
=
append
(
item
.
GetArr
()
.
Value
,
creatorAddr
)
item
.
Addr
=
creatorAddr
key
:=
types
.
ManageKey
(
"lottery-creator"
)
valueSave
:=
types
.
Encode
(
&
item
)
mydb
.
Set
([]
byte
(
key
),
valueSave
)
// success case
targetErr
=
nil
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
lotteryID
=
common
.
ToHex
(
tx
.
Hash
())
fmt
.
Println
(
lotteryID
)
}
func
TestExecBuyLottery
(
t
*
testing
.
T
)
{
var
targetReceipt
types
.
Receipt
var
targetErr
=
types
.
ErrNoBalance
var
receipt
*
types
.
Receipt
var
err
error
targetReceipt
.
Ty
=
2
tx
:=
ConstructBuyTx
()
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
// ErrNoBalance case
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
acc1
:=
lottery
.
GetCoinsAccount
()
.
LoadExecAccount
(
buyAddr
,
address
.
ExecAddress
(
"lottery"
))
acc1
.
Balance
=
10000000000
lottery
.
GetCoinsAccount
()
.
SaveExecAccount
(
address
.
ExecAddress
(
"lottery"
),
acc1
)
targetErr
=
nil
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
// success case
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
}
func
TestExecDrawLottery
(
t
*
testing
.
T
)
{
var
targetReceipt
types
.
Receipt
var
targetErr
=
rt
.
ErrLotteryStatus
var
receipt
*
types
.
Receipt
var
err
error
targetReceipt
.
Ty
=
2
tx
:=
ConstructDrawTx
()
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
// ErrLotteryStatus case
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
lottery
.
SetEnv
(
100
,
0
,
0
)
receipt
,
err
=
lottery
.
Exec
(
tx
,
0
)
targetErr
=
types
.
ErrActionNotSupport
// ErrActionNotSupport case
if
!
CompareLotteryExecResult
(
receipt
,
err
,
&
targetReceipt
,
targetErr
)
{
t
.
Error
(
testNormErr
)
}
// mock message between randnum nextstep
}
func
genaddress
()
(
string
,
crypto
.
PrivKey
)
{
cr
,
err
:=
crypto
.
New
(
types
.
GetSignName
(
""
,
types
.
SECP256K1
))
if
err
!=
nil
{
panic
(
err
)
}
privto
,
err
:=
cr
.
GenKey
()
if
err
!=
nil
{
panic
(
err
)
}
addrto
:=
address
.
PubKeyToAddress
(
privto
.
PubKey
()
.
Bytes
())
return
addrto
.
String
(),
privto
}
func
NewTestDB
()
db
.
KV
{
return
executor
.
NewStateDB
(
nil
,
nil
,
nil
,
&
executor
.
StateDBOption
{
Height
:
types
.
GetFork
(
"ForkExecRollback"
)})
}
func
ConstructCreateTx
()
*
types
.
Transaction
{
var
purBlockNum
int64
=
30
var
drawBlockNum
int64
=
40
var
opRatio
int64
=
10
var
devRatio
int64
=
10
var
fee
int64
=
1e6
vcreate
:=
&
rt
.
LotteryAction_Create
{
Create
:
&
rt
.
LotteryCreate
{
PurBlockNum
:
purBlockNum
,
DrawBlockNum
:
drawBlockNum
,
OpRewardRatio
:
opRatio
,
DevRewardRatio
:
devRatio
}}
transfer
:=
&
rt
.
LotteryAction
{
Value
:
vcreate
,
Ty
:
rt
.
LotteryActionCreate
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"lottery"
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
rt
.
LotteryX
))}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Sign
(
types
.
SECP256K1
,
creatorPriv
)
return
tx
}
func
ConstructBuyTx
()
*
types
.
Transaction
{
var
amount
int64
=
1
var
number
int64
=
12345
var
way
int64
=
1
var
fee
int64
=
1e6
vbuy
:=
&
rt
.
LotteryAction_Buy
{
Buy
:
&
rt
.
LotteryBuy
{
LotteryId
:
lotteryID
,
Amount
:
amount
,
Number
:
number
,
Way
:
way
}}
transfer
:=
&
rt
.
LotteryAction
{
Value
:
vbuy
,
Ty
:
rt
.
LotteryActionBuy
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"lottery"
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
rt
.
LotteryX
))}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Sign
(
types
.
SECP256K1
,
buyPriv
)
return
tx
}
func
ConstructDrawTx
()
*
types
.
Transaction
{
var
fee
int64
=
1e6
vdraw
:=
&
rt
.
LotteryAction_Draw
{
Draw
:
&
rt
.
LotteryDraw
{
LotteryId
:
lotteryID
}}
transfer
:=
&
rt
.
LotteryAction
{
Value
:
vdraw
,
Ty
:
rt
.
LotteryActionDraw
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"lottery"
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
address
.
ExecAddress
(
types
.
ExecName
(
rt
.
LotteryX
))}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Sign
(
types
.
SECP256K1
,
creatorPriv
)
return
tx
}
func
constructLotteryInstance
()
drivers
.
Driver
{
lottery
:=
newLottery
()
//lottery.SetStateDB(NewTestDB())
mydb
=
NewTestDB
()
lottery
.
SetStateDB
(
mydb
)
lottery
.
SetLocalDB
(
NewTestLDB
())
q
:=
queue
.
New
(
"channel"
)
client
.
New
(
q
.
Client
(),
nil
)
//lottery.SetAPI(qclient)
return
lottery
}
func
CompareLotteryExecLocalRes
(
dbset1
*
types
.
LocalDBSet
,
err1
error
,
dbset2
*
types
.
LocalDBSet
,
err2
error
)
bool
{
//fmt.Println(err1, err2, dbset1, dbset2)
if
err1
!=
err2
{
fmt
.
Println
(
err1
,
err2
)
return
false
}
if
dbset1
==
nil
&&
dbset2
==
nil
{
return
true
}
if
(
dbset1
==
nil
)
!=
(
dbset2
==
nil
)
{
return
false
}
if
dbset1
.
KV
==
nil
&&
dbset2
.
KV
==
nil
{
return
true
}
if
(
dbset1
.
KV
==
nil
)
!=
(
dbset2
.
KV
==
nil
)
{
return
false
}
if
len
(
dbset1
.
KV
)
!=
len
(
dbset2
.
KV
)
{
return
false
}
for
i
:=
range
dbset1
.
KV
{
if
!
bytes
.
Equal
(
dbset1
.
KV
[
i
]
.
Key
,
dbset2
.
KV
[
i
]
.
Key
)
{
return
false
}
if
!
bytes
.
Equal
(
dbset1
.
KV
[
i
]
.
Value
,
dbset2
.
KV
[
i
]
.
Value
)
{
return
false
}
}
return
true
}
func
CompareLotteryExecResult
(
rec1
*
types
.
Receipt
,
err1
error
,
rec2
*
types
.
Receipt
,
err2
error
)
bool
{
//fmt.Println(err1, err2, rec1, rec2)
if
err1
!=
err2
{
fmt
.
Println
(
err1
,
err2
)
return
false
}
// err, so receipt not concerned
if
err1
!=
nil
&&
err1
==
err2
{
return
true
}
if
(
rec1
==
nil
)
!=
(
rec2
==
nil
)
{
return
false
}
if
rec1
.
Ty
!=
rec2
.
Ty
{
fmt
.
Println
(
rec1
.
Ty
,
rec2
.
Ty
)
return
false
}
return
true
}
type
TestLDB
struct
{
db
.
TransactionDB
cache
map
[
string
][]
byte
}
func
NewTestLDB
()
*
TestLDB
{
return
&
TestLDB
{
cache
:
make
(
map
[
string
][]
byte
)}
}
func
(
e
*
TestLDB
)
Get
(
key
[]
byte
)
(
value
[]
byte
,
err
error
)
{
if
value
,
ok
:=
e
.
cache
[
string
(
key
)];
ok
{
//elog.Error("getkey", "key", string(key), "value", string(value))
return
value
,
nil
}
return
nil
,
types
.
ErrNotFound
}
func
(
e
*
TestLDB
)
Set
(
key
[]
byte
,
value
[]
byte
)
error
{
//elog.Error("setkey", "key", string(key), "value", string(value))
e
.
cache
[
string
(
key
)]
=
value
return
nil
}
func
(
e
*
TestLDB
)
BatchGet
(
keys
[][]
byte
)
(
values
[][]
byte
,
err
error
)
{
return
nil
,
types
.
ErrNotFound
}
//从数据库中查询数据列表,set 中的cache 更新不会影响这个list
func
(
e
*
TestLDB
)
List
(
prefix
,
key
[]
byte
,
count
,
direction
int32
)
([][]
byte
,
error
)
{
return
nil
,
types
.
ErrNotFound
}
func
(
e
*
TestLDB
)
PrefixCount
(
prefix
[]
byte
)
int64
{
return
0
}
plugin/dapp/lottery/executor/lotteryblock.go
View file @
2d0bd9cc
...
@@ -9,59 +9,10 @@ import (
...
@@ -9,59 +9,10 @@ import (
"time"
"time"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/lottery/types"
tickettypes
"github.com/33cn/plugin/plugin/dapp/ticket/types"
)
)
const
retryNum
=
10
const
retryNum
=
10
//different impl on main chain and parachain
func
(
action
*
Action
)
getTxActions
(
height
int64
,
blockNum
int64
)
([]
*
tickettypes
.
TicketAction
,
error
)
{
var
txActions
[]
*
tickettypes
.
TicketAction
llog
.
Error
(
"getTxActions"
,
"height"
,
height
,
"blockNum"
,
blockNum
)
if
!
types
.
IsPara
()
{
req
:=
&
types
.
ReqBlocks
{
Start
:
height
-
blockNum
+
1
,
End
:
height
,
IsDetail
:
false
,
Pid
:
[]
string
{
""
}}
blockDetails
,
err
:=
action
.
api
.
GetBlocks
(
req
)
if
err
!=
nil
{
llog
.
Error
(
"getTxActions"
,
"height"
,
height
,
"blockNum"
,
blockNum
,
"err"
,
err
)
return
txActions
,
err
}
for
_
,
block
:=
range
blockDetails
.
Items
{
llog
.
Debug
(
"getTxActions"
,
"blockHeight"
,
block
.
Block
.
Height
,
"blockhash"
,
block
.
Block
.
Hash
())
ticketAction
,
err
:=
action
.
getMinerTx
(
block
.
Block
)
if
err
!=
nil
{
return
txActions
,
err
}
txActions
=
append
(
txActions
,
ticketAction
)
}
return
txActions
,
nil
}
//block height on main
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
if
mainHeight
<
0
{
llog
.
Error
(
"LotteryCreate"
,
"mainHeight"
,
mainHeight
)
return
nil
,
pty
.
ErrLotteryStatus
}
blockDetails
,
err
:=
action
.
GetBlocksOnMain
(
mainHeight
-
blockNum
,
mainHeight
-
1
)
if
err
!=
nil
{
llog
.
Error
(
"LotteryCreate"
,
"mainHeight"
,
mainHeight
)
return
nil
,
pty
.
ErrLotteryStatus
}
for
_
,
block
:=
range
blockDetails
.
Items
{
ticketAction
,
err
:=
action
.
getMinerTx
(
block
.
Block
)
if
err
!=
nil
{
return
txActions
,
err
}
txActions
=
append
(
txActions
,
ticketAction
)
}
return
txActions
,
nil
}
// GetMainHeightByTxHash get Block height
// GetMainHeightByTxHash get Block height
func
(
action
*
Action
)
GetMainHeightByTxHash
(
txHash
[]
byte
)
int64
{
func
(
action
*
Action
)
GetMainHeightByTxHash
(
txHash
[]
byte
)
int64
{
for
i
:=
0
;
i
<
retryNum
;
i
++
{
for
i
:=
0
;
i
<
retryNum
;
i
++
{
...
@@ -76,58 +27,3 @@ func (action *Action) GetMainHeightByTxHash(txHash []byte) int64 {
...
@@ -76,58 +27,3 @@ func (action *Action) GetMainHeightByTxHash(txHash []byte) int64 {
return
-
1
return
-
1
}
}
// GetBlocksOnMain get Block from main chain
func
(
action
*
Action
)
GetBlocksOnMain
(
start
int64
,
end
int64
)
(
*
types
.
BlockDetails
,
error
)
{
req
:=
&
types
.
ReqBlocks
{
Start
:
start
,
End
:
end
,
IsDetail
:
false
,
Pid
:
[]
string
{
""
}}
getBlockSucc
:=
false
var
reply
*
types
.
Reply
var
err
error
for
i
:=
0
;
i
<
retryNum
;
i
++
{
reply
,
err
=
action
.
grpcClient
.
GetBlocks
(
context
.
Background
(),
req
)
if
err
!=
nil
{
llog
.
Error
(
"GetBlocksOnMain"
,
"start"
,
start
,
"end"
,
end
,
"err"
,
err
)
time
.
Sleep
(
time
.
Second
)
}
else
{
getBlockSucc
=
true
break
}
}
if
!
getBlockSucc
{
return
nil
,
err
}
var
blockDetails
types
.
BlockDetails
err
=
types
.
Decode
(
reply
.
Msg
,
&
blockDetails
)
if
err
!=
nil
{
llog
.
Error
(
"GetBlocksOnMain"
,
"err"
,
err
)
return
nil
,
err
}
return
&
blockDetails
,
nil
}
func
(
action
*
Action
)
getMinerTx
(
current
*
types
.
Block
)
(
*
tickettypes
.
TicketAction
,
error
)
{
//检查第一个笔交易的execs, 以及执行状态
if
len
(
current
.
Txs
)
==
0
{
return
nil
,
types
.
ErrEmptyTx
}
baseTx
:=
current
.
Txs
[
0
]
//判断交易类型和执行情况
var
ticketAction
tickettypes
.
TicketAction
err
:=
types
.
Decode
(
baseTx
.
GetPayload
(),
&
ticketAction
)
if
err
!=
nil
{
return
nil
,
err
}
if
ticketAction
.
GetTy
()
!=
tickettypes
.
TicketActionMiner
{
return
nil
,
types
.
ErrCoinBaseTxType
}
//判断交易执行是否OK
if
ticketAction
.
GetMiner
()
==
nil
{
return
nil
,
tickettypes
.
ErrEmptyMinerTx
}
return
&
ticketAction
,
nil
}
plugin/dapp/lottery/executor/lotterydb.go
View file @
2d0bd9cc
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
package
executor
package
executor
import
(
import
(
"fmt"
"context"
"sort"
"strconv"
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/account"
...
@@ -20,10 +19,10 @@ import (
...
@@ -20,10 +19,10 @@ import (
)
)
const
(
const
(
exciting
=
100000
/
2
exciting
=
100000
lucky
=
1000
/
2
lucky
=
1000
happy
=
100
/
2
happy
=
100
notbad
=
10
/
2
notbad
=
10
)
)
const
(
const
(
...
@@ -51,13 +50,22 @@ const (
...
@@ -51,13 +50,22 @@ const (
OneStar
=
1
OneStar
=
1
)
)
const
luckyNumMol
=
100000
const
(
const
decimal
=
100000000
//1e8
luckyNumMol
=
100000
const
randMolNum
=
5
decimal
=
100000000
//1e8
const
grpcRecSize
int
=
5
*
30
*
1024
*
1024
//randMolNum = 5
const
blockNum
=
5
grpcRecSize
int
=
5
*
30
*
1024
*
1024
blockNum
=
5
)
const
(
maxRatio
=
100
rewardBase
=
1000
devRewardAddr
=
"1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
opRewardAddr
=
"1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
)
// LotteryDB
struct
// LotteryDB
def
type
LotteryDB
struct
{
type
LotteryDB
struct
{
pty
.
Lottery
pty
.
Lottery
}
}
...
@@ -127,6 +135,9 @@ func NewLotteryAction(l *Lottery, tx *types.Transaction, index int) *Action {
...
@@ -127,6 +135,9 @@ func NewLotteryAction(l *Lottery, tx *types.Transaction, index int) *Action {
fromaddr
:=
tx
.
From
()
fromaddr
:=
tx
.
From
()
msgRecvOp
:=
grpc
.
WithMaxMsgSize
(
grpcRecSize
)
msgRecvOp
:=
grpc
.
WithMaxMsgSize
(
grpcRecSize
)
if
types
.
IsPara
()
&&
cfg
.
ParaRemoteGrpcClient
==
""
{
panic
(
"ParaRemoteGrpcClient error"
)
}
conn
,
err
:=
grpc
.
Dial
(
cfg
.
ParaRemoteGrpcClient
,
grpc
.
WithInsecure
(),
msgRecvOp
)
conn
,
err
:=
grpc
.
Dial
(
cfg
.
ParaRemoteGrpcClient
,
grpc
.
WithInsecure
(),
msgRecvOp
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -187,6 +198,9 @@ func (action *Action) LotteryCreate(create *pty.LotteryCreate) (*types.Receipt,
...
@@ -187,6 +198,9 @@ func (action *Action) LotteryCreate(create *pty.LotteryCreate) (*types.Receipt,
lotteryID
:=
common
.
ToHex
(
action
.
txhash
)
lotteryID
:=
common
.
ToHex
(
action
.
txhash
)
if
create
.
OpRewardRatio
>
maxRatio
||
create
.
DevRewardRatio
>
maxRatio
||
create
.
OpRewardRatio
<
0
||
create
.
DevRewardRatio
<
0
{
return
nil
,
pty
.
ErrRewardFactor
}
if
!
isRightCreator
(
action
.
fromaddr
,
action
.
db
,
false
)
{
if
!
isRightCreator
(
action
.
fromaddr
,
action
.
db
,
false
)
{
return
nil
,
pty
.
ErrNoPrivilege
return
nil
,
pty
.
ErrNoPrivilege
}
}
...
@@ -212,6 +226,9 @@ func (action *Action) LotteryCreate(create *pty.LotteryCreate) (*types.Receipt,
...
@@ -212,6 +226,9 @@ func (action *Action) LotteryCreate(create *pty.LotteryCreate) (*types.Receipt,
lott
:=
NewLotteryDB
(
lotteryID
,
create
.
GetPurBlockNum
(),
lott
:=
NewLotteryDB
(
lotteryID
,
create
.
GetPurBlockNum
(),
create
.
GetDrawBlockNum
(),
action
.
height
,
action
.
fromaddr
)
create
.
GetDrawBlockNum
(),
action
.
height
,
action
.
fromaddr
)
lott
.
OpRewardRatio
=
create
.
OpRewardRatio
lott
.
DevRewardRatio
=
create
.
DevRewardRatio
llog
.
Debug
(
"LotteryCreate"
,
"OpRewardRatio"
,
lott
.
OpRewardRatio
,
"DevRewardRatio"
,
lott
.
DevRewardRatio
)
if
types
.
IsPara
()
{
if
types
.
IsPara
()
{
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
if
mainHeight
<
0
{
if
mainHeight
<
0
{
...
@@ -310,11 +327,6 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
...
@@ -310,11 +327,6 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
return
nil
,
pty
.
ErrLotteryBuyNumber
return
nil
,
pty
.
ErrLotteryBuyNumber
}
}
if
lott
.
Records
==
nil
{
llog
.
Debug
(
"LotteryBuy records init"
)
lott
.
Records
=
make
(
map
[
string
]
*
pty
.
PurchaseRecords
)
}
newRecord
:=
&
pty
.
PurchaseRecord
{
Amount
:
buy
.
GetAmount
(),
Number
:
buy
.
GetNumber
(),
Index
:
action
.
GetIndex
(),
Way
:
buy
.
GetWay
()}
newRecord
:=
&
pty
.
PurchaseRecord
{
Amount
:
buy
.
GetAmount
(),
Number
:
buy
.
GetNumber
(),
Index
:
action
.
GetIndex
(),
Way
:
buy
.
GetWay
()}
llog
.
Debug
(
"LotteryBuy"
,
"amount"
,
buy
.
GetAmount
(),
"number"
,
buy
.
GetNumber
())
llog
.
Debug
(
"LotteryBuy"
,
"amount"
,
buy
.
GetAmount
(),
"number"
,
buy
.
GetNumber
())
...
@@ -340,18 +352,25 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
...
@@ -340,18 +352,25 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
lott
.
Fund
+=
buy
.
GetAmount
()
lott
.
Fund
+=
buy
.
GetAmount
()
lott
.
TotalPurchasedTxNum
++
if
record
,
ok
:=
lott
.
Records
[
action
.
fromaddr
];
ok
{
newAddr
:=
true
record
.
Record
=
append
(
record
.
Record
,
newRecord
)
for
i
:=
range
lott
.
PurRecords
{
}
else
{
if
action
.
fromaddr
==
lott
.
PurRecords
[
i
]
.
Addr
{
lott
.
PurRecords
[
i
]
.
Record
=
append
(
lott
.
PurRecords
[
i
]
.
Record
,
newRecord
)
lott
.
PurRecords
[
i
]
.
AmountOneRound
+=
buy
.
Amount
newAddr
=
false
break
}
}
if
newAddr
{
initrecord
:=
&
pty
.
PurchaseRecords
{}
initrecord
:=
&
pty
.
PurchaseRecords
{}
initrecord
.
Record
=
append
(
initrecord
.
Record
,
newRecord
)
initrecord
.
Record
=
append
(
initrecord
.
Record
,
newRecord
)
initrecord
.
FundWin
=
0
initrecord
.
FundWin
=
0
initrecord
.
AmountOneRound
=
0
initrecord
.
AmountOneRound
=
buy
.
Amount
lott
.
Records
[
action
.
fromaddr
]
=
initrecord
initrecord
.
Addr
=
action
.
fromaddr
lott
.
PurRecords
=
append
(
lott
.
PurRecords
,
initrecord
)
}
}
lott
.
Records
[
action
.
fromaddr
]
.
AmountOneRound
+=
buy
.
Amount
lott
.
TotalPurchasedTxNum
++
lott
.
Save
(
action
.
db
)
lott
.
Save
(
action
.
db
)
kv
=
append
(
kv
,
lott
.
GetKVSet
()
...
)
kv
=
append
(
kv
,
lott
.
GetKVSet
()
...
)
...
@@ -364,8 +383,6 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
...
@@ -364,8 +383,6 @@ func (action *Action) LotteryBuy(buy *pty.LotteryBuy) (*types.Receipt, error) {
}
}
// LotteryDraw Action
// LotteryDraw Action
// 1.Anyone who buy a ticket
// 2.Creator
func
(
action
*
Action
)
LotteryDraw
(
draw
*
pty
.
LotteryDraw
)
(
*
types
.
Receipt
,
error
)
{
func
(
action
*
Action
)
LotteryDraw
(
draw
*
pty
.
LotteryDraw
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
kv
[]
*
types
.
KeyValue
...
@@ -404,10 +421,10 @@ func (action *Action) LotteryDraw(draw *pty.LotteryDraw) (*types.Receipt, error)
...
@@ -404,10 +421,10 @@ func (action *Action) LotteryDraw(draw *pty.LotteryDraw) (*types.Receipt, error)
}
}
if
action
.
fromaddr
!=
lott
.
GetCreateAddr
()
{
if
action
.
fromaddr
!=
lott
.
GetCreateAddr
()
{
if
_
,
ok
:=
lott
.
Records
[
action
.
fromaddr
];
!
ok
{
//
if _, ok := lott.Records[action.fromaddr]; !ok {
llog
.
Error
(
"LotteryDraw"
,
"action.fromaddr"
,
action
.
fromaddr
)
llog
.
Error
(
"LotteryDraw"
,
"action.fromaddr"
,
action
.
fromaddr
)
return
nil
,
pty
.
ErrLotteryDrawActionInvalid
return
nil
,
pty
.
ErrLotteryDrawActionInvalid
}
//
}
}
}
rec
,
updateInfo
,
err
:=
action
.
checkDraw
(
lott
)
rec
,
updateInfo
,
err
:=
action
.
checkDraw
(
lott
)
...
@@ -454,13 +471,9 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
...
@@ -454,13 +471,9 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
return
nil
,
pty
.
ErrLotteryStatus
return
nil
,
pty
.
ErrLotteryStatus
}
}
addrkeys
:=
make
([]
string
,
len
(
lott
.
Records
))
i
:=
0
var
totalReturn
int64
var
totalReturn
int64
for
addr
:=
range
lott
.
Records
{
for
_
,
recs
:=
range
lott
.
PurRecords
{
totalReturn
+=
lott
.
Records
[
addr
]
.
AmountOneRound
totalReturn
+=
recs
.
AmountOneRound
addrkeys
[
i
]
=
addr
i
++
}
}
llog
.
Debug
(
"LotteryClose"
,
"totalReturn"
,
totalReturn
)
llog
.
Debug
(
"LotteryClose"
,
"totalReturn"
,
totalReturn
)
...
@@ -470,12 +483,10 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
...
@@ -470,12 +483,10 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
return
nil
,
pty
.
ErrLotteryFundNotEnough
return
nil
,
pty
.
ErrLotteryFundNotEnough
}
}
sort
.
Strings
(
addrkeys
)
for
_
,
recs
:=
range
lott
.
PurRecords
{
if
recs
.
AmountOneRound
>
0
{
for
_
,
addr
:=
range
addrkeys
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
recs
.
Addr
,
action
.
execaddr
,
if
lott
.
Records
[
addr
]
.
AmountOneRound
>
0
{
decimal
*
recs
.
AmountOneRound
)
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
addr
,
action
.
execaddr
,
decimal
*
lott
.
Records
[
addr
]
.
AmountOneRound
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -486,11 +497,10 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
...
@@ -486,11 +497,10 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
}
}
}
}
for
addr
:=
range
lott
.
Records
{
for
i
:=
range
lott
.
PurRecords
{
lott
.
Records
[
addr
]
.
Record
=
lott
.
Records
[
addr
]
.
Record
[
0
:
0
]
lott
.
PurRecords
[
i
]
.
Record
=
lott
.
PurRecords
[
i
]
.
Record
[
0
:
0
]
delete
(
lott
.
Records
,
addr
)
}
}
lott
.
PurRecords
=
lott
.
PurRecords
[
0
:
0
]
lott
.
TotalPurchasedTxNum
=
0
lott
.
TotalPurchasedTxNum
=
0
llog
.
Debug
(
"LotteryClose switch to closestate"
)
llog
.
Debug
(
"LotteryClose switch to closestate"
)
lott
.
Status
=
pty
.
LotteryClosed
lott
.
Status
=
pty
.
LotteryClosed
...
@@ -504,66 +514,43 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
...
@@ -504,66 +514,43 @@ func (action *Action) LotteryClose(draw *pty.LotteryClose) (*types.Receipt, erro
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
}
// GetCalculableHash return hash for calculation
func
(
action
*
Action
)
GetCalculableHash
(
beg
,
end
int64
,
randMolNum
int64
)
([]
byte
,
error
)
{
//通过某个区间计算modify
timeSource
:=
int64
(
0
)
total
:=
int64
(
0
)
//last := []byte("last")
for
i
:=
beg
;
i
<
end
;
i
+=
randMolNum
{
req
:=
&
types
.
ReqBlocks
{
Start
:
i
,
End
:
i
,
IsDetail
:
false
,
Pid
:
[]
string
{
""
}}
blocks
,
err
:=
action
.
api
.
GetBlocks
(
req
)
if
err
!=
nil
{
return
[]
byte
{},
err
}
block
:=
blocks
.
Items
[
0
]
.
Block
timeSource
+=
block
.
BlockTime
total
+=
block
.
BlockTime
}
//for main chain, 5 latest block
//for para chain, 5 latest block -- 5 sequence main block
txActions
,
err
:=
action
.
getTxActions
(
end
,
blockNum
)
if
err
!=
nil
{
return
nil
,
err
}
//modify, bits, id
var
modifies
[]
byte
var
bits
uint32
var
ticketIds
string
for
_
,
ticketAction
:=
range
txActions
{
llog
.
Debug
(
"GetModify"
,
"modify"
,
ticketAction
.
GetMiner
()
.
GetModify
(),
"bits"
,
ticketAction
.
GetMiner
()
.
GetBits
(),
"ticketId"
,
ticketAction
.
GetMiner
()
.
GetTicketId
())
modifies
=
append
(
modifies
,
ticketAction
.
GetMiner
()
.
GetModify
()
...
)
bits
+=
ticketAction
.
GetMiner
()
.
GetBits
()
ticketIds
+=
ticketAction
.
GetMiner
()
.
GetTicketId
()
}
newmodify
:=
fmt
.
Sprintf
(
"%s:%s:%d:%d"
,
string
(
modifies
),
ticketIds
,
total
,
bits
)
modify
:=
common
.
Sha256
([]
byte
(
newmodify
))
return
modify
,
nil
}
//random used for verification in solo
//random used for verification in solo
func
(
action
*
Action
)
findLuckyNum
(
isSolo
bool
,
lott
*
LotteryDB
)
int64
{
func
(
action
*
Action
)
findLuckyNum
(
isSolo
bool
,
lott
*
LotteryDB
)
int64
{
var
num
int64
var
num
int64
var
msg
types
.
Message
var
err
error
var
hash
[]
byte
if
isSolo
{
if
isSolo
{
//used for internal verification
//used for internal verification
num
=
12345
num
=
12345
}
else
{
}
else
{
randMolNum
:=
(
lott
.
TotalPurchasedTxNum
+
action
.
height
-
lott
.
LastTransToPurState
)
%
3
+
2
//3~5
//发消息给randnum模块
//在主链上,当前高度查询不到,如果要保证区块个数,高度传入action.height-1
modify
,
err
:=
action
.
GetCalculableHash
(
lott
.
LastTransToPurState
,
action
.
height
-
1
,
randMolNum
)
llog
.
Debug
(
"findLuckyNum on randnum module"
)
llog
.
Error
(
"findLuckyNum"
,
"begin"
,
lott
.
LastTransToPurState
,
"end"
,
action
.
height
-
1
,
"randMolNum"
,
randMolNum
)
if
!
types
.
IsPara
()
{
req
:=
&
types
.
ReqRandHash
{
ExecName
:
"ticket"
,
Height
:
action
.
height
-
1
,
BlockNum
:
blockNum
}
if
err
!=
nil
{
msg
,
err
=
action
.
api
.
Query
(
"ticket"
,
"RandNumHash"
,
req
)
llog
.
Error
(
"findLuckyNum"
,
"err"
,
err
)
if
err
!=
nil
{
return
-
1
return
-
1
}
reply
:=
msg
.
(
*
types
.
ReplyHash
)
hash
=
reply
.
Hash
}
else
{
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
if
mainHeight
<
0
{
llog
.
Error
(
"findLuckyNum"
,
"mainHeight"
,
mainHeight
)
return
-
1
}
req
:=
&
types
.
ReqRandHash
{
ExecName
:
"ticket"
,
Height
:
mainHeight
,
BlockNum
:
blockNum
}
reply
,
err
:=
action
.
grpcClient
.
QueryRandNum
(
context
.
Background
(),
req
)
if
err
!=
nil
{
return
-
1
}
hash
=
reply
.
Hash
}
}
baseNum
,
err
:=
strconv
.
ParseUint
(
common
.
ToHex
(
modify
[
0
:
4
]),
0
,
64
)
baseNum
,
err
:=
strconv
.
ParseUint
(
common
.
ToHex
(
hash
[
0
:
4
]),
0
,
64
)
llog
.
Debug
(
"findLuckyNum"
,
"baseNum"
,
baseNum
)
if
err
!=
nil
{
if
err
!=
nil
{
llog
.
Error
(
"findLuckyNum"
,
"err"
,
err
)
llog
.
Error
(
"findLuckyNum"
,
"err"
,
err
)
return
-
1
return
-
1
...
@@ -589,91 +576,101 @@ func checkFundAmount(luckynum int64, guessnum int64, way int64) (int64, int64) {
...
@@ -589,91 +576,101 @@ func checkFundAmount(luckynum int64, guessnum int64, way int64) (int64, int64) {
}
}
func
(
action
*
Action
)
checkDraw
(
lott
*
LotteryDB
)
(
*
types
.
Receipt
,
*
pty
.
LotteryUpdateBuyInfo
,
error
)
{
func
(
action
*
Action
)
checkDraw
(
lott
*
LotteryDB
)
(
*
types
.
Receipt
,
*
pty
.
LotteryUpdateBuyInfo
,
error
)
{
llog
.
Debug
(
"checkDraw"
)
luckynum
:=
action
.
findLuckyNum
(
false
,
lott
)
luckynum
:=
action
.
findLuckyNum
(
false
,
lott
)
if
luckynum
<
0
||
luckynum
>=
luckyNumMol
{
if
luckynum
<
0
||
luckynum
>=
luckyNumMol
{
return
nil
,
nil
,
pty
.
ErrLotteryErrLuckyNum
return
nil
,
nil
,
pty
.
ErrLotteryErrLuckyNum
}
}
llog
.
Error
(
"checkDraw"
,
"luckynum"
,
luckynum
)
llog
.
Debug
(
"checkDraw"
,
"luckynum"
,
luckynum
)
//var receipt *types.Receipt
var
logs
[]
*
types
.
ReceiptLog
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
kv
[]
*
types
.
KeyValue
//calculate fund for all participant showed their number
var
updateInfo
pty
.
LotteryUpdateBuyInfo
var
updateInfo
pty
.
LotteryUpdateBuyInfo
updateInfo
.
BuyInfo
=
make
(
map
[
string
]
*
pty
.
LotteryUpdateRecs
)
var
tempFund
int64
var
tempFund
int64
var
totalFund
int64
var
totalFund
int64
addrkeys
:=
make
([]
string
,
len
(
lott
.
Records
))
i
:=
0
updateInfo
.
BuyInfo
=
make
(
map
[
string
]
*
pty
.
LotteryUpdateRecs
)
for
addr
:=
range
lott
.
Records
{
addrkeys
[
i
]
=
addr
for
i
:=
range
lott
.
PurRecords
{
i
++
for
_
,
rec
:=
range
lott
.
PurRecords
[
i
]
.
Record
{
for
_
,
rec
:=
range
lott
.
Records
[
addr
]
.
Record
{
fund
,
fundType
:=
checkFundAmount
(
luckynum
,
rec
.
Number
,
rec
.
Way
)
fund
,
fundType
:=
checkFundAmount
(
luckynum
,
rec
.
Number
,
rec
.
Way
)
if
fund
!=
0
{
if
fund
!=
0
{
newUpdateRec
:=
&
pty
.
LotteryUpdateRec
{
Index
:
rec
.
Index
,
Type
:
fundType
}
newUpdateRec
:=
&
pty
.
LotteryUpdateRec
{
Index
:
rec
.
Index
,
Type
:
fundType
}
if
update
,
ok
:=
updateInfo
.
BuyInfo
[
a
ddr
];
ok
{
if
update
,
ok
:=
updateInfo
.
BuyInfo
[
lott
.
PurRecords
[
i
]
.
A
ddr
];
ok
{
update
.
Records
=
append
(
update
.
Records
,
newUpdateRec
)
update
.
Records
=
append
(
update
.
Records
,
newUpdateRec
)
}
else
{
}
else
{
initrecord
:=
&
pty
.
LotteryUpdateRecs
{}
initrecord
:=
&
pty
.
LotteryUpdateRecs
{}
initrecord
.
Records
=
append
(
initrecord
.
Records
,
newUpdateRec
)
initrecord
.
Records
=
append
(
initrecord
.
Records
,
newUpdateRec
)
updateInfo
.
BuyInfo
[
a
ddr
]
=
initrecord
updateInfo
.
BuyInfo
[
lott
.
PurRecords
[
i
]
.
A
ddr
]
=
initrecord
}
}
}
}
tempFund
=
fund
*
rec
.
Amount
tempFund
=
fund
*
rec
.
Amount
lott
.
Records
[
addr
]
.
FundWin
+=
tempFund
lott
.
PurRecords
[
i
]
.
FundWin
+=
tempFund
totalFund
+=
tempFund
totalFund
+=
tempFund
}
}
}
}
llog
.
Debug
(
"checkDraw"
,
"lenofupdate"
,
len
(
updateInfo
.
BuyInfo
))
llog
.
Debug
(
"checkDraw"
,
"lenofupdate"
,
len
(
updateInfo
.
BuyInfo
)
,
"update"
,
updateInfo
.
BuyInfo
)
llog
.
Debug
(
"checkDraw"
,
"update"
,
updateInfo
.
BuyInfo
)
var
factor
float64
var
factor
float64
if
totalFund
>
lott
.
GetFund
()
/
2
{
if
totalFund
>
0
{
llog
.
Debug
(
"checkDraw ajust fund"
,
"lott.Fund"
,
lott
.
Fund
,
"totalFund"
,
totalFund
)
if
totalFund
>
lott
.
GetFund
()
/
2
{
factor
=
(
float64
)(
lott
.
GetFund
())
/
2
/
(
float64
)(
totalFund
)
llog
.
Debug
(
"checkDraw ajust fund"
,
"lott.Fund"
,
lott
.
Fund
,
"totalFund"
,
totalFund
)
lott
.
Fund
=
lott
.
Fund
/
2
factor
=
(
float64
)(
lott
.
GetFund
())
/
2
/
(
float64
)(
totalFund
)
}
else
{
lott
.
Fund
=
lott
.
Fund
/
2
factor
=
1.0
}
else
{
lott
.
Fund
-=
totalFund
factor
=
1.0
}
lott
.
Fund
-=
totalFund
}
llog
.
Debug
(
"checkDraw"
,
"factor"
,
factor
,
"totalFund"
,
totalFund
)
llog
.
Debug
(
"checkDraw"
,
"factor"
,
factor
,
"totalFund"
,
totalFund
)
//protection for rollback
//protection for rollback
if
factor
==
1.0
{
if
factor
==
1.0
{
if
!
action
.
CheckExecAccount
(
lott
.
CreateAddr
,
totalFund
,
true
)
{
if
!
action
.
CheckExecAccount
(
lott
.
CreateAddr
,
totalFund
,
true
)
{
return
nil
,
nil
,
pty
.
ErrLotteryFundNotEnough
return
nil
,
nil
,
pty
.
ErrLotteryFundNotEnough
}
}
}
else
{
}
else
{
if
!
action
.
CheckExecAccount
(
lott
.
CreateAddr
,
decimal
*
lott
.
Fund
/
2
+
1
,
true
)
{
if
!
action
.
CheckExecAccount
(
lott
.
CreateAddr
,
decimal
*
lott
.
Fund
/
2
+
1
,
true
)
{
return
nil
,
nil
,
pty
.
ErrLotteryFundNotEnough
return
nil
,
nil
,
pty
.
ErrLotteryFundNotEnough
}
}
}
}
sort
.
Strings
(
addrkeys
)
for
_
,
recs
:=
range
lott
.
PurRecords
{
if
recs
.
FundWin
>
0
{
fund
:=
(
recs
.
FundWin
*
int64
(
factor
*
exciting
))
*
decimal
*
(
rewardBase
-
lott
.
OpRewardRatio
-
lott
.
DevRewardRatio
)
/
(
exciting
*
rewardBase
)
//any problem when too little?
llog
.
Debug
(
"checkDraw"
,
"fund"
,
fund
)
for
_
,
addr
:=
range
addrkeys
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
recs
.
Addr
,
action
.
execaddr
,
fund
)
fund
:=
(
lott
.
Records
[
addr
]
.
FundWin
*
int64
(
factor
*
exciting
))
*
decimal
/
exciting
//any problem when too little?
if
err
!=
nil
{
llog
.
Debug
(
"checkDraw"
,
"fund"
,
fund
)
return
nil
,
nil
,
err
if
fund
>
0
{
}
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
addr
,
action
.
execaddr
,
fund
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
if
err
!=
nil
{
logs
=
append
(
logs
,
receipt
.
Logs
...
)
return
nil
,
nil
,
err
}
}
}
kv
=
append
(
kv
,
receipt
.
KV
...
)
//op reward
logs
=
append
(
logs
,
receipt
.
Logs
...
)
fundOp
:=
int64
(
factor
*
decimal
)
*
totalFund
*
lott
.
OpRewardRatio
/
rewardBase
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
opRewardAddr
,
action
.
execaddr
,
fundOp
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
kv
=
append
(
kv
,
receipt
.
KV
...
)
logs
=
append
(
logs
,
receipt
.
Logs
...
)
//dev reward
fundDev
:=
int64
(
factor
*
decimal
)
*
totalFund
*
lott
.
DevRewardRatio
/
rewardBase
receipt
,
err
=
action
.
coinsAccount
.
ExecTransferFrozen
(
lott
.
CreateAddr
,
devRewardAddr
,
action
.
execaddr
,
fundDev
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
}
kv
=
append
(
kv
,
receipt
.
KV
...
)
logs
=
append
(
logs
,
receipt
.
Logs
...
)
}
}
for
addr
:=
range
lott
.
Records
{
for
i
:=
range
lott
.
PurRecords
{
lott
.
Records
[
addr
]
.
Record
=
lott
.
Records
[
addr
]
.
Record
[
0
:
0
]
lott
.
PurRecords
[
i
]
.
Record
=
lott
.
PurRecords
[
i
]
.
Record
[
0
:
0
]
delete
(
lott
.
Records
,
addr
)
}
}
lott
.
PurRecords
=
lott
.
PurRecords
[
0
:
0
]
llog
.
Debug
(
"checkDraw lottery switch to drawed"
)
llog
.
Debug
(
"checkDraw lottery switch to drawed"
)
lott
.
LastTransToDrawState
=
action
.
height
lott
.
LastTransToDrawState
=
action
.
height
...
@@ -685,7 +682,7 @@ func (action *Action) checkDraw(lott *LotteryDB) (*types.Receipt, *pty.LotteryUp
...
@@ -685,7 +682,7 @@ func (action *Action) checkDraw(lott *LotteryDB) (*types.Receipt, *pty.LotteryUp
if
types
.
IsPara
()
{
if
types
.
IsPara
()
{
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
mainHeight
:=
action
.
GetMainHeightByTxHash
(
action
.
txhash
)
if
mainHeight
<
0
{
if
mainHeight
<
0
{
llog
.
Error
(
"Lottery
Buy
"
,
"mainHeight"
,
mainHeight
)
llog
.
Error
(
"Lottery
Draw
"
,
"mainHeight"
,
mainHeight
)
return
nil
,
nil
,
pty
.
ErrLotteryStatus
return
nil
,
nil
,
pty
.
ErrLotteryStatus
}
}
lott
.
LastTransToDrawStateOnMain
=
mainHeight
lott
.
LastTransToDrawStateOnMain
=
mainHeight
...
...
plugin/dapp/lottery/executor/query.go
View file @
2d0bd9cc
...
@@ -16,9 +16,11 @@ func (l *Lottery) Query_GetLotteryNormalInfo(param *pty.ReqLotteryInfo) (types.M
...
@@ -16,9 +16,11 @@ func (l *Lottery) Query_GetLotteryNormalInfo(param *pty.ReqLotteryInfo) (types.M
return
nil
,
err
return
nil
,
err
}
}
return
&
pty
.
ReplyLotteryNormalInfo
{
CreateHeight
:
lottery
.
CreateHeight
,
return
&
pty
.
ReplyLotteryNormalInfo
{
CreateHeight
:
lottery
.
CreateHeight
,
PurBlockNum
:
lottery
.
PurBlockNum
,
PurBlockNum
:
lottery
.
PurBlockNum
,
DrawBlockNum
:
lottery
.
DrawBlockNum
,
DrawBlockNum
:
lottery
.
DrawBlockNum
,
CreateAddr
:
lottery
.
CreateAddr
},
nil
CreateAddr
:
lottery
.
CreateAddr
,
OpRewardRatio
:
lottery
.
OpRewardRatio
,
DevRewardRatio
:
lottery
.
DevRewardRatio
},
nil
}
}
// Query_GetLotteryPurchaseAddr for current round
// Query_GetLotteryPurchaseAddr for current round
...
@@ -28,8 +30,8 @@ func (l *Lottery) Query_GetLotteryPurchaseAddr(param *pty.ReqLotteryInfo) (types
...
@@ -28,8 +30,8 @@ func (l *Lottery) Query_GetLotteryPurchaseAddr(param *pty.ReqLotteryInfo) (types
return
nil
,
err
return
nil
,
err
}
}
reply
:=
&
pty
.
ReplyLotteryPurchaseAddr
{}
reply
:=
&
pty
.
ReplyLotteryPurchaseAddr
{}
for
addr
:=
range
lottery
.
Records
{
for
_
,
recs
:=
range
lottery
.
Pur
Records
{
reply
.
Address
=
append
(
reply
.
Address
,
a
ddr
)
reply
.
Address
=
append
(
reply
.
Address
,
recs
.
A
ddr
)
}
}
//lottery.Records
//lottery.Records
return
reply
,
nil
return
reply
,
nil
...
...
plugin/dapp/lottery/proto/lottery.proto
100644 → 100755
View file @
2d0bd9cc
...
@@ -13,6 +13,7 @@ message PurchaseRecords {
...
@@ -13,6 +13,7 @@ message PurchaseRecords {
repeated
PurchaseRecord
record
=
1
;
repeated
PurchaseRecord
record
=
1
;
int64
fundWin
=
2
;
int64
fundWin
=
2
;
int64
amountOneRound
=
3
;
int64
amountOneRound
=
3
;
string
addr
=
4
;
}
}
message
Lottery
{
message
Lottery
{
...
@@ -24,7 +25,7 @@ message Lottery {
...
@@ -24,7 +25,7 @@ message Lottery {
int64
drawBlockNum
=
6
;
int64
drawBlockNum
=
6
;
int64
lastTransToPurState
=
7
;
int64
lastTransToPurState
=
7
;
int64
lastTransToDrawState
=
8
;
int64
lastTransToDrawState
=
8
;
map
<
string
,
PurchaseRecords
>
records
=
9
;
//
map<string, PurchaseRecords> records = 9;
int64
totalPurchasedTxNum
=
10
;
int64
totalPurchasedTxNum
=
10
;
string
createAddr
=
11
;
string
createAddr
=
11
;
int64
round
=
12
;
int64
round
=
12
;
...
@@ -33,6 +34,9 @@ message Lottery {
...
@@ -33,6 +34,9 @@ message Lottery {
int64
lastTransToPurStateOnMain
=
15
;
int64
lastTransToPurStateOnMain
=
15
;
int64
lastTransToDrawStateOnMain
=
16
;
int64
lastTransToDrawStateOnMain
=
16
;
repeated
MissingRecord
missingRecords
=
17
;
repeated
MissingRecord
missingRecords
=
17
;
int64
opRewardRatio
=
18
;
int64
devRewardRatio
=
19
;
repeated
PurchaseRecords
purRecords
=
20
;
}
}
message
MissingRecord
{
message
MissingRecord
{
...
@@ -50,8 +54,10 @@ message LotteryAction {
...
@@ -50,8 +54,10 @@ message LotteryAction {
}
}
message
LotteryCreate
{
message
LotteryCreate
{
int64
purBlockNum
=
1
;
int64
purBlockNum
=
1
;
int64
drawBlockNum
=
2
;
int64
drawBlockNum
=
2
;
int64
opRewardRatio
=
3
;
int64
devRewardRatio
=
4
;
}
}
message
LotteryBuy
{
message
LotteryBuy
{
...
@@ -117,10 +123,12 @@ message ReqLotteryLuckyHistory {
...
@@ -117,10 +123,12 @@ message ReqLotteryLuckyHistory {
}
}
message
ReplyLotteryNormalInfo
{
message
ReplyLotteryNormalInfo
{
int64
createHeight
=
1
;
int64
createHeight
=
1
;
int64
purBlockNum
=
2
;
int64
purBlockNum
=
2
;
int64
drawBlockNum
=
3
;
int64
drawBlockNum
=
3
;
string
createAddr
=
4
;
string
createAddr
=
4
;
int64
opRewardRatio
=
5
;
int64
devRewardRatio
=
6
;
}
}
message
ReplyLotteryCurrentInfo
{
message
ReplyLotteryCurrentInfo
{
...
...
plugin/dapp/lottery/types/errors.go
View file @
2d0bd9cc
...
@@ -25,4 +25,5 @@ var (
...
@@ -25,4 +25,5 @@ var (
ErrLotteryErrUnableClose
=
errors
.
New
(
"ErrLotteryErrUnableClose"
)
ErrLotteryErrUnableClose
=
errors
.
New
(
"ErrLotteryErrUnableClose"
)
ErrNodeNotExist
=
errors
.
New
(
"ErrNodeNotExist"
)
ErrNodeNotExist
=
errors
.
New
(
"ErrNodeNotExist"
)
ErrEmptyMinerTx
=
errors
.
New
(
"ErrEmptyMinerTx"
)
ErrEmptyMinerTx
=
errors
.
New
(
"ErrEmptyMinerTx"
)
ErrRewardFactor
=
errors
.
New
(
"ErrRewardFactor"
)
)
)
plugin/dapp/lottery/types/lottery.go
View file @
2d0bd9cc
...
@@ -109,8 +109,10 @@ func CreateRawLotteryCreateTx(parm *LotteryCreateTx) (*types.Transaction, error)
...
@@ -109,8 +109,10 @@ func CreateRawLotteryCreateTx(parm *LotteryCreateTx) (*types.Transaction, error)
}
}
v
:=
&
LotteryCreate
{
v
:=
&
LotteryCreate
{
PurBlockNum
:
parm
.
PurBlockNum
,
PurBlockNum
:
parm
.
PurBlockNum
,
DrawBlockNum
:
parm
.
DrawBlockNum
,
DrawBlockNum
:
parm
.
DrawBlockNum
,
OpRewardRatio
:
parm
.
OpRewardRatio
,
DevRewardRatio
:
parm
.
DevRewardRatio
,
}
}
create
:=
&
LotteryAction
{
create
:=
&
LotteryAction
{
Ty
:
LotteryActionCreate
,
Ty
:
LotteryActionCreate
,
...
...
plugin/dapp/lottery/types/lottery.pb.go
View file @
2d0bd9cc
...
@@ -88,6 +88,7 @@ type PurchaseRecords struct {
...
@@ -88,6 +88,7 @@ type PurchaseRecords struct {
Record
[]
*
PurchaseRecord
`protobuf:"bytes,1,rep,name=record,proto3" json:"record,omitempty"`
Record
[]
*
PurchaseRecord
`protobuf:"bytes,1,rep,name=record,proto3" json:"record,omitempty"`
FundWin
int64
`protobuf:"varint,2,opt,name=fundWin,proto3" json:"fundWin,omitempty"`
FundWin
int64
`protobuf:"varint,2,opt,name=fundWin,proto3" json:"fundWin,omitempty"`
AmountOneRound
int64
`protobuf:"varint,3,opt,name=amountOneRound,proto3" json:"amountOneRound,omitempty"`
AmountOneRound
int64
`protobuf:"varint,3,opt,name=amountOneRound,proto3" json:"amountOneRound,omitempty"`
Addr
string
`protobuf:"bytes,4,opt,name=addr,proto3" json:"addr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -139,27 +140,37 @@ func (m *PurchaseRecords) GetAmountOneRound() int64 {
...
@@ -139,27 +140,37 @@ func (m *PurchaseRecords) GetAmountOneRound() int64 {
return
0
return
0
}
}
func
(
m
*
PurchaseRecords
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
type
Lottery
struct
{
type
Lottery
struct
{
LotteryId
string
`protobuf:"bytes,1,opt,name=lotteryId,proto3" json:"lotteryId,omitempty"`
LotteryId
string
`protobuf:"bytes,1,opt,name=lotteryId,proto3" json:"lotteryId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
CreateHeight
int64
`protobuf:"varint,3,opt,name=createHeight,proto3" json:"createHeight,omitempty"`
CreateHeight
int64
`protobuf:"varint,3,opt,name=createHeight,proto3" json:"createHeight,omitempty"`
Fund
int64
`protobuf:"varint,4,opt,name=fund,proto3" json:"fund,omitempty"`
Fund
int64
`protobuf:"varint,4,opt,name=fund,proto3" json:"fund,omitempty"`
PurBlockNum
int64
`protobuf:"varint,5,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
PurBlockNum
int64
`protobuf:"varint,5,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,6,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,6,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
LastTransToPurState
int64
`protobuf:"varint,7,opt,name=lastTransToPurState,proto3" json:"lastTransToPurState,omitempty"`
LastTransToPurState
int64
`protobuf:"varint,7,opt,name=lastTransToPurState,proto3" json:"lastTransToPurState,omitempty"`
LastTransToDrawState
int64
`protobuf:"varint,8,opt,name=lastTransToDrawState,proto3" json:"lastTransToDrawState,omitempty"`
LastTransToDrawState
int64
`protobuf:"varint,8,opt,name=lastTransToDrawState,proto3" json:"lastTransToDrawState,omitempty"`
Records
map
[
string
]
*
PurchaseRecords
`protobuf:"bytes,9,rep,name=records,proto3" json:"records,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
//map<string, PurchaseRecords> records = 9;
TotalPurchasedTxNum
int64
`protobuf:"varint,10,opt,name=totalPurchasedTxNum,proto3" json:"totalPurchasedTxNum,omitempty"`
TotalPurchasedTxNum
int64
`protobuf:"varint,10,opt,name=totalPurchasedTxNum,proto3" json:"totalPurchasedTxNum,omitempty"`
CreateAddr
string
`protobuf:"bytes,11,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
CreateAddr
string
`protobuf:"bytes,11,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
Round
int64
`protobuf:"varint,12,opt,name=round,proto3" json:"round,omitempty"`
Round
int64
`protobuf:"varint,12,opt,name=round,proto3" json:"round,omitempty"`
LuckyNumber
int64
`protobuf:"varint,13,opt,name=luckyNumber,proto3" json:"luckyNumber,omitempty"`
LuckyNumber
int64
`protobuf:"varint,13,opt,name=luckyNumber,proto3" json:"luckyNumber,omitempty"`
CreateOnMain
int64
`protobuf:"varint,14,opt,name=createOnMain,proto3" json:"createOnMain,omitempty"`
CreateOnMain
int64
`protobuf:"varint,14,opt,name=createOnMain,proto3" json:"createOnMain,omitempty"`
LastTransToPurStateOnMain
int64
`protobuf:"varint,15,opt,name=lastTransToPurStateOnMain,proto3" json:"lastTransToPurStateOnMain,omitempty"`
LastTransToPurStateOnMain
int64
`protobuf:"varint,15,opt,name=lastTransToPurStateOnMain,proto3" json:"lastTransToPurStateOnMain,omitempty"`
LastTransToDrawStateOnMain
int64
`protobuf:"varint,16,opt,name=lastTransToDrawStateOnMain,proto3" json:"lastTransToDrawStateOnMain,omitempty"`
LastTransToDrawStateOnMain
int64
`protobuf:"varint,16,opt,name=lastTransToDrawStateOnMain,proto3" json:"lastTransToDrawStateOnMain,omitempty"`
MissingRecords
[]
*
MissingRecord
`protobuf:"bytes,17,rep,name=missingRecords,proto3" json:"missingRecords,omitempty"`
MissingRecords
[]
*
MissingRecord
`protobuf:"bytes,17,rep,name=missingRecords,proto3" json:"missingRecords,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
OpRewardRatio
int64
`protobuf:"varint,18,opt,name=opRewardRatio,proto3" json:"opRewardRatio,omitempty"`
XXX_unrecognized
[]
byte
`json:"-"`
DevRewardRatio
int64
`protobuf:"varint,19,opt,name=devRewardRatio,proto3" json:"devRewardRatio,omitempty"`
XXX_sizecache
int32
`json:"-"`
PurRecords
[]
*
PurchaseRecords
`protobuf:"bytes,20,rep,name=purRecords,proto3" json:"purRecords,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
Lottery
)
Reset
()
{
*
m
=
Lottery
{}
}
func
(
m
*
Lottery
)
Reset
()
{
*
m
=
Lottery
{}
}
...
@@ -243,13 +254,6 @@ func (m *Lottery) GetLastTransToDrawState() int64 {
...
@@ -243,13 +254,6 @@ func (m *Lottery) GetLastTransToDrawState() int64 {
return
0
return
0
}
}
func
(
m
*
Lottery
)
GetRecords
()
map
[
string
]
*
PurchaseRecords
{
if
m
!=
nil
{
return
m
.
Records
}
return
nil
}
func
(
m
*
Lottery
)
GetTotalPurchasedTxNum
()
int64
{
func
(
m
*
Lottery
)
GetTotalPurchasedTxNum
()
int64
{
if
m
!=
nil
{
if
m
!=
nil
{
return
m
.
TotalPurchasedTxNum
return
m
.
TotalPurchasedTxNum
...
@@ -306,6 +310,27 @@ func (m *Lottery) GetMissingRecords() []*MissingRecord {
...
@@ -306,6 +310,27 @@ func (m *Lottery) GetMissingRecords() []*MissingRecord {
return
nil
return
nil
}
}
func
(
m
*
Lottery
)
GetOpRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
OpRewardRatio
}
return
0
}
func
(
m
*
Lottery
)
GetDevRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
DevRewardRatio
}
return
0
}
func
(
m
*
Lottery
)
GetPurRecords
()
[]
*
PurchaseRecords
{
if
m
!=
nil
{
return
m
.
PurRecords
}
return
nil
}
type
MissingRecord
struct
{
type
MissingRecord
struct
{
Times
[]
int32
`protobuf:"varint,1,rep,packed,name=times,proto3" json:"times,omitempty"`
Times
[]
int32
`protobuf:"varint,1,rep,packed,name=times,proto3" json:"times,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
...
@@ -568,6 +593,8 @@ func _LotteryAction_OneofSizer(msg proto.Message) (n int) {
...
@@ -568,6 +593,8 @@ func _LotteryAction_OneofSizer(msg proto.Message) (n int) {
type
LotteryCreate
struct
{
type
LotteryCreate
struct
{
PurBlockNum
int64
`protobuf:"varint,1,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
PurBlockNum
int64
`protobuf:"varint,1,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,2,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,2,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
OpRewardRatio
int64
`protobuf:"varint,3,opt,name=opRewardRatio,proto3" json:"opRewardRatio,omitempty"`
DevRewardRatio
int64
`protobuf:"varint,4,opt,name=devRewardRatio,proto3" json:"devRewardRatio,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -612,6 +639,20 @@ func (m *LotteryCreate) GetDrawBlockNum() int64 {
...
@@ -612,6 +639,20 @@ func (m *LotteryCreate) GetDrawBlockNum() int64 {
return
0
return
0
}
}
func
(
m
*
LotteryCreate
)
GetOpRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
OpRewardRatio
}
return
0
}
func
(
m
*
LotteryCreate
)
GetDevRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
DevRewardRatio
}
return
0
}
type
LotteryBuy
struct
{
type
LotteryBuy
struct
{
LotteryId
string
`protobuf:"bytes,1,opt,name=lotteryId,proto3" json:"lotteryId,omitempty"`
LotteryId
string
`protobuf:"bytes,1,opt,name=lotteryId,proto3" json:"lotteryId,omitempty"`
Amount
int64
`protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
Amount
int64
`protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
...
@@ -1176,6 +1217,8 @@ type ReplyLotteryNormalInfo struct {
...
@@ -1176,6 +1217,8 @@ type ReplyLotteryNormalInfo struct {
PurBlockNum
int64
`protobuf:"varint,2,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
PurBlockNum
int64
`protobuf:"varint,2,opt,name=purBlockNum,proto3" json:"purBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,3,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
DrawBlockNum
int64
`protobuf:"varint,3,opt,name=drawBlockNum,proto3" json:"drawBlockNum,omitempty"`
CreateAddr
string
`protobuf:"bytes,4,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
CreateAddr
string
`protobuf:"bytes,4,opt,name=createAddr,proto3" json:"createAddr,omitempty"`
OpRewardRatio
int64
`protobuf:"varint,5,opt,name=opRewardRatio,proto3" json:"opRewardRatio,omitempty"`
DevRewardRatio
int64
`protobuf:"varint,6,opt,name=devRewardRatio,proto3" json:"devRewardRatio,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
XXX_sizecache
int32
`json:"-"`
...
@@ -1234,6 +1277,20 @@ func (m *ReplyLotteryNormalInfo) GetCreateAddr() string {
...
@@ -1234,6 +1277,20 @@ func (m *ReplyLotteryNormalInfo) GetCreateAddr() string {
return
""
return
""
}
}
func
(
m
*
ReplyLotteryNormalInfo
)
GetOpRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
OpRewardRatio
}
return
0
}
func
(
m
*
ReplyLotteryNormalInfo
)
GetDevRewardRatio
()
int64
{
if
m
!=
nil
{
return
m
.
DevRewardRatio
}
return
0
}
type
ReplyLotteryCurrentInfo
struct
{
type
ReplyLotteryCurrentInfo
struct
{
Status
int32
`protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Status
int32
`protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
Fund
int64
`protobuf:"varint,2,opt,name=fund,proto3" json:"fund,omitempty"`
Fund
int64
`protobuf:"varint,2,opt,name=fund,proto3" json:"fund,omitempty"`
...
@@ -1891,7 +1948,6 @@ func init() {
...
@@ -1891,7 +1948,6 @@ func init() {
proto
.
RegisterType
((
*
PurchaseRecord
)(
nil
),
"types.PurchaseRecord"
)
proto
.
RegisterType
((
*
PurchaseRecord
)(
nil
),
"types.PurchaseRecord"
)
proto
.
RegisterType
((
*
PurchaseRecords
)(
nil
),
"types.PurchaseRecords"
)
proto
.
RegisterType
((
*
PurchaseRecords
)(
nil
),
"types.PurchaseRecords"
)
proto
.
RegisterType
((
*
Lottery
)(
nil
),
"types.Lottery"
)
proto
.
RegisterType
((
*
Lottery
)(
nil
),
"types.Lottery"
)
proto
.
RegisterMapType
((
map
[
string
]
*
PurchaseRecords
)(
nil
),
"types.Lottery.RecordsEntry"
)
proto
.
RegisterType
((
*
MissingRecord
)(
nil
),
"types.MissingRecord"
)
proto
.
RegisterType
((
*
MissingRecord
)(
nil
),
"types.MissingRecord"
)
proto
.
RegisterType
((
*
LotteryAction
)(
nil
),
"types.LotteryAction"
)
proto
.
RegisterType
((
*
LotteryAction
)(
nil
),
"types.LotteryAction"
)
proto
.
RegisterType
((
*
LotteryCreate
)(
nil
),
"types.LotteryCreate"
)
proto
.
RegisterType
((
*
LotteryCreate
)(
nil
),
"types.LotteryCreate"
)
...
@@ -1923,84 +1979,86 @@ func init() {
...
@@ -1923,84 +1979,86 @@ func init() {
func
init
()
{
proto
.
RegisterFile
(
"lottery.proto"
,
fileDescriptor_2cce7afd61783b10
)
}
func
init
()
{
proto
.
RegisterFile
(
"lottery.proto"
,
fileDescriptor_2cce7afd61783b10
)
}
var
fileDescriptor_2cce7afd61783b10
=
[]
byte
{
var
fileDescriptor_2cce7afd61783b10
=
[]
byte
{
// 1252 bytes of a gzipped FileDescriptorProto
// 1285 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xa4
,
0x58
,
0x5f
,
0x6f
,
0xe3
,
0x44
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xa4
,
0x58
,
0xdd
,
0x6e
,
0xe3
,
0x44
,
0x10
,
0xaf
,
0xed
,
0x38
,
0x69
,
0x26
,
0x69
,
0xee
,
0xba
,
0x2d
,
0x3d
,
0x53
,
0x50
,
0x55
,
0x59
,
0x3a
,
0x14
,
0xae
,
0xed
,
0x38
,
0x69
,
0x4e
,
0x7e
,
0xb6
,
0x9d
,
0x86
,
0xae
,
0x59
,
0x50
,
0x55
,
0x59
,
0x2c
,
0x54
,
0xe9
,
0x8e
,
0x08
,
0x02
,
0x48
,
0x08
,
0x2a
,
0xa4
,
0xcb
,
0x71
,
0x28
,
0x95
,
0x7a
,
0xbd
,
0xd3
,
0xaa
,
0xb4
,
0x10
,
0x41
,
0x40
,
0x08
,
0x41
,
0x85
,
0xb4
,
0x59
,
0x16
,
0xa5
,
0x52
,
0xb7
,
0xbb
,
0x9a
,
0xb6
,
0x27
,
0x1e
,
0x78
,
0x72
,
0xe3
,
0xbd
,
0xab
,
0xd5
,
0xc4
,
0x0e
,
0xf6
,
0xfa
,
0x5a
,
0xbf
,
0x21
,
0x16
,
0x71
,
0xc1
,
0x95
,
0x1b
,
0xcf
,
0x6e
,
0xad
,
0x26
,
0x76
,
0x18
,
0x8f
,
0xdb
,
0xfa
,
0x8e
,
0x77
,
0xbe
,
0x04
,
0x3c
,
0xf3
,
0xc4
,
0x23
,
0x1f
,
0x81
,
0x4f
,
0xc1
,
0x17
,
0xe1
,
0x0b
,
0xa0
,
0x9d
,
0x5d
,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c
,
0xd5
,
0xbe
,
0x32
,
0xbf
,
0x34
,
0xdc
,
0xcf
,
0xc1
,
0xd1
,
0x8c
,
0x10
,
0x00
,
0x00
,
0xcb
,
0x31
,
0xa3
,
0x4a
,
0xd1
,
0x56
,
0x1c
,
0x68
,
0xf0
,
0x89
,
0x81
,
0xc4
,
0x12
,
0x81
,
0x26
,
0xce
,
0x96
,
0x97
,
0x75
,
0xf1
,
0x7f
,
0x92
,
0xcf
,
0xfe
,
0x0b
,
0x00
,
0x00
,
0xff
,
0xff
,
0x62
,
0x68
,
0x00
,
0x1f
,
0x38
,
0x11
,
0x00
,
0x00
,
}
}
plugin/dapp/lottery/types/tx.go
View file @
2d0bd9cc
...
@@ -6,9 +6,11 @@ package types
...
@@ -6,9 +6,11 @@ package types
// LotteryCreateTx for construction
// LotteryCreateTx for construction
type
LotteryCreateTx
struct
{
type
LotteryCreateTx
struct
{
PurBlockNum
int64
`json:"purBlockNum"`
PurBlockNum
int64
`json:"purBlockNum"`
DrawBlockNum
int64
`json:"drawBlockNum"`
DrawBlockNum
int64
`json:"drawBlockNum"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
OpRewardRatio
int64
`json:"opRewardRatio"`
DevRewardRatio
int64
`json:"devRewardRatio"`
}
}
// LotteryBuyTx for construction
// LotteryBuyTx for construction
...
...
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