/
keys.go
38 lines (29 loc) · 881 Bytes
/
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
package types
import sdk "github.com/cosmos/cosmos-sdk/types"
const (
// ModuleName defines the module name
ModuleName = "token"
// 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
)
var (
PrefixTokenForSymbol = []byte{0x01}
PrefixTokenForMinUint = []byte{0x02}
PrefixTokens = []byte{0x03}
)
func KeyPrefix(p string) []byte {
return []byte(p)
}
func KeySymbol(symbol string) []byte {
return append(PrefixTokenForSymbol, []byte(symbol)...)
}
func KeyMinUint(minUnit string) []byte {
return append(PrefixTokenForMinUint, []byte(minUnit)...)
}
func KeyTokens(owner sdk.AccAddress, symbol string) []byte {
return append(append(PrefixTokens, owner.Bytes()...), []byte(symbol)...)
}