diff --git a/x/dex/keeper/keeper.go b/x/dex/keeper/keeper.go index d2098dce5e..bafe4bb76f 100644 --- a/x/dex/keeper/keeper.go +++ b/x/dex/keeper/keeper.go @@ -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 @@ -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{}, @@ -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{}, diff --git a/x/dex/keeper/params.go b/x/dex/keeper/params.go index 30087a9987..1307033d44 100644 --- a/x/dex/keeper/params.go +++ b/x/dex/keeper/params.go @@ -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, ¶ms) + k.Paramstore.GetParamSet(ctx, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) + k.Paramstore.SetParamSet(ctx, ¶ms) } diff --git a/x/dex/migrations/v3_to_v4.go b/x/dex/migrations/v3_to_v4.go new file mode 100644 index 0000000000..19976d7115 --- /dev/null +++ b/x/dex/migrations/v3_to_v4.go @@ -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 +} diff --git a/x/dex/module.go b/x/dex/module.go index bfd4793877..f7e4a7c95e 100644 --- a/x/dex/module.go +++ b/x/dex/module.go @@ -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. @@ -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)