Skip to content

Commit

Permalink
add setParam method and set the new param in upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Sep 20, 2023
1 parent 8079659 commit 0441ca3
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 7 deletions.
8 changes: 3 additions & 5 deletions app/upgrades/v20/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/osmosis-labs/osmosis/v19/app/keepers"
"github.com/osmosis-labs/osmosis/v19/app/upgrades"
concentratedliquiditytypes "github.com/osmosis-labs/osmosis/v19/x/concentrated-liquidity/types"
cltypes "github.com/osmosis-labs/osmosis/v19/x/concentrated-liquidity/types"
)

func CreateUpgradeHandler(
Expand All @@ -24,10 +24,8 @@ func CreateUpgradeHandler(
return nil, err
}

// TODO START: DO NOT LEAVE THIS AS IS.
// See my comment here https://github.com/osmosis-labs/osmosis/pull/6420#issuecomment-1726969370
keepers.ConcentratedLiquidityKeeper.SetParams(ctx, concentratedliquiditytypes.DefaultParams())
// TODO END
// Initialize the newly created param
keepers.ConcentratedLiquidityKeeper.SetParam(ctx, cltypes.KeyUnrestrictedPoolCreatorWhitelist, []string{})

return migrations, nil
}
Expand Down
5 changes: 5 additions & 0 deletions x/concentrated-liquidity/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific concentrated-liquidity module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

// Set the poolmanager keeper.
func (k *Keeper) SetPoolManagerKeeper(poolmanagerKeeper types.PoolManagerKeeper) {
k.poolmanagerKeeper = poolmanagerKeeper
Expand Down
5 changes: 5 additions & 0 deletions x/cosmwasmpool/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific cosmwasmpool module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

// Set the poolmanager keeper.
func (k *Keeper) SetPoolManagerKeeper(poolmanagerKeeper types.PoolManagerKeeper) {
k.poolmanagerKeeper = poolmanagerKeeper
Expand Down
5 changes: 5 additions & 0 deletions x/gamm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func (k Keeper) setParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific gamm module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

// ValidatePermissionlessPoolCreationEnabled returns nil if permissionless pool creation in the module is enabled.
// Pools in gamm module have permissionless pool creation enabled, thus always return nil.
func (k Keeper) ValidatePermissionlessPoolCreationEnabled(ctx sdk.Context) error {
Expand Down
11 changes: 9 additions & 2 deletions x/ibc-hooks/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"strings"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/cosmos/cosmos-sdk/types/address"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
"github.com/osmosis-labs/osmosis/osmoutils"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/libs/log"
"strings"

"github.com/osmosis-labs/osmosis/osmoutils"

"github.com/osmosis-labs/osmosis/x/ibc-hooks/types"

Expand Down Expand Up @@ -63,6 +65,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific ibc-hooks module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) {
k.SetParams(ctx, genState.Params)
}
Expand Down
5 changes: 5 additions & 0 deletions x/incentives/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific incentives module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}
5 changes: 5 additions & 0 deletions x/lockup/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific lockup module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

func (k Keeper) GetForceUnlockAllowedAddresses(ctx sdk.Context) (forceUnlockAllowedAddresses []string) {
return k.GetParams(ctx).ForceUnlockAllowedAddresses
}
Expand Down
5 changes: 5 additions & 0 deletions x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific mint module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

// DistributeMintedCoin implements distribution of a minted coin from mint to external modules.
func (k Keeper) DistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) error {
params := k.GetParams(ctx)
Expand Down
5 changes: 5 additions & 0 deletions x/pool-incentives/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific pool-incentives module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}
5 changes: 5 additions & 0 deletions x/poolmanager/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific poolmanger module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

// InitGenesis initializes the poolmanager module's state from a provided genesis
// state.
func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
Expand Down
5 changes: 5 additions & 0 deletions x/protorev/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, &params)
}

// SetParam sets a specific protorev module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramstore.Set(ctx, key, value)
}
5 changes: 5 additions & 0 deletions x/superfluid/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ func (k Keeper) GetEpochIdentifier(ctx sdk.Context) (epochIdentifier string) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific superfluid module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}
5 changes: 5 additions & 0 deletions x/tokenfactory/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific tokenfactory module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}
5 changes: 5 additions & 0 deletions x/twap/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}

// SetParam sets a specific twap module's parameter with the provided parameter.
func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) {
k.paramSpace.Set(ctx, key, value)
}

func (k *Keeper) PruneEpochIdentifier(ctx sdk.Context) string {
return k.GetParams(ctx).PruneEpochIdentifier
}
Expand Down

0 comments on commit 0441ca3

Please sign in to comment.