* generate proto files * wip * wip: fix tests * wip: add tests * fix tests * fix tests * add changelog * address review comments * address review comments * add err check for setparams * updates Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
31 lines
700 B
Go
31 lines
700 B
Go
package keeper
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
)
|
|
|
|
// SetParams sets the auth module's parameters.
|
|
func (ak AccountKeeper) SetParams(ctx sdk.Context, params types.Params) error {
|
|
if err := params.Validate(); err != nil {
|
|
return err
|
|
}
|
|
|
|
store := ctx.KVStore(ak.storeKey)
|
|
bz := ak.cdc.MustMarshal(¶ms)
|
|
store.Set(types.ParamsKey, bz)
|
|
|
|
return nil
|
|
}
|
|
|
|
// GetParams gets the auth module's parameters.
|
|
func (ak AccountKeeper) GetParams(ctx sdk.Context) (params types.Params) {
|
|
store := ctx.KVStore(ak.storeKey)
|
|
bz := store.Get(types.ParamsKey)
|
|
if bz == nil {
|
|
return params
|
|
}
|
|
ak.cdc.MustUnmarshal(bz, ¶ms)
|
|
return params
|
|
}
|