/
keys.go
68 lines (53 loc) · 1.86 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
package types
import sdk "github.com/cosmos/cosmos-sdk/types"
const (
// ModuleName defines the module name
ModuleName = "voter"
// 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_voter"
)
const (
prefixTotalVotes = iota + 1
prefixTotalVotesByUser
prefixPoolWeightedVotes
prefixPoolWeightedVotesByUser
prefixIndex
prefixIndexAtLastUpdatedByGauge
prefixClaimableRewardByGauge
)
var (
KeyPrefixTotalVotes = []byte{prefixTotalVotes}
KeyPrefixTotalVotesByUser = []byte{prefixTotalVotesByUser}
KeyPrefixPoolWeightedVotes = []byte{prefixPoolWeightedVotes}
KeyPrefixPoolWeightedVotesByUser = []byte{prefixPoolWeightedVotesByUser}
KeyPrefixIndex = []byte{prefixIndex}
KeyPrefixIndexAtLastUpdatedByGauge = []byte{prefixIndexAtLastUpdatedByGauge}
KeyPrefixClaimableRewardByGauge = []byte{prefixClaimableRewardByGauge}
)
func TotalVotesKey() []byte {
return KeyPrefixTotalVotes
}
func TotalVotesByUserKey(veID uint64) []byte {
return append(KeyPrefixTotalVotesByUser, sdk.Uint64ToBigEndian(veID)...)
}
func PoolWeightedVotesKey(poolDenom string) []byte {
return append(KeyPrefixPoolWeightedVotes, poolDenom...)
}
func PoolWeightedVotesByUserKey(veID uint64, poolDenom string) []byte {
return append(append(KeyPrefixPoolWeightedVotes, sdk.Uint64ToBigEndian(veID)...), poolDenom...)
}
func IndexKey() []byte {
return KeyPrefixIndex
}
func IndexAtLastUpdatedByGaugeKey(poolDenom string) []byte {
return append(KeyPrefixIndexAtLastUpdatedByGauge, poolDenom...)
}
func ClaimableRewardByGaugeKey(poolDenom string) []byte {
return append(KeyPrefixClaimableRewardByGauge, poolDenom...)
}