-
Notifications
You must be signed in to change notification settings - Fork 17
/
keys.go
61 lines (46 loc) · 1.28 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
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
// ModuleName defines the module name
ModuleName = "cross"
// Version defines the current version the Cross
// module supports
Version = "cross-1"
// 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_capability"
// PortID defines the portID of this module
PortID = "cross"
)
var (
InitiatorKeyPrefix = []byte("initiator")
AuthKeyPrefix = []byte("auth")
AtomicKeyPrefix = []byte("atomic")
ContractManagerPrefix = []byte("cmanager")
ContractStoreKeyPrefix = []byte("cstore")
)
type PrefixStoreKey struct {
StoreKey sdk.StoreKey
Prefix []byte
}
var _ sdk.StoreKey = (*PrefixStoreKey)(nil)
func NewPrefixStoreKey(storeKey sdk.StoreKey, prefix []byte) *PrefixStoreKey {
return &PrefixStoreKey{
StoreKey: storeKey,
Prefix: prefix,
}
}
func (sk *PrefixStoreKey) Name() string {
return sk.StoreKey.Name()
}
func (sk *PrefixStoreKey) String() string {
return fmt.Sprintf("PrefixStoreKey{%p, %s, %v}", sk, sk.Name(), sk.Prefix)
}