github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/params/spec/01_keeper.md (about)

     1  <!--
     2  order: 1
     3  -->
     4  
     5  # Keeper
     6  
     7  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.  
     8  
     9  Example:
    10  
    11  ```go
    12  type MasterKeeper struct {
    13  	pk params.Keeper
    14  }
    15  
    16  func (k MasterKeeper) SetParam(ctx sdk.Context, space string, key string, param interface{}) {
    17  	space, ok := k.ps.GetSubspace(space)
    18  	if !ok {
    19  		return
    20  	}
    21  	space.Set(ctx, key, param)
    22  }
    23  ```