Skip to content

Commit

Permalink
rm upgrade handler and move migration helpers from app/upgrades to x/…
Browse files Browse the repository at this point in the history
…staking
  • Loading branch information
riley-stride committed Jul 13, 2023
1 parent 40b8762 commit eec7bca
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 92 deletions.
15 changes: 0 additions & 15 deletions app/upgrades/v11/constants.go

This file was deleted.

77 changes: 0 additions & 77 deletions app/upgrades/v11/upgrades.go

This file was deleted.

39 changes: 39 additions & 0 deletions x/staking/legacy/v045/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package v11

import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
)

// Set initial param values, based on https://github.com/iqlusioninc/liquidity-staking-module/blob/master/x/staking/spec/08_params.md
func SetParamsStaking(ctx sdk.Context, k stakingkeeper.Keeper) {
params := k.GetParams(ctx)

params.ValidatorBondFactor = sdk.Dec(sdk.NewInt(250))
params.GlobalLiquidStakingCap = sdk.Dec(sdk.NewInt(25).Quo(sdk.NewInt(100)))
params.ValidatorLiquidStakingCap = sdk.Dec(sdk.NewInt(50).Quo(sdk.NewInt(100)))

k.SetParams(ctx, params)
}

// Set each validator's TotalValidatorBondShares and TotalLiquidShares to 0
func SetAllValidatorBondAndLiquidSharesToZero(ctx sdk.Context, k stakingkeeper.Keeper) {

for _, Val := range k.GetAllValidators(ctx) {

Val.TotalValidatorBondShares = sdk.ZeroDec()
Val.TotalLiquidShares = sdk.ZeroDec()

k.SetValidator(ctx, Val)
}
}

// Set each validator's ValidatorBond to false
func SetAllDelegationValidatorBondsFalse(ctx sdk.Context, k stakingkeeper.Keeper) {
for _, Del := range k.GetAllDelegations(ctx) {

Del.ValidatorBond = false

k.SetDelegation(ctx, Del)
}
}
File renamed without changes.

0 comments on commit eec7bca

Please sign in to comment.