-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.go
40 lines (30 loc) · 1.13 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
package types
import (
sdk "github.com/blockgenx/blockgen-sdk/types"
)
const (
// module name
ModuleName = "auth"
// StoreKey is string representation of the store key for auth
StoreKey = "acc"
// FeeCollectorName the root string for the fee collector account address
FeeCollectorName = "fee_collector"
// QuerierRoute is the querier route for auth
QuerierRoute = ModuleName
)
var (
// AddressStoreKeyPrefix prefix for account-by-address store
AddressStoreKeyPrefix = []byte{0x01}
// param key for global account number
GlobalAccountNumberKey = []byte("globalAccountNumber")
// AccountNumberStoreKeyPrefix prefix for account-by-id store
AccountNumberStoreKeyPrefix = []byte("accountNumber")
)
// AddressStoreKey turn an address to key used to get it from the account store
func AddressStoreKey(addr sdk.AccAddress) []byte {
return append(AddressStoreKeyPrefix, addr.Bytes()...)
}
// AccountNumberStoreKey turn an account number to key used to get the account address from account store
func AccountNumberStoreKey(accountNumber uint64) []byte {
return append(AccountNumberStoreKeyPrefix, sdk.Uint64ToBigEndian(accountNumber)...)
}