-
Notifications
You must be signed in to change notification settings - Fork 102
/
params.go
73 lines (63 loc) · 2.01 KB
/
params.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package types
import (
"fmt"
sdk "github.com/pokt-network/pocket-core/types"
"strings"
)
// Default parameter values
const (
DefaultMaxMemoCharacters uint64 = 256
DefaultTxSigLimit uint64 = 7
)
// Parameter keys
var (
KeyMaxMemoCharacters = []byte("MaxMemoCharacters")
KeyTxSigLimit = []byte("TxSigLimit")
KeyFeeMultiplier = []byte("FeeMultipliers")
DefaultFeeMultiplier = FeeMultipliers{
FeeMultis: nil,
Default: 1,
}
)
var _ sdk.ParamSet = &Params{}
// Params defines the parameters for the auth module.
type Params struct {
MaxMemoCharacters uint64 `json:"max_memo_characters" yaml:"max_memo_characters"`
TxSigLimit uint64 `json:"tx_sig_limit" yaml:"tx_sig_limit"`
FeeMultiplier FeeMultipliers `json:"fee_multipliers"`
}
// ParamKeyTable for auth module
func ParamKeyTable() sdk.KeyTable {
return sdk.NewKeyTable().RegisterParamSet(&Params{})
}
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
// pairs of auth module's parameters.
// nolint
func (p *Params) ParamSetPairs() sdk.ParamSetPairs {
return sdk.ParamSetPairs{
{Key: KeyMaxMemoCharacters, Value: &p.MaxMemoCharacters},
{Key: KeyTxSigLimit, Value: &p.TxSigLimit},
{Key: KeyFeeMultiplier, Value: &p.FeeMultiplier},
}
}
// Equal returns a boolean determining if two Params types are identical.
//func (p Params) Equal(p2 Params) bool {
// return reflect.DeepEqual(p, p2)
//}
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return Params{
MaxMemoCharacters: DefaultMaxMemoCharacters,
TxSigLimit: DefaultTxSigLimit,
FeeMultiplier: DefaultFeeMultiplier,
}
}
// String implements the stringer interface.
func (p Params) String() string {
var sb strings.Builder
sb.WriteString("Params: \n")
sb.WriteString(fmt.Sprintf("MaxMemoCharacters: %d\n", p.MaxMemoCharacters))
sb.WriteString(fmt.Sprintf("TxSigLimit: %d\n", p.TxSigLimit))
sb.WriteString(fmt.Sprintf("FeeMultiplier: %v\n", p.FeeMultiplier))
return sb.String()
}