-
Notifications
You must be signed in to change notification settings - Fork 28
/
params.go
50 lines (39 loc) · 953 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 types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func NewParams(denomCreationFee sdk.Coins) Params {
return Params{
DenomCreationFee: denomCreationFee,
}
}
// DefaultParams default tokenfactory module parameters.
func DefaultParams() Params {
return Params{
DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin("uflix", 100_000_000)),
DenomCreationGasConsume: 2_000_000,
}
}
// validate params.
func (p Params) Validate() error {
err := validateDenomCreationFee(p.DenomCreationFee)
return err
}
func validateDenomCreationFee(i interface{}) error {
v, ok := i.(sdk.Coins)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Validate() != nil {
return fmt.Errorf("invalid denom creation fee: %+v", i)
}
return nil
}
func validateDenomCreationFeeGasConsume(i interface{}) error {
_, ok := i.(uint64)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}