Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions x/dex/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type (
Cdc codec.BinaryCodec
storeKey sdk.StoreKey
memKey sdk.StoreKey
paramstore paramtypes.Subspace
Paramstore paramtypes.Subspace
Orders map[string]map[string]*dexcache.Orders
EpochKeeper epochkeeper.Keeper
OrderPlacements map[string]map[string]*dexcache.OrderPlacements
Expand All @@ -46,7 +46,7 @@ func NewPlainKeeper(
Cdc: cdc,
storeKey: storeKey,
memKey: memKey,
paramstore: ps,
Paramstore: ps,
Orders: map[string]map[string]*dexcache.Orders{},
OrderPlacements: map[string]map[string]*dexcache.OrderPlacements{},
DepositInfo: map[string]*dexcache.DepositInfo{},
Expand All @@ -72,7 +72,7 @@ func NewKeeper(
Cdc: cdc,
storeKey: storeKey,
memKey: memKey,
paramstore: ps,
Paramstore: ps,
Orders: map[string]map[string]*dexcache.Orders{},
EpochKeeper: epochKeeper,
OrderPlacements: map[string]map[string]*dexcache.OrderPlacements{},
Expand Down
4 changes: 2 additions & 2 deletions x/dex/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
params := types.Params{}
k.paramstore.GetParamSet(ctx, &params)
k.Paramstore.GetParamSet(ctx, &params)
return params
}

// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, &params)
k.Paramstore.SetParamSet(ctx, &params)
}
20 changes: 20 additions & 0 deletions x/dex/migrations/v3_to_v4.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package migrations

import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/sei-protocol/sei-chain/x/dex/types"
)

func PriceSnapshotUpdate(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec, paramStore paramtypes.Subspace) error {
return nil
}

func migratePriceSnapshotParam(ctx sdk.Context, paramStore paramtypes.Subspace) error {
defaultParams := types.Params{
PriceSnapshotRetention: types.DefaultPriceSnapshotRetention,
}
paramStore.SetParamSet(ctx, &defaultParams)
return nil
}
5 changes: 4 additions & 1 deletion x/dex/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
cfg.RegisterMigration(types.ModuleName, 2, func(ctx sdk.Context) error {
return migrations.DataTypeUpdate(ctx, am.keeper.GetStoreKey(), am.keeper.Cdc)
})
cfg.RegisterMigration(types.ModuleName, 3, func(ctx sdk.Context) error {
return migrations.PriceSnapshotUpdate(ctx, am.keeper.GetStoreKey(), am.keeper.Cdc, am.keeper.Paramstore)
})
}

// RegisterInvariants registers the capability module's invariants.
Expand All @@ -182,7 +185,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 3 }
func (AppModule) ConsensusVersion() uint64 { return 4 }

func (am AppModule) getAllContractAddresses(ctx sdk.Context) []string {
return am.keeper.GetAllContractAddresses(ctx)
Expand Down