-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add one year to all periodic accounts that have not started yet
- Loading branch information
Yaroms
committed
Dec 4, 2024
1 parent
c57c9f8
commit 18c395b
Showing
4 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package upgrades | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
"github.com/lavanet/lava/v4/app/keepers" | ||
) | ||
|
||
func v_4_2_0( | ||
m *module.Manager, | ||
c module.Configurator, | ||
_ BaseAppParamManager, | ||
lk *keepers.LavaKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
accounts := lk.AccountKeeper.GetAllAccounts(ctx) | ||
year := int64(12 * 30 * 24 * 60 * 60) | ||
for _, account := range accounts { | ||
if vaccount, ok := account.(*authtypes.PeriodicVestingAccount); ok { | ||
if vaccount.StartTime > ctx.BlockTime().Unix() { | ||
vaccount.StartTime += year | ||
vaccount.EndTime += year | ||
lk.AccountKeeper.SetAccount(ctx, vaccount) | ||
} | ||
} | ||
} | ||
|
||
return m.RunMigrations(ctx, c, vm) | ||
} | ||
} |