-
Notifications
You must be signed in to change notification settings - Fork 36
/
key.go
36 lines (28 loc) · 967 Bytes
/
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
package types
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "insurance"
StoreKey = ModuleName
)
var (
// Key for insurance prefixes
InsuranceFundPrefixKey = []byte{0x02}
// Key for insurance redemption prefixes
RedemptionSchedulePrefixKey = []byte{0x03}
GlobalShareDenomIdPrefixKey = []byte{0x04, 0x00}
GlobalRedemptionScheduleIdPrefixKey = []byte{0x05, 0x00}
)
// GetRedemptionScheduleKey provides the key to store a single pending redemption
func GetRedemptionScheduleKey(redemptionID uint64, claimTime time.Time) []byte {
key := RedemptionSchedulePrefixKey
key = append(key, sdk.FormatTimeBytes(claimTime)...)
key = append(key, sdk.Uint64ToBigEndian(redemptionID)...)
return key
}
// GetRedemptionScheduleKey provides the key to store a single pending redemption
func (sh RedemptionSchedule) GetRedemptionScheduleKey() []byte {
return GetRedemptionScheduleKey(sh.Id, sh.ClaimableRedemptionTime)
}