github.com/Finschia/finschia-sdk@v0.49.1/x/fbridge/keeper/params.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  	"github.com/Finschia/finschia-sdk/x/fbridge/types"
     6  )
     7  
     8  func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
     9  	if err := params.ValidateParams(); err != nil {
    10  		return err
    11  	}
    12  
    13  	store := ctx.KVStore(k.storeKey)
    14  	bz := k.cdc.MustMarshal(&params)
    15  	store.Set(types.KeyParams, bz)
    16  	return nil
    17  }
    18  
    19  func (k Keeper) GetParams(ctx sdk.Context) types.Params {
    20  	store := ctx.KVStore(k.storeKey)
    21  	bz := store.Get(types.KeyParams)
    22  	if bz == nil {
    23  		return types.DefaultParams()
    24  	}
    25  
    26  	var params types.Params
    27  	k.cdc.MustUnmarshal(bz, &params)
    28  	return params
    29  }