forked from osmosis-labs/osmosis
/
key.go
38 lines (28 loc) · 791 Bytes
/
key.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 (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "gamm"
StoreKey = ModuleName
RouterKey = ModuleName
QuerierRoute = ModuleName
)
var (
// KeyNextGlobalPoolNumber defines key to store the next Pool ID to be used
KeyNextGlobalPoolNumber = []byte{0x01}
// KeyPrefixPools defines prefix to store pools
KeyPrefixPools = []byte{0x02}
// KeyTotalLiquidity defines key to store total liquidity
KeyTotalLiquidity = []byte{0x03}
)
func GetDenomPrefix(denom string) []byte {
return append(KeyTotalLiquidity, []byte(denom)...)
}
func GetPoolShareDenom(poolId uint64) string {
return fmt.Sprintf("gamm/pool/%d", poolId)
}
func GetKeyPrefixPools(poolId uint64) []byte {
return append(KeyPrefixPools, sdk.Uint64ToBigEndian(poolId)...)
}