github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/distribution/legacy/v0_36/migrate.go (about) 1 package v0_36 2 3 import ( 4 v034distr "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/distribution/legacy/v0_34" 5 ) 6 7 // Migrate accepts exported genesis state from v0.34 and migrates it to v0.36 8 // genesis state. All entries are identical except for validator slashing events 9 // which now include the period. 10 func Migrate(oldGenState v034distr.GenesisState) GenesisState { 11 // migrate slash events which now have the period included 12 slashEvents := make([]ValidatorSlashEventRecord, len(oldGenState.ValidatorSlashEvents)) 13 for i, se := range oldGenState.ValidatorSlashEvents { 14 slashEvents[i] = ValidatorSlashEventRecord{ 15 ValidatorAddress: se.ValidatorAddress, 16 Height: se.Height, 17 Period: se.Event.ValidatorPeriod, 18 Event: se.Event, 19 } 20 } 21 22 return NewGenesisState( 23 oldGenState.FeePool, oldGenState.CommunityTax, oldGenState.BaseProposerReward, 24 oldGenState.BonusProposerReward, oldGenState.WithdrawAddrEnabled, 25 oldGenState.DelegatorWithdrawInfos, oldGenState.PreviousProposer, 26 oldGenState.OutstandingRewards, oldGenState.ValidatorAccumulatedCommissions, 27 oldGenState.ValidatorHistoricalRewards, oldGenState.ValidatorCurrentRewards, 28 oldGenState.DelegatorStartingInfos, slashEvents, 29 ) 30 }