-
Notifications
You must be signed in to change notification settings - Fork 117
/
keys.go
48 lines (38 loc) · 1.43 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
package types
import (
"fmt"
)
const (
// ModuleName is the name of the module
ModuleName = "clp"
// StoreKey to be used when creating the KVStore
StoreKey = ModuleName
// RouterKey to be used for routing msgs
RouterKey = ModuleName
// QuerierRoute to be used for querier msgs
QuerierRoute = ModuleName
NativeSymbol = "rowan"
PoolThrehold = "1000000000000000000"
PoolUnitsMinValue = "1000000000"
MaxSymbolLength = 71
MaxWbasis = 10000
)
var (
PoolPrefix = []byte{0x00} // key for storing Pools
LiquidityProviderPrefix = []byte{0x01} // key for storing Liquidity Providers
WhiteListValidatorPrefix = []byte{0x02} // Key to store WhiteList , allowed to decommission pools
)
// Generates a key for storing a specific pool
// The key is of the format externalticker_nativeticker
// Example : eth_rwn and converted into bytes after adding a prefix
func GetPoolKey(externalTicker string, nativeTicker string) ([]byte, error) {
key := []byte(fmt.Sprintf("%s_%s", externalTicker, nativeTicker))
return append(PoolPrefix, key...), nil
}
// Generate key to store a Liquidity Provider
// The key is of the format ticker_lpaddress
// Example : eth_sif1azpar20ck9lpys89r8x7zc8yu0qzgvtp48ng5v and converted into bytes after adding a prefix
func GetLiquidityProviderKey(externalTicker string, lp string) []byte {
key := []byte(fmt.Sprintf("%s_%s", externalTicker, lp))
return append(LiquidityProviderPrefix, key...)
}