-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.go
73 lines (56 loc) · 2.05 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
72
73
package types
import (
sdk "github.com/furyaxyz/fuxchain/libs/cosmos-sdk/types"
)
const (
// ModuleName is the name of the staking module
ModuleName = "token"
DefaultParamspace = ModuleName
DefaultCodespace = ModuleName
// StoreKey is the string store representation
StoreKey = ModuleName
// QuerierRoute is the querier route for the staking module
QuerierRoute = ModuleName
// RouterKey is the msg router key for the staking module
RouterKey = ModuleName
KeyLock = "lock"
KeyMint = "mint"
// query endpoints supported by the governance Querier
QueryInfo = "info"
QueryTokens = "tokens"
QueryParameters = "params"
QueryCurrency = "currency"
QueryAccount = "accounts"
QueryKeysNum = "store"
QueryAccountV2 = "accountsV2"
QueryTokensV2 = "tokensV2"
QueryTokenV2 = "tokenV2"
UploadAccount = "upload"
)
var (
TokenKey = []byte{0x00} // the address prefix of the token's symbol
TokenNumberKey = []byte{0x01} // key for token number address
LockKey = []byte{0x02} // the address prefix of the locked coins
PrefixUserTokenKey = []byte{0x03} // the address prefix of the user-token relationship
LockedFeeKey = []byte{0x04} // the address prefix of the locked order fee coins
PrefixConfirmOwnershipKey = []byte{0x05} // the prefix of the confirm ownership key
)
func GetUserTokenPrefix(owner sdk.AccAddress) []byte {
return append(PrefixUserTokenKey, owner.Bytes()...)
}
func GetUserTokenKey(owner sdk.AccAddress, symbol string) []byte {
return append(GetUserTokenPrefix(owner), []byte(symbol)...)
}
func GetTokenAddress(symbol string) []byte {
return append(TokenKey, []byte(symbol)...)
}
func GetLockAddress(addr sdk.AccAddress) []byte {
return append(LockKey, addr.Bytes()...)
}
// GetLockFeeAddress gets the key for the lock fee information with address
func GetLockFeeAddress(addr sdk.AccAddress) []byte {
return append(LockedFeeKey, addr.Bytes()...)
}
func GetConfirmOwnershipKey(symbol string) []byte {
return append(PrefixConfirmOwnershipKey, []byte(symbol)...)
}