-
Notifications
You must be signed in to change notification settings - Fork 28
/
params.go
46 lines (37 loc) · 1.09 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
package types
import (
"fmt"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// DefaultDenomCreationFee Default period for closing bids for an auction
var DefaultDenomCreationFee = sdk.NewInt64Coin("uflix", 100_000_000) // 100FLIX
func NewONFTParams(denomCreationFee sdk.Coin) Params {
return Params{
DenomCreationFee: denomCreationFee,
}
}
// DefaultParams returns default onft parameters
func DefaultParams() Params {
return NewONFTParams(
DefaultDenomCreationFee,
)
}
// ValidateBasic performs basic validation on onft parameters.
func (p Params) ValidateBasic() error {
if err := validateDenomCreationFee(p.DenomCreationFee); err != nil {
return err
}
return nil
}
// ValidateDenomCreationFee performs validation of denom creation fee
func validateDenomCreationFee(i interface{}) error {
fee, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if !fee.IsValid() || fee.IsZero() {
return errorsmod.Wrapf(ErrInvalidDenomCreationFee, "invalid fee amount %s, only accepts positive amounts", fee.String())
}
return nil
}