github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/migrations/v3/json.go (about) 1 package v3 2 3 import ( 4 v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" 5 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" 6 ) 7 8 // MigrateJSON accepts exported v2 (v0.43) x/gov genesis state and migrates it to 9 // v3 (V0.46) x/gov genesis state. The migration includes: 10 // 11 // - Updating everything to v1. 12 // - Migrating proposals to be Msg-based. 13 func MigrateJSON(oldState *v1beta1.GenesisState) (*v1.GenesisState, error) { 14 newProps, err := convertToNewProposals(oldState.Proposals) 15 if err != nil { 16 return nil, err 17 } 18 newVotes, err := convertToNewVotes(oldState.Votes) 19 if err != nil { 20 return nil, err 21 } 22 23 depParams, votingParms, tallyParams := convertToNewDepParams(oldState.DepositParams), convertToNewVotingParams(oldState.VotingParams), convertToNewTallyParams(oldState.TallyParams) 24 25 return &v1.GenesisState{ 26 StartingProposalId: oldState.StartingProposalId, 27 Deposits: convertToNewDeposits(oldState.Deposits), 28 Votes: newVotes, 29 Proposals: newProps, 30 DepositParams: &depParams, 31 VotingParams: &votingParms, 32 TallyParams: &tallyParams, 33 }, nil 34 }