-
Notifications
You must be signed in to change notification settings - Fork 207
/
keys.go
49 lines (36 loc) · 1.24 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
package types
import (
"strings"
)
const (
// ModuleName defines the module name
ModuleName = "subscription"
// 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_subscription"
// prefix for the subscription fixation store
SubsFixationPrefix = "subs-fs"
// prefix for the subscription timer store
SubsTimerPrefix = "subs-ts"
// prefix for the CU tracker fixation store
CuTrackerFixationPrefix = "cu-tracker-fs"
// prefix for the CU tracker timer store
CuTrackerTimerPrefix = "cu-tracker-ts"
)
// CuTrackerKey encodes a keys using the subscription's consumer address, provider address and the relay's chain ID
func CuTrackerKey(sub string, provider string, chainID string) string {
return sub + " " + provider + " " + chainID
}
// DecodeCuTrackerKey decodes the CU tracker key
func DecodeCuTrackerKey(key string) (sub string, provider string, chainID string) {
decodedKey := strings.Split(key, " ")
return decodedKey[0], decodedKey[1], decodedKey[2]
}
func KeyPrefix(p string) []byte {
return []byte(p)
}