-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate.go
36 lines (32 loc) · 1.22 KB
/
migrate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package v0_11
import "github.com/furyaxyz/fuxchain/x/staking/legacy/v0_10"
func Migrate(oldGenState v0_10.GenesisState) GenesisState {
params := Params{
UnbondingTime: oldGenState.Params.UnbondingTime,
MaxValidators: oldGenState.Params.MaxValidators,
Epoch: oldGenState.Params.Epoch,
MaxValsToAddShares: oldGenState.Params.MaxValsToVote,
BondDenom: oldGenState.Params.BondDenom,
MinDelegation: oldGenState.Params.MinDelegation,
MinSelfDelegation: DefaultMinSelfDelegation,
}
allShares := make([]SharesExported, len(oldGenState.Votes))
for i, vote := range oldGenState.Votes {
allShares[i] = SharesExported{
DelAddress: vote.VoterAddress,
ValidatorAddress: vote.ValidatorAddress,
Shares: vote.Votes,
}
}
return GenesisState{
Params: params,
LastTotalPower: oldGenState.LastTotalPower,
LastValidatorPowers: oldGenState.LastValidatorPowers,
Validators: oldGenState.Validators,
Delegators: oldGenState.Delegators,
UnbondingDelegations: oldGenState.UnbondingDelegations,
AllShares: allShares,
ProxyDelegatorKeys: oldGenState.ProxyDelegatorKeys,
Exported: oldGenState.Exported,
}
}