-
Notifications
You must be signed in to change notification settings - Fork 1
/
keys.go
executable file
·51 lines (40 loc) · 1.61 KB
/
keys.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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 (
"fmt"
"github.com/assetcloud/chain/common/address"
)
func calcLotteryBuyPrefix(lotteryID string, addr string) []byte {
key := fmt.Sprintf("LODB-lottery-buy:%s:%s", lotteryID, address.FormatAddrKey(addr))
return []byte(key)
}
func calcLotteryBuyRoundPrefix(lotteryID string, addr string, round int64) []byte {
key := fmt.Sprintf("LODB-lottery-buy:%s:%s:%10d", lotteryID, address.FormatAddrKey(addr), round)
return []byte(key)
}
func calcLotteryBuyKey(lotteryID string, addr string, round int64, index int64) []byte {
key := fmt.Sprintf("LODB-lottery-buy:%s:%s:%10d:%18d", lotteryID, address.FormatAddrKey(addr), round, index)
return []byte(key)
}
func calcLotteryDrawPrefix(lotteryID string) []byte {
key := fmt.Sprintf("LODB-lottery-draw:%s", lotteryID)
return []byte(key)
}
func calcLotteryDrawKey(lotteryID string, round int64) []byte {
key := fmt.Sprintf("LODB-lottery-draw:%s:%10d", lotteryID, round)
return []byte(key)
}
func calcLotteryKey(lotteryID string, status int32) []byte {
key := fmt.Sprintf("LODB-lottery-:%d:%s", status, lotteryID)
return []byte(key)
}
func calcLotteryGainPrefix(lotteryID string, addr string) []byte {
key := fmt.Sprintf("LODB-lottery-gain:%s:%s", lotteryID, address.FormatAddrKey(addr))
return []byte(key)
}
func calcLotteryGainKey(lotteryID string, addr string, round int64) []byte {
key := fmt.Sprintf("LODB-lottery-gain:%s:%s:%10d", lotteryID, address.FormatAddrKey(addr), round)
return []byte(key)
}