github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/migrations/v4/json.go (about)

     1  package v4
     2  
     3  import (
     4  	v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
     5  )
     6  
     7  // MigrateJSON accepts exported v3 (v0.46) x/gov genesis state and migrates it to
     8  // v4 (v0.47) x/gov genesis state. The migration includes:
     9  //
    10  // Params migrations from x/params to gov
    11  // Addition of the new min initial deposit ratio parameter that is set to 0 by default.
    12  // Proposals in voting period are tracked in a separate index.
    13  func MigrateJSON(oldState *v1.GenesisState) (*v1.GenesisState, error) {
    14  	defaultParams := v1.DefaultParams()
    15  
    16  	params := v1.NewParams(
    17  		oldState.DepositParams.MinDeposit,
    18  		defaultParams.ExpeditedMinDeposit,
    19  		*oldState.DepositParams.MaxDepositPeriod,
    20  		*oldState.VotingParams.VotingPeriod,
    21  		*defaultParams.ExpeditedVotingPeriod,
    22  		oldState.TallyParams.Quorum,
    23  		oldState.TallyParams.Threshold,
    24  		defaultParams.ExpeditedThreshold,
    25  		oldState.TallyParams.VetoThreshold,
    26  		defaultParams.MinInitialDepositRatio,
    27  		defaultParams.ProposalCancelRatio,
    28  		defaultParams.ProposalCancelDest,
    29  		defaultParams.BurnProposalDepositPrevote,
    30  		defaultParams.BurnVoteQuorum,
    31  		defaultParams.BurnVoteVeto,
    32  		defaultParams.MinDepositRatio,
    33  	)
    34  
    35  	return &v1.GenesisState{
    36  		StartingProposalId: oldState.StartingProposalId,
    37  		Deposits:           oldState.Deposits,
    38  		Votes:              oldState.Votes,
    39  		Proposals:          oldState.Proposals,
    40  		Params:             &params,
    41  	}, nil
    42  }