github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/token/types/keys.go (about) 1 package types 2 3 import ( 4 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 5 ) 6 7 const ( 8 // ModuleName is the name of the staking module 9 ModuleName = "token" 10 11 DefaultParamspace = ModuleName 12 DefaultCodespace = ModuleName 13 14 // StoreKey is the string store representation 15 StoreKey = ModuleName 16 17 // QuerierRoute is the querier route for the staking module 18 QuerierRoute = ModuleName 19 20 // RouterKey is the msg router key for the staking module 21 RouterKey = ModuleName 22 23 KeyLock = "lock" 24 KeyMint = "mint" 25 26 // query endpoints supported by the governance Querier 27 QueryInfo = "info" 28 QueryTokens = "tokens" 29 QueryParameters = "params" 30 QueryCurrency = "currency" 31 QueryAccount = "accounts" 32 QueryKeysNum = "store" 33 34 QueryAccountV2 = "accountsV2" 35 QueryTokensV2 = "tokensV2" 36 QueryTokenV2 = "tokenV2" 37 38 UploadAccount = "upload" 39 ) 40 41 var ( 42 TokenKey = []byte{0x00} // the address prefix of the token's symbol 43 TokenNumberKey = []byte{0x01} // key for token number address 44 LockKey = []byte{0x02} // the address prefix of the locked coins 45 PrefixUserTokenKey = []byte{0x03} // the address prefix of the user-token relationship 46 LockedFeeKey = []byte{0x04} // the address prefix of the locked order fee coins 47 PrefixConfirmOwnershipKey = []byte{0x05} // the prefix of the confirm ownership key 48 ) 49 50 func GetUserTokenPrefix(owner sdk.AccAddress) []byte { 51 return append(PrefixUserTokenKey, owner.Bytes()...) 52 } 53 54 func GetUserTokenKey(owner sdk.AccAddress, symbol string) []byte { 55 return append(GetUserTokenPrefix(owner), []byte(symbol)...) 56 } 57 58 func GetTokenAddress(symbol string) []byte { 59 return append(TokenKey, []byte(symbol)...) 60 } 61 62 func GetLockAddress(addr sdk.AccAddress) []byte { 63 return append(LockKey, addr.Bytes()...) 64 } 65 66 // GetLockFeeAddress gets the key for the lock fee information with address 67 func GetLockFeeAddress(addr sdk.AccAddress) []byte { 68 return append(LockedFeeKey, addr.Bytes()...) 69 } 70 71 func GetConfirmOwnershipKey(symbol string) []byte { 72 return append(PrefixConfirmOwnershipKey, []byte(symbol)...) 73 }