mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-23 14:32:31 +00:00

* feat: add validator pop reward as chain param * feat: add store for challenge initiator reward amount indexed by height * feat: add validator PoP reward calculation between distributions * fix: remove paralleltest lint rule due to data race --------- Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package keeper
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
)
|
|
|
|
// GetParams get all parameters as types.Params
|
|
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
|
store := ctx.KVStore(k.storeKey)
|
|
bz := store.Get(types.KeyPrefix(types.ParamsKey))
|
|
if bz == nil {
|
|
return params
|
|
}
|
|
k.cdc.MustUnmarshal(bz, ¶ms)
|
|
return params
|
|
}
|
|
|
|
// SetParams set the params
|
|
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
|
|
if err := params.Validate(); err != nil {
|
|
return err
|
|
}
|
|
store := ctx.KVStore(k.storeKey)
|
|
bz, err := k.cdc.Marshal(¶ms)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
store.Set(types.KeyPrefix(types.ParamsKey), bz)
|
|
|
|
return nil
|
|
}
|
|
|
|
func (k Keeper) GetMintAddress(ctx sdk.Context) (mintAddress string) {
|
|
return k.GetParams(ctx).MintAddress
|
|
}
|
|
|
|
func (k Keeper) GetTxGasLimit(ctx sdk.Context) (txGasLimit uint64) {
|
|
return k.GetParams(ctx).TxGasLimit
|
|
}
|
|
|
|
func (k Keeper) GetClaimAddress(ctx sdk.Context) (claimAddress string) {
|
|
return k.GetParams(ctx).ClaimAddress
|
|
}
|
|
|
|
func (k Keeper) GetValidatorPoPReward(ctx sdk.Context) (validatorPoPReward uint64) {
|
|
return k.GetParams(ctx).ValidatorPopReward
|
|
}
|