Merge PR #4244: Param Proposal Simulation Messages; Minting Params Fix
This commit is contained in:
+6
-22
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/params"
|
||||
)
|
||||
|
||||
var minterKey = []byte{0x00} // the one key to use for the keeper store
|
||||
|
||||
const (
|
||||
// ModuleName is the name of the module
|
||||
ModuleName = "minting"
|
||||
@@ -42,23 +44,6 @@ func NewKeeper(cdc *codec.Codec, key sdk.StoreKey,
|
||||
return keeper
|
||||
}
|
||||
|
||||
//____________________________________________________________________
|
||||
// Keys
|
||||
|
||||
var (
|
||||
minterKey = []byte{0x00} // the one key to use for the keeper store
|
||||
|
||||
// params store for inflation params
|
||||
ParamStoreKeyParams = []byte("params")
|
||||
)
|
||||
|
||||
// ParamTable for staking module
|
||||
func ParamKeyTable() params.KeyTable {
|
||||
return params.NewKeyTable(
|
||||
ParamStoreKeyParams, Params{},
|
||||
)
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// get the minter
|
||||
@@ -81,14 +66,13 @@ func (k Keeper) SetMinter(ctx sdk.Context, minter Minter) {
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// get inflation params from the global param store
|
||||
func (k Keeper) GetParams(ctx sdk.Context) Params {
|
||||
var params Params
|
||||
k.paramSpace.Get(ctx, ParamStoreKeyParams, ¶ms)
|
||||
// GetParams returns the total set of slashing parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) (params Params) {
|
||||
k.paramSpace.GetParamSet(ctx, ¶ms)
|
||||
return params
|
||||
}
|
||||
|
||||
// set inflation params from the global param store
|
||||
func (k Keeper) SetParams(ctx sdk.Context, params Params) {
|
||||
k.paramSpace.Set(ctx, ParamStoreKeyParams, ¶ms)
|
||||
k.paramSpace.SetParamSet(ctx, ¶ms)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,17 @@ import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/params"
|
||||
)
|
||||
|
||||
// Parameter store keys
|
||||
var (
|
||||
KeyMintDenom = []byte("MintDenom")
|
||||
KeyInflationRateChange = []byte("InflationRateChange")
|
||||
KeyInflationMax = []byte("InflationMax")
|
||||
KeyInflationMin = []byte("InflationMin")
|
||||
KeyGoalBonded = []byte("GoalBonded")
|
||||
KeyBlocksPerYear = []byte("BlocksPerYear")
|
||||
)
|
||||
|
||||
// mint parameters
|
||||
@@ -16,6 +27,11 @@ type Params struct {
|
||||
BlocksPerYear uint64 `json:"blocks_per_year"` // expected blocks per year
|
||||
}
|
||||
|
||||
// ParamTable for minting module.
|
||||
func ParamKeyTable() params.KeyTable {
|
||||
return params.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
func NewParams(mintDenom string, inflationRateChange, inflationMax,
|
||||
inflationMin, goalBonded sdk.Dec, blocksPerYear uint64) Params {
|
||||
|
||||
@@ -70,3 +86,15 @@ func (p Params) String() string {
|
||||
p.InflationMin, p.GoalBonded, p.BlocksPerYear,
|
||||
)
|
||||
}
|
||||
|
||||
// Implements params.ParamSet
|
||||
func (p *Params) ParamSetPairs() params.ParamSetPairs {
|
||||
return params.ParamSetPairs{
|
||||
{KeyMintDenom, &p.MintDenom},
|
||||
{KeyInflationRateChange, &p.InflationRateChange},
|
||||
{KeyInflationMax, &p.InflationMax},
|
||||
{KeyInflationMin, &p.InflationMin},
|
||||
{KeyGoalBonded, &p.GoalBonded},
|
||||
{KeyBlocksPerYear, &p.BlocksPerYear},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user