github.com/cosmos/cosmos-sdk@v0.50.10/x/crisis/keeper/migrator.go (about)

     1  package keeper
     2  
     3  import (
     4  	sdk "github.com/cosmos/cosmos-sdk/types"
     5  	"github.com/cosmos/cosmos-sdk/x/crisis/exported"
     6  	v2 "github.com/cosmos/cosmos-sdk/x/crisis/migrations/v2"
     7  )
     8  
     9  // Migrator is a struct for handling in-place state migrations.
    10  type Migrator struct {
    11  	keeper         *Keeper
    12  	legacySubspace exported.Subspace
    13  }
    14  
    15  // NewMigrator returns a new Migrator.
    16  func NewMigrator(k *Keeper, ss exported.Subspace) Migrator {
    17  	return Migrator{
    18  		keeper:         k,
    19  		legacySubspace: ss,
    20  	}
    21  }
    22  
    23  // Migrate1to2 migrates the x/crisis module state from the consensus version 1 to
    24  // version 2. Specifically, it takes the parameters that are currently stored
    25  // and managed by the x/params modules and stores them directly into the x/crisis
    26  // module state.
    27  func (m Migrator) Migrate1to2(ctx sdk.Context) error {
    28  	return v2.MigrateStore(ctx, m.keeper.storeService, m.legacySubspace, m.keeper.cdc)
    29  }