forked from terra-money/classic-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
keeper_keys.go
50 lines (41 loc) · 1.06 KB
/
keeper_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
49
50
package oracle
import (
"bytes"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params"
)
// nolint
var (
PrefixVote = []byte("vote")
PrefixPrice = []byte("price")
PrefixDropCounter = []byte("drop")
KeyDelimiter = []byte(":")
ParamStoreKeyParams = []byte("params")
)
// KeyVote Key is in format of PrefixVote||denom||voter.AccAddress
func KeyVote(denom string, voter sdk.AccAddress) []byte {
return bytes.Join([][]byte{
PrefixVote,
[]byte(denom),
voter.Bytes(),
}, KeyDelimiter)
}
// KeyPrice is in format of PrefixPrice||denom
func KeyPrice(denom string) []byte {
return []byte(fmt.Sprintf("%s:%s", PrefixPrice, denom))
}
// KeyDropCounter is in format of PrefixDropCounter||denom
func KeyDropCounter(denom string) []byte {
return []byte(fmt.Sprintf("%s:%s", PrefixDropCounter, denom))
}
// ParamKeyTable for oracle module
func ParamKeyTable() params.KeyTable {
return params.NewKeyTable(
ParamStoreKeyParams, Params{},
)
}
const (
// default paramspace for params keeper
DefaultParamspace = "oracle"
)