-
Notifications
You must be signed in to change notification settings - Fork 49
/
keys.go
71 lines (52 loc) · 1.91 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
package types
import (
"github.com/bnb-chain/greenfield/internal/sequence"
)
const (
// ModuleName defines the module name
ModuleName = "virtualgroup"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey defines the module's message routing key
RouterKey = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_virtualgroup"
// TStoreKey defines the transient store key
TStoreKey = "transient_storage"
// GVGVirtualPaymentAccountName string for derive the virtual payment account for GVG
GVGVirtualPaymentAccountName = "global_virtual_group"
// GVGFamilyName string for derive the virtual payment account for GVG family
GVGFamilyName = "global_virtual_group_family"
// NoSpecifiedFamilyId defines
NoSpecifiedFamilyId = uint32(0)
)
var (
ParamsKey = []byte{0x01}
GVGKey = []byte{0x21}
GVGFamilyKey = []byte{0x22}
GVGSequencePrefix = []byte{0x32}
GVGFamilySequencePrefix = []byte{0x33}
GVGStatisticsWithinSPKey = []byte{0x41}
SwapOutFamilyKey = []byte{0x51}
SwapOutGVGKey = []byte{0x61}
)
func GetGVGKey(gvgID uint32) []byte {
var uint32Seq sequence.Sequence[uint32]
return append(GVGKey, uint32Seq.EncodeSequence(gvgID)...)
}
func GetGVGFamilyKey(familyID uint32) []byte {
var uint32Seq sequence.Sequence[uint32]
return append(GVGFamilyKey, uint32Seq.EncodeSequence(familyID)...)
}
func GetGVGStatisticsWithinSPKey(spID uint32) []byte {
var uint32Seq sequence.Sequence[uint32]
return append(GVGStatisticsWithinSPKey, uint32Seq.EncodeSequence(spID)...)
}
func GetSwapOutFamilyKey(globalVirtualGroupFamilyID uint32) []byte {
var uint32Seq sequence.Sequence[uint32]
return append(SwapOutFamilyKey, uint32Seq.EncodeSequence(globalVirtualGroupFamilyID)...)
}
func GetSwapOutGVGKey(globalVirtualGroupID uint32) []byte {
var uint32Seq sequence.Sequence[uint32]
return append(SwapOutGVGKey, uint32Seq.EncodeSequence(globalVirtualGroupID)...)
}