github.com/Finschia/finschia-sdk@v0.48.1/x/collection/keeper/param.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/Finschia/finschia-sdk/types"
     5  	sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
     6  	"github.com/Finschia/finschia-sdk/x/collection"
     7  )
     8  
     9  func (k Keeper) GetParams(ctx sdk.Context) collection.Params {
    10  	store := ctx.KVStore(k.storeKey)
    11  	key := paramsKey
    12  	bz := store.Get(key)
    13  	if bz == nil {
    14  		panic(sdkerrors.ErrNotFound.Wrap("params does not exist"))
    15  	}
    16  
    17  	var params collection.Params
    18  	k.cdc.MustUnmarshal(bz, &params)
    19  
    20  	return params
    21  }
    22  
    23  func (k Keeper) SetParams(ctx sdk.Context, params collection.Params) {
    24  	store := ctx.KVStore(k.storeKey)
    25  	key := paramsKey
    26  
    27  	bz, err := params.Marshal()
    28  	if err != nil {
    29  		panic(err)
    30  	}
    31  	store.Set(key, bz)
    32  }