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

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