-
Notifications
You must be signed in to change notification settings - Fork 568
/
key.go
45 lines (35 loc) · 1.47 KB
/
key.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
package types
import (
"fmt"
"time"
)
const (
ModuleName = "poolincentives"
StoreKey = ModuleName
RouterKey = ModuleName
QuerierRoute = ModuleName
)
var (
LockableDurationsKey = []byte("lockable_durations")
DistrInfoKey = []byte("distr_info")
)
// GetPoolGaugeIdInternalStoreKey returns a StoreKey with pool ID and its duration as inputs
// This is used for linking pool id, duration and gauge id for internal incentives.
func GetPoolGaugeIdInternalStoreKey(poolId uint64, duration time.Duration) []byte {
return []byte(fmt.Sprintf("pool-incentives/%d/%s", poolId, duration.String()))
}
// GetPoolIdFromGaugeIdStoreKey returns a StoreKey from the given gaugeID and duration.
func GetPoolIdFromGaugeIdStoreKey(gaugeId uint64, duration time.Duration) []byte {
return []byte(fmt.Sprintf("pool-incentives-pool-id/%d/%s", gaugeId, duration.String()))
}
// GetPoolNoLockGaugeIdStoreKey returns a StoreKey with pool ID and gauge id as input
// assuming that the pool has no lockable duration.
func GetPoolNoLockGaugeIdStoreKey(poolId uint64, gaugeId uint64) []byte {
return []byte(fmt.Sprintf("no-lock-pool-incentives/%d/%d", poolId, gaugeId))
}
// GetPoolNoLockGaugeIdIterationStoreKey returns a StoreKey with pool ID as input
// assuming that the pool has no lockable duration. It is used for collecting
// values by iterating over this prefix.
func GetPoolNoLockGaugeIdIterationStoreKey(poolId uint64) []byte {
return []byte(fmt.Sprintf("no-lock-pool-incentives/%d/", poolId))
}