/
keys.go
40 lines (30 loc) · 904 Bytes
/
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
package types
import "encoding/binary"
const (
// ModuleName defines the module name
ModuleName = "cfeclaim"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_cfeclaim"
)
var (
CampaignKeyPrefix = []byte{0x00}
CampaignCountKeyPrefix = []byte{0x01}
MissionKeyPrefix = []byte{0x02}
MissionCountKeyPrefix = []byte{0x03}
UserEntryKeyPrefix = []byte{0x04}
)
func MissionKey(campaignId uint64, missionId uint64) []byte {
bz := GetUint64Key(campaignId)
return append(bz, GetUint64Key(missionId)...)
}
func GetUint64Key(campaignId uint64) []byte {
key := make([]byte, 8)
binary.BigEndian.PutUint64(key, campaignId)
return key
}