-
Notifications
You must be signed in to change notification settings - Fork 16
/
keys.go
51 lines (39 loc) · 1.23 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
package types
const (
// ModuleName defines the module name
ModuleName = "oracle"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey defines the module's message routing key
RouterKey = ModuleName
)
var (
BlockDataKeyPrefix = []byte{0x00}
FeederDelegationKeyPrefix = []byte{0x01}
MissCountKeyPrefix = []byte{0x02}
AggregatePrevoteKeyPrefix = []byte{0x03}
AggregateVoteKeyPrefix = []byte{0x04}
RoundKeyPrefix = []byte{0x05}
CurrentRoundBytes = []byte{0x00}
)
func KeyPrefix(p string) []byte {
return []byte(p)
}
func BlockDataKey(chainId string) []byte {
return append(BlockDataKeyPrefix, KeyPrefix(chainId)...)
}
func FeederDelegationKey(validatorAddress string) []byte {
return append(FeederDelegationKeyPrefix, validatorAddress...)
}
func MissCountKey(validatorAddress string) []byte {
return append(MissCountKeyPrefix, validatorAddress...)
}
func AggregatePrevoteKey(validatorAddress string) []byte {
return append(AggregatePrevoteKeyPrefix, validatorAddress...)
}
func AggregateVoteKey(validatorAddress string) []byte {
return append(AggregateVoteKeyPrefix, validatorAddress...)
}
func CurrentRoundKey() []byte {
return append(RoundKeyPrefix, CurrentRoundBytes...)
}