github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/distribution/keeper/params.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     5  
     6  	"github.com/fibonacci-chain/fbc/x/distribution/types"
     7  )
     8  
     9  // GetParams returns the total set of distribution parameters.
    10  func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
    11  	k.paramSpace.GetParamSet(ctx, &params)
    12  	return params
    13  }
    14  
    15  // GetParamsForInitGenesis returns the total set of distribution parameters.
    16  func (k Keeper) GetParamsForInitGenesis(ctx sdk.Context) (params types.Params) {
    17  	k.paramSpace.GetParamSetForInitGenesis(ctx, &params, types.IgnoreInitGenesisList)
    18  	return params
    19  }
    20  
    21  // SetParams sets the distribution parameters to the param space.
    22  func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
    23  	k.paramSpace.SetParamSet(ctx, &params)
    24  }
    25  
    26  // SetParamsForInitGenesis sets the distribution parameters to the param space, and ignore the target keys for additional
    27  func (k Keeper) SetParamsForInitGenesis(ctx sdk.Context, params types.Params) {
    28  	k.paramSpace.SetParamSetForInitGenesis(ctx, &params, types.IgnoreInitGenesisList)
    29  }
    30  
    31  // GetCommunityTax returns the current CommunityTax rate from the global param store
    32  // nolint: errcheck
    33  func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) {
    34  	k.paramSpace.Get(ctx, types.ParamStoreKeyCommunityTax, &percent)
    35  	return percent
    36  }
    37  
    38  // SetCommunityTax sets the value of community tax
    39  // nolint: errcheck
    40  func (k Keeper) SetCommunityTax(ctx sdk.Context, percent sdk.Dec) {
    41  	k.paramSpace.Set(ctx, types.ParamStoreKeyCommunityTax, &percent)
    42  }
    43  
    44  // GetWithdrawAddrEnabled returns the current WithdrawAddrEnabled
    45  // nolint: errcheck
    46  func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool) {
    47  	k.paramSpace.Get(ctx, types.ParamStoreKeyWithdrawAddrEnabled, &enabled)
    48  	return enabled
    49  }
    50  
    51  // SetWithdrawAddrEnabled sets the value of enabled
    52  // nolint: errcheck
    53  func (k Keeper) SetWithdrawAddrEnabled(ctx sdk.Context, enabled bool) {
    54  	k.paramSpace.Set(ctx, types.ParamStoreKeyWithdrawAddrEnabled, &enabled)
    55  }