forked from akash-network/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
params.go
50 lines (39 loc) · 1023 Bytes
/
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
package v1beta1
import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/pkg/errors"
)
var _ paramtypes.ParamSet = (*Params)(nil)
var (
DefaultDeploymentMinDeposit = sdk.NewCoin("uakt", sdk.NewInt(5000000))
)
const (
keyDeploymentMinDeposit = "DeploymentMinDeposit"
)
func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair([]byte(keyDeploymentMinDeposit), &p.DeploymentMinDeposit, validateCoin),
}
}
func DefaultParams() Params {
return Params{
DeploymentMinDeposit: DefaultDeploymentMinDeposit,
}
}
func (p Params) Validate() error {
if err := validateCoin(p.DeploymentMinDeposit); err != nil {
return err
}
return nil
}
func validateCoin(i interface{}) error {
_, ok := i.(sdk.Coin)
if !ok {
return errors.Wrapf(ErrInvalidParam, "%T", i)
}
return nil
}