Keeper
In the app initialization stage, Keeper.Subspace(Paramspace)
is passed to the user modules, and the subspaces are stored in Keeper.spaces
. Later it can be retrieved with Keeper.GetSubspace
, so the keepers holding Keeper
can access to any subspace. For example, Gov module can take Keeper
as its argument and modify parameter of any subspace when a ParameterChangeProposal
is accepted.
Example:
type MasterKeeper struct {
pk params.Keeper
}
func (k MasterKeeper) SetParam(ctx sdk.Context, space string, key string, param interface{}) {
space, ok := k.ps.GetSubspace(space)
if !ok {
return
}
space.Set(ctx, key, param)
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11