github.com/Finschia/finschia-sdk@v0.48.1/x/crisis/types/params.go (about)

     1  package types
     2  
     3  import (
     4  	"fmt"
     5  
     6  	sdk "github.com/Finschia/finschia-sdk/types"
     7  	paramtypes "github.com/Finschia/finschia-sdk/x/params/types"
     8  )
     9  
    10  // ParamStoreKeyConstantFee sets the key for constant fee parameter
    11  var ParamStoreKeyConstantFee = []byte("ConstantFee")
    12  
    13  // type declaration for parameters
    14  func ParamKeyTable() paramtypes.KeyTable {
    15  	return paramtypes.NewKeyTable(
    16  		paramtypes.NewParamSetPair(ParamStoreKeyConstantFee, sdk.Coin{}, validateConstantFee),
    17  	)
    18  }
    19  
    20  func validateConstantFee(i interface{}) error {
    21  	v, ok := i.(sdk.Coin)
    22  	if !ok {
    23  		return fmt.Errorf("invalid parameter type: %T", i)
    24  	}
    25  
    26  	if !v.IsValid() {
    27  		return fmt.Errorf("invalid constant fee: %s", v)
    28  	}
    29  
    30  	return nil
    31  }