v14

package
v15.0.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const UpgradeName = "v15-slinky"

Variables

View Source
var Upgrade = upgrades.Upgrade{
	UpgradeName: UpgradeName,
	CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator, keepers keepers.StargazeKeepers) upgradetypes.UpgradeHandler {
		return func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
			migrations, err := mm.RunMigrations(ctx, cfg, fromVM)
			if err != nil {
				return nil, err
			}

			consensusParams, err := keepers.ConsensusParamsKeeper.Params(ctx, nil)
			if err != nil {
				return nil, err
			}
			wctx := sdk.UnwrapSDKContext(ctx)
			consensusParams.Params.Abci = &cmttypes.ABCIParams{
				VoteExtensionsEnableHeight: wctx.BlockHeight() + int64(10),
			}

			_, err = keepers.ConsensusParamsKeeper.UpdateParams(ctx, &consensustypes.MsgUpdateParams{
				Authority: keepers.ConsensusParamsKeeper.GetAuthority(),
				Block:     consensusParams.Params.Block,
				Evidence:  consensusParams.Params.Evidence,
				Validator: consensusParams.Params.Validator,
				Abci:      consensusParams.Params.Abci,
			})
			if err != nil {
				return nil, err
			}

			mmParams := marketmaptypes.DefaultParams()

			mmParams.Admin = authtypes.NewModuleAddress(govtypes.ModuleName).String()
			mmParams.MarketAuthorities = []string{"stars1ua63s43u2p4v38pxhcxmps0tj2gudyw2828x65"}
			if err := mmParams.ValidateBasic(); err != nil {
				return nil, err
			}

			if err := keepers.MarketMapKeeper.SetParams(wctx, mmParams); err != nil {
				return nil, err
			}

			m, err := markets.Slice()
			if err != nil {
				return nil, err
			}

			for _, market := range m {

				err = keepers.MarketMapKeeper.CreateMarket(wctx, market)
				if err != nil {
					return nil, err
				}

				err = keepers.MarketMapKeeper.Hooks().AfterMarketCreated(wctx, market)
				if err != nil {
					return nil, err
				}
			}
			return migrations, nil
		}
	},
	StoreUpgrades: storetypes.StoreUpgrades{
		Added: []string{
			marketmaptypes.ModuleName,
			oracletypes.ModuleName,
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL