github.com/gravity-devs/liquidity@v1.5.3/x/liquidity/legacy/v042/keys.go (about) 1 // Package v042 is copy-pasted from: 2 // https://github.com/tendermint/liquidity/blob/v1.2.9/x/liquidity/types/keys.go 3 package v042 4 5 import ( 6 sdk "github.com/cosmos/cosmos-sdk/types" 7 ) 8 9 const ( 10 // ModuleName is the name of the liquidity module 11 ModuleName = "liquidity" 12 ) 13 14 var ( 15 PoolByReserveAccIndexKeyPrefix = []byte{0x12} 16 17 PoolBatchIndexKeyPrefix = []byte{0x21} // Last PoolBatchIndex 18 ) 19 20 // - PoolByReserveAccIndex: `0x12 | ReserveAcc -> Id` 21 // GetPoolByReserveAccIndexKey returns kv indexing key of the pool indexed by reserve account 22 func GetPoolByReserveAccIndexKey(reserveAcc sdk.AccAddress) []byte { 23 return append(PoolByReserveAccIndexKeyPrefix, reserveAcc.Bytes()...) 24 } 25 26 // GetPoolBatchIndexKey returns kv indexing key of the latest index value of the pool batch 27 func GetPoolBatchIndexKey(poolID uint64) []byte { 28 key := make([]byte, 9) 29 key[0] = PoolBatchIndexKeyPrefix[0] 30 copy(key[1:9], sdk.Uint64ToBigEndian(poolID)) 31 return key 32 }