/
keys.go
76 lines (55 loc) · 2.65 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package types
import spntypes "github.com/tendermint/spn/pkg/types"
const (
// ModuleName defines the module name
ModuleName = "monitoringc"
// FullModuleName defines the full module name used in interface like CLI to make it more explanatory
FullModuleName = "monitoring-consumer"
// 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_monitoringc"
// Version defines the current version the IBC module supports
Version = "monitoring-1"
// PortID is the default port id that module binds to
PortID = "monitoringc"
// VerifiedClientIDKeyPrefix is the prefix to retrieve all VerifiedClientID
VerifiedClientIDKeyPrefix = "VerifiedClientID/value/"
// ProviderClientIDKeyPrefix is the prefix to retrieve all ProviderClientID
ProviderClientIDKeyPrefix = "ProviderClientID/value/"
// LaunchIDFromVerifiedClientIDKeyPrefix is the prefix to retrieve all LaunchIDFromVerifiedClientID
LaunchIDFromVerifiedClientIDKeyPrefix = "LaunchIDFromVerifiedClientID/value/"
// LaunchIDFromChannelIDKeyPrefix is the prefix to retrieve all LaunchIDFromChannelID
LaunchIDFromChannelIDKeyPrefix = "LaunchIDFromChannelID/value/"
// MonitoringHistoryKeyPrefix is the prefix to retrieve all MonitoringHistory
MonitoringHistoryKeyPrefix = "MonitoringHistory/value/"
)
// PortKey defines the key to store the port ID in store
var PortKey = KeyPrefix("monitoringc-port-")
func KeyPrefix(p string) []byte {
return []byte(p)
}
// VerifiedClientIDKey returns the store key to retrieve a VerifiedClientID from the index fields
func VerifiedClientIDKey(launchID uint64) []byte {
return append(spntypes.UintBytes(launchID), byte('/'))
}
// ProviderClientIDKey returns the store key to retrieve a ProviderClientID from the index fields
func ProviderClientIDKey(launchID uint64) []byte {
return append(spntypes.UintBytes(launchID), byte('/'))
}
// LaunchIDFromVerifiedClientIDKey returns the store key to retrieve a LaunchIDFromVerifiedClientID from the index fields
func LaunchIDFromVerifiedClientIDKey(clientID string) []byte {
return []byte(clientID + "/")
}
// LaunchIDFromChannelIDKey returns the store key to retrieve a LaunchIDFromChannelID from the index fields
func LaunchIDFromChannelIDKey(channelID string) []byte {
return []byte(channelID + "/")
}
// MonitoringHistoryKey returns the store key to retrieve a MonitoringHistory from the index fields
func MonitoringHistoryKey(launchID uint64) []byte {
return append(spntypes.UintBytes(launchID), byte('/'))
}