From 4946d28de79fb57e3bcd35b4ca46f0c37fb8ee2f Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Tue, 27 Jun 2023 19:23:19 -0500 Subject: [PATCH 01/27] Major WIP - still just messing about --- app/upgrades/v16/upgrades.go | 38 ++++++ app/upgrades/vesting.go | 245 +++++++++++++++++++++++++++++++++++ 2 files changed, 283 insertions(+) create mode 100644 app/upgrades/vesting.go diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index fa7ddbeb5..b0e9d41ce 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -30,6 +31,7 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" + // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -37,6 +39,13 @@ import ( tokenfactorytypes "github.com/CosmosContracts/juno/v16/x/tokenfactory/types" ) +const ( + // TODO: This is my testing local account, not wolfs. need list from Core-1. + WolfsMainnetVestingAccount = "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj" + // TODO: Replace with the DAO addr + Core1SubDAOAddress = "juno1reece3m8g4m3d0qrpj93rnnseudnpzhr0kewyl" +) + func CreateV16UpgradeHandler( mm *module.Manager, cfg module.Configurator, @@ -144,6 +153,35 @@ func CreateV16UpgradeHandler( return nil, err } + if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { + return nil, err + } + return nil, fmt.Errorf("not implemented") + return versionMap, err } } + +func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { + + addr := sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount) + + // TODO: chain id check for juno-1 only. + coin, _ := upgrades.MoveVestingCoinFromVestingAccount(ctx, + addr, + keepers, + Core1SubDAOAddress, + bondDenom, + ) + + // return error + return fmt.Errorf("vesting account %s has %v coins", WolfsMainnetVestingAccount, coin) + + // fmt.Printf("Vesting account %s has %s\n", WolfsMainnetVestingAccount, coin.String()) + + // if coin.IsZero() { + // return fmt.Errorf("vesting account %s has no coins", WolfsMainnetVestingAccount) + // } + + // return nil +} diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go new file mode 100644 index 000000000..9177e0f12 --- /dev/null +++ b/app/upgrades/vesting.go @@ -0,0 +1,245 @@ +package upgrades + +import ( + "fmt" + "time" + + "github.com/CosmosContracts/juno/v16/app/keepers" + sdk "github.com/cosmos/cosmos-sdk/types" + + authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" +) + +func undelegate(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, vacc *authvestingtypes.ContinuousVestingAccount) error { + // Unbond all delegations from the account + delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) + + for _, delegation := range delegations { + validatorValAddr := delegation.GetValidatorAddr() + _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) + if !found { + continue + } + + // fmt.Printf("delegation: %s\n", delegation) + // fmt.Printf("validatorValAddr: %s\n", validatorValAddr) + + // vacc.TrackUndelegation(vacc.DelegatedVesting) ?? + time, err := (*keepers.StakingKeeper).Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) + if err != nil { + return err + } + fmt.Printf("time: %s and err:%v\n", time, err) + } + + unbonding := keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) + // fmt.Printf("unbonding: %s\n", unbonding) + + for _, unbondingDelegation := range unbonding { + validatorStringAddr := unbondingDelegation.ValidatorAddress + validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) + + // Complete unbonding delegation + for i := range unbondingDelegation.Entries { + unbondingDelegation.Entries[i].CompletionTime = now + } + + keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) + _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) + if err != nil { + return err + } + } + + // check there are no more delegations. + delegations = keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) + if len(delegations) > 0 { + panic("delegations not empty") + } + + return nil +} + +func checkLockedCoins(vacc *authvestingtypes.ContinuousVestingAccount, now time.Time) sdk.Coins { + locked := vacc.LockedCoins(now) + locakedVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) + fmt.Printf("locked: %v\n", locked) + fmt.Printf("locakedVesting: %v\n", locakedVesting) + return locked +} + +// Undelegates all tokens, and send it back to the core1 subdao address for the vesting contract to instantiate +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) (sdk.Coin, error) { + var err error + + now := ctx.BlockHeader().Time + + stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) + vacc, ok := stdAcc.(*authvestingtypes.ContinuousVestingAccount) + if !ok { + panic("not a ContinuousVestingAccount vesting account") + } + + // should show numbers + l := checkLockedCoins(vacc, now) + fmt.Printf("l: %v\n", l) + + // set end time to now to unlock. + vacc.EndTime = now.Unix() - 1_000_000 + vacc.BaseVestingAccount.EndTime = now.Unix() - 1_000_000 + // vacc.DelegatedFree = sdk.NewCoins() + // vacc.DelegatedVesting = sdk.NewCoins() + // vacc.OriginalVesting = sdk.NewCoins() + // vacc.BaseVestingAccount.DelegatedFree = sdk.NewCoins() + // vacc.BaseVestingAccount.DelegatedVesting = sdk.NewCoins() + // vacc.BaseVestingAccount.OriginalVesting = sdk.NewCoins() + + // Nothing shown here. + checkLockedCoins(vacc, now) + + // undelegate all. + if err := undelegate(ctx, now, keepers, accAddr, vacc); err != nil { + return sdk.Coin{}, err + } + + bal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + fmt.Printf("Balance: %s\n", bal) + if err := keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, distrtypes.ModuleName, sdk.NewCoins(bal)); err != nil { + return sdk.Coin{}, err + } + + // get distrtypes.ModuleName balance + distrtypesModuleBalance := keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(distrtypes.ModuleName), bondDenom) + fmt.Printf("distrtypesModuleBalance: %v\n", distrtypesModuleBalance) + + // update vacc to be entirely spendable + // vacc.DelegatedFree = sdk.NewCoins(bal) + // vacc.BaseVestingAccount.DelegatedFree = sdk.NewCoins(bal) + + fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) + + // send funds since they are unlocked. + // spendable balance here is nil. + fmt.Print("sending\n", keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom)) + if err := keepers.BankKeeper.SendCoins(ctx, accAddr, sdk.AccAddress(core1SubDaoAddress), sdk.NewCoins(bal)); err != nil { + return sdk.Coin{}, err + } + + fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) + + core1Bal := keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(core1SubDaoAddress), bondDenom) + fmt.Printf("core1Bal: %v\n", core1Bal) + + return sdk.Coin{}, fmt.Errorf("not implemented") + + // undelegates + undelegateAmount := vacc.DelegatedVesting.AmountOf(bondDenom) + fmt.Printf("DelegatedVesting before: %v\n", undelegateAmount) + vacc.TrackUndelegation(vacc.DelegatedVesting) + fmt.Printf("DelegatedVesting after: %v\n", vacc.DelegatedVesting) + + vacc.BaseVestingAccount.EndTime = now.Unix() - 1 + + stdbal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + fmt.Printf("stdbal before: %v\n", stdbal) + + if err := keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, distrtypes.ModuleName, sdk.NewCoins(stdbal)); err != nil { + panic(err) + } + + // then transfer that to core 1 fgrom ModuleToAccount + if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, distrtypes.ModuleName, sdk.AccAddress(core1SubDaoAddress), sdk.NewCoins(stdbal)); err != nil { + panic(err) + } + + // TODO: vesting + + // get current held balance from stdAcc + stdbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + fmt.Printf("stdbal after: %v\n", stdbal) + + // get balance of core1 (needs to be the original vesting ammount) + core1Bal = keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(core1SubDaoAddress), bondDenom) + fmt.Printf("core1Bal: %v\n", core1Bal) + + // print out vacc + fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) + + return core1Bal, nil + // return sdk.Coin{}, fmt.Errorf("not implemented") + + // // get balance of accAddr + // bal := (&keepers.BankKeeper).GetBalance(ctx, accAddr, bondDenom) + // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", bal) + // // account info + // accInfo := (&keepers.AccountKeeper).GetAccount(ctx, accAddr) + // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", accInfo) + // for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { + // validatorValAddr := delegation.GetValidatorAddr() + // _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) + // if !found { + // continue + // } + // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", delegation) + // // _, err := keepers.StakingKeeper.Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) + // // if err != nil { + // // panic(err) + // // } + // } + // return sdk.Coin{}, fmt.Errorf("not implemented") + + // TODO: Is this needed? + // Complete any active re-delegations + // for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { + // redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) + // redelegationDst, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorDstAddress) + + // // set all entry completionTime to now so we can complete redelegation + // for i := range activeRedelegation.Entries { + // activeRedelegation.Entries[i].CompletionTime = now + // } + + // keepers.StakingKeeper.SetRedelegation(ctx, activeRedelegation) + // _, err := keepers.StakingKeeper.CompleteRedelegation(ctx, accAddr, redelegationSrc, redelegationDst) + // if err != nil { + // panic(err) + // } + // } + + // Complete all delegator's unbonding delegations + for _, unbondingDelegation := range keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) { + validatorStringAddr := unbondingDelegation.ValidatorAddress + validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) + + // Complete unbonding delegation + for i := range unbondingDelegation.Entries { + unbondingDelegation.Entries[i].CompletionTime = now + } + keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) + _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) + if err != nil { + panic(err) + } + } + + // account balance after finishing unbonding + accCoin := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + + vacc.OriginalVesting = vacc.OriginalVesting.Add(accCoin) + + // make entire balance spendable + // keepers.AccountKeeper.SetAccount(ctx, ) + + // Send coin to Core-1 subDao for holding on behalf of the core-1 members + destAcc, _ := sdk.AccAddressFromBech32(core1SubDaoAddress) + err = keepers.BankKeeper.SendCoins(ctx, accAddr, destAcc, sdk.NewCoins(accCoin)) + if err != nil { + panic(err) + } + + ctx.Logger().Info("MoveVestingCoinFromVestingAccount", "account", accAddr.String(), "amount", accCoin) + + // return accCoin, nil + return accCoin, fmt.Errorf("not implemented") +} From 279246ab948aeba3aac821bcefbad0856a6004e2 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 18:08:59 -0500 Subject: [PATCH 02/27] Clean up migration vesting massively, actually works now --- app/upgrades/v16/upgrades.go | 14 +-- app/upgrades/vesting.go | 180 ++++++----------------------------- 2 files changed, 32 insertions(+), 162 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index b0e9d41ce..efb3c0a6c 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -156,7 +156,6 @@ func CreateV16UpgradeHandler( if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { return nil, err } - return nil, fmt.Errorf("not implemented") return versionMap, err } @@ -167,7 +166,7 @@ func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *kee addr := sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount) // TODO: chain id check for juno-1 only. - coin, _ := upgrades.MoveVestingCoinFromVestingAccount(ctx, + upgrades.MoveVestingCoinFromVestingAccount(ctx, addr, keepers, Core1SubDAOAddress, @@ -175,13 +174,6 @@ func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *kee ) // return error - return fmt.Errorf("vesting account %s has %v coins", WolfsMainnetVestingAccount, coin) - - // fmt.Printf("Vesting account %s has %s\n", WolfsMainnetVestingAccount, coin.String()) - - // if coin.IsZero() { - // return fmt.Errorf("vesting account %s has no coins", WolfsMainnetVestingAccount) - // } - - // return nil + // return fmt.Errorf("completed remove wolf logic,") + return nil } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 9177e0f12..e424be76e 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) +// TODO: Redelegations check as well. func undelegate(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, vacc *authvestingtypes.ContinuousVestingAccount) error { // Unbond all delegations from the account delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) @@ -63,18 +63,20 @@ func undelegate(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, acc func checkLockedCoins(vacc *authvestingtypes.ContinuousVestingAccount, now time.Time) sdk.Coins { locked := vacc.LockedCoins(now) - locakedVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) + lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) fmt.Printf("locked: %v\n", locked) - fmt.Printf("locakedVesting: %v\n", locakedVesting) + fmt.Printf("lockedVesting: %v\n", lockedFromVesting) return locked } -// Undelegates all tokens, and send it back to the core1 subdao address for the vesting contract to instantiate +// Stops a vesting account and returns all tokens back to the Core-1 subdao. func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) (sdk.Coin, error) { - var err error + // var err error now := ctx.BlockHeader().Time + core1AccAddr := sdk.MustAccAddressFromBech32(core1SubDaoAddress) + stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) vacc, ok := stdAcc.(*authvestingtypes.ContinuousVestingAccount) if !ok { @@ -85,161 +87,37 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, l := checkLockedCoins(vacc, now) fmt.Printf("l: %v\n", l) - // set end time to now to unlock. - vacc.EndTime = now.Unix() - 1_000_000 - vacc.BaseVestingAccount.EndTime = now.Unix() - 1_000_000 - // vacc.DelegatedFree = sdk.NewCoins() - // vacc.DelegatedVesting = sdk.NewCoins() - // vacc.OriginalVesting = sdk.NewCoins() - // vacc.BaseVestingAccount.DelegatedFree = sdk.NewCoins() - // vacc.BaseVestingAccount.DelegatedVesting = sdk.NewCoins() - // vacc.BaseVestingAccount.OriginalVesting = sdk.NewCoins() - - // Nothing shown here. - checkLockedCoins(vacc, now) + // Finish vesting period now. + vacc.EndTime = 1 + vacc.BaseVestingAccount.EndTime = 1 + keepers.AccountKeeper.SetAccount(ctx, vacc) - // undelegate all. + // Instant unbond all tokens, goes into balance. if err := undelegate(ctx, now, keepers, accAddr, vacc); err != nil { return sdk.Coin{}, err } - bal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - fmt.Printf("Balance: %s\n", bal) - if err := keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, distrtypes.ModuleName, sdk.NewCoins(bal)); err != nil { - return sdk.Coin{}, err - } - - // get distrtypes.ModuleName balance - distrtypesModuleBalance := keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(distrtypes.ModuleName), bondDenom) - fmt.Printf("distrtypesModuleBalance: %v\n", distrtypesModuleBalance) - - // update vacc to be entirely spendable - // vacc.DelegatedFree = sdk.NewCoins(bal) - // vacc.BaseVestingAccount.DelegatedFree = sdk.NewCoins(bal) - - fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) - - // send funds since they are unlocked. - // spendable balance here is nil. - fmt.Print("sending\n", keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom)) - if err := keepers.BankKeeper.SendCoins(ctx, accAddr, sdk.AccAddress(core1SubDaoAddress), sdk.NewCoins(bal)); err != nil { - return sdk.Coin{}, err - } - - fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) - - core1Bal := keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(core1SubDaoAddress), bondDenom) - fmt.Printf("core1Bal: %v\n", core1Bal) - - return sdk.Coin{}, fmt.Errorf("not implemented") - - // undelegates - undelegateAmount := vacc.DelegatedVesting.AmountOf(bondDenom) - fmt.Printf("DelegatedVesting before: %v\n", undelegateAmount) - vacc.TrackUndelegation(vacc.DelegatedVesting) - fmt.Printf("DelegatedVesting after: %v\n", vacc.DelegatedVesting) - - vacc.BaseVestingAccount.EndTime = now.Unix() - 1 - - stdbal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - fmt.Printf("stdbal before: %v\n", stdbal) - - if err := keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, distrtypes.ModuleName, sdk.NewCoins(stdbal)); err != nil { - panic(err) - } - - // then transfer that to core 1 fgrom ModuleToAccount - if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, distrtypes.ModuleName, sdk.AccAddress(core1SubDaoAddress), sdk.NewCoins(stdbal)); err != nil { - panic(err) - } + // Get balance + accbal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + fmt.Printf("bal: %v\n", accbal) - // TODO: vesting - - // get current held balance from stdAcc - stdbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - fmt.Printf("stdbal after: %v\n", stdbal) - - // get balance of core1 (needs to be the original vesting ammount) - core1Bal = keepers.BankKeeper.GetBalance(ctx, sdk.AccAddress(core1SubDaoAddress), bondDenom) - fmt.Printf("core1Bal: %v\n", core1Bal) - - // print out vacc - fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", vacc) - - return core1Bal, nil - // return sdk.Coin{}, fmt.Errorf("not implemented") - - // // get balance of accAddr - // bal := (&keepers.BankKeeper).GetBalance(ctx, accAddr, bondDenom) - // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", bal) - // // account info - // accInfo := (&keepers.AccountKeeper).GetAccount(ctx, accAddr) - // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", accInfo) - // for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { - // validatorValAddr := delegation.GetValidatorAddr() - // _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) - // if !found { - // continue - // } - // fmt.Printf("MoveVestingCoinFromVestingAccount: %s\n", delegation) - // // _, err := keepers.StakingKeeper.Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) - // // if err != nil { - // // panic(err) - // // } - // } - // return sdk.Coin{}, fmt.Errorf("not implemented") - - // TODO: Is this needed? - // Complete any active re-delegations - // for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { - // redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) - // redelegationDst, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorDstAddress) - - // // set all entry completionTime to now so we can complete redelegation - // for i := range activeRedelegation.Entries { - // activeRedelegation.Entries[i].CompletionTime = now - // } - - // keepers.StakingKeeper.SetRedelegation(ctx, activeRedelegation) - // _, err := keepers.StakingKeeper.CompleteRedelegation(ctx, accAddr, redelegationSrc, redelegationDst) - // if err != nil { - // panic(err) - // } - // } - - // Complete all delegator's unbonding delegations - for _, unbondingDelegation := range keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) { - validatorStringAddr := unbondingDelegation.ValidatorAddress - validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) - - // Complete unbonding delegation - for i := range unbondingDelegation.Entries { - unbondingDelegation.Entries[i].CompletionTime = now - } - keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) - _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) - if err != nil { - panic(err) - } + // Send all tokens from balance to the core-1 subdao address + if e := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, sdk.NewCoins(accbal)); e != nil { + return sdk.Coin{}, fmt.Errorf("error sending coins: %v", e) } - // account balance after finishing unbonding - accCoin := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - - vacc.OriginalVesting = vacc.OriginalVesting.Add(accCoin) + // get bal of core1SubDaoAddress + core1BalC := keepers.BankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(core1SubDaoAddress), bondDenom) + fmt.Printf("core1Bal: %v\n", core1BalC) - // make entire balance spendable - // keepers.AccountKeeper.SetAccount(ctx, ) - - // Send coin to Core-1 subDao for holding on behalf of the core-1 members - destAcc, _ := sdk.AccAddressFromBech32(core1SubDaoAddress) - err = keepers.BankKeeper.SendCoins(ctx, accAddr, destAcc, sdk.NewCoins(accCoin)) - if err != nil { - panic(err) - } + // get balance of accAddr + accbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + fmt.Printf("bal: %v\n", accbal) - ctx.Logger().Info("MoveVestingCoinFromVestingAccount", "account", accAddr.String(), "amount", accCoin) + // TODO: Delete said account? (no reason to have it or the abse account anymore yea? any issues of doing this?) + // if so, do we have to remove all the subAccounts first of the vacc/ + keepers.AccountKeeper.RemoveAccount(ctx, vacc) - // return accCoin, nil - return accCoin, fmt.Errorf("not implemented") + // return sdk.Coin{}, fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") + return sdk.Coin{}, nil } From c7047f1d663f1d60c8e72341b9652c69fb87e7f6 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 18:50:47 -0500 Subject: [PATCH 03/27] Cleanup force undelegate & redelegate logic --- app/upgrades/v16/upgrades.go | 14 +- app/upgrades/vesting.go | 155 +++++++++++---------- x/globalfee/migrations/v2/migrator_test.go | 13 -- 3 files changed, 86 insertions(+), 96 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index efb3c0a6c..258f2b44e 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -42,8 +42,8 @@ import ( const ( // TODO: This is my testing local account, not wolfs. need list from Core-1. WolfsMainnetVestingAccount = "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj" - // TODO: Replace with the DAO addr - Core1SubDAOAddress = "juno1reece3m8g4m3d0qrpj93rnnseudnpzhr0kewyl" + // Core-1 Mainnet Address + Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" ) func CreateV16UpgradeHandler( @@ -153,6 +153,8 @@ func CreateV16UpgradeHandler( return nil, err } + // TODO: Mainnet only + // if ctx.ChainID() == "juno-1" {} if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { return nil, err } @@ -162,18 +164,12 @@ func CreateV16UpgradeHandler( } func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - addr := sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount) - // TODO: chain id check for juno-1 only. - upgrades.MoveVestingCoinFromVestingAccount(ctx, + return upgrades.MoveVestingCoinFromVestingAccount(ctx, addr, keepers, Core1SubDAOAddress, bondDenom, ) - - // return error - // return fmt.Errorf("completed remove wolf logic,") - return nil } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index e424be76e..1885bf72a 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -4,75 +4,14 @@ import ( "fmt" "time" - "github.com/CosmosContracts/juno/v16/app/keepers" sdk "github.com/cosmos/cosmos-sdk/types" - authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" -) -// TODO: Redelegations check as well. -func undelegate(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, vacc *authvestingtypes.ContinuousVestingAccount) error { - // Unbond all delegations from the account - delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) - - for _, delegation := range delegations { - validatorValAddr := delegation.GetValidatorAddr() - _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) - if !found { - continue - } - - // fmt.Printf("delegation: %s\n", delegation) - // fmt.Printf("validatorValAddr: %s\n", validatorValAddr) - - // vacc.TrackUndelegation(vacc.DelegatedVesting) ?? - time, err := (*keepers.StakingKeeper).Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) - if err != nil { - return err - } - fmt.Printf("time: %s and err:%v\n", time, err) - } - - unbonding := keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) - // fmt.Printf("unbonding: %s\n", unbonding) - - for _, unbondingDelegation := range unbonding { - validatorStringAddr := unbondingDelegation.ValidatorAddress - validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) - - // Complete unbonding delegation - for i := range unbondingDelegation.Entries { - unbondingDelegation.Entries[i].CompletionTime = now - } - - keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) - _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) - if err != nil { - return err - } - } - - // check there are no more delegations. - delegations = keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) - if len(delegations) > 0 { - panic("delegations not empty") - } - - return nil -} - -func checkLockedCoins(vacc *authvestingtypes.ContinuousVestingAccount, now time.Time) sdk.Coins { - locked := vacc.LockedCoins(now) - lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) - fmt.Printf("locked: %v\n", locked) - fmt.Printf("lockedVesting: %v\n", lockedFromVesting) - return locked -} + "github.com/CosmosContracts/juno/v16/app/keepers" +) // Stops a vesting account and returns all tokens back to the Core-1 subdao. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) (sdk.Coin, error) { - // var err error - +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) error { now := ctx.BlockHeader().Time core1AccAddr := sdk.MustAccAddressFromBech32(core1SubDaoAddress) @@ -80,21 +19,26 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) vacc, ok := stdAcc.(*authvestingtypes.ContinuousVestingAccount) if !ok { - panic("not a ContinuousVestingAccount vesting account") + return fmt.Errorf("account is not a vesting account") } - // should show numbers - l := checkLockedCoins(vacc, now) - fmt.Printf("l: %v\n", l) + // Shows locked funds + showLockedCoins(vacc, now) // Finish vesting period now. vacc.EndTime = 1 vacc.BaseVestingAccount.EndTime = 1 keepers.AccountKeeper.SetAccount(ctx, vacc) - // Instant unbond all tokens, goes into balance. - if err := undelegate(ctx, now, keepers, accAddr, vacc); err != nil { - return sdk.Coin{}, err + // Set it so any re-delegations are finished. + if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { + return err + } + + // Instant unbond all delegations + // TODO: What about rewards? + if err := unbondAllAndFinish(ctx, now, keepers, accAddr); err != nil { + return err } // Get balance @@ -103,7 +47,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, // Send all tokens from balance to the core-1 subdao address if e := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, sdk.NewCoins(accbal)); e != nil { - return sdk.Coin{}, fmt.Errorf("error sending coins: %v", e) + return fmt.Errorf("error sending coins: %v", e) } // get bal of core1SubDaoAddress @@ -114,10 +58,73 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, accbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) fmt.Printf("bal: %v\n", accbal) - // TODO: Delete said account? (no reason to have it or the abse account anymore yea? any issues of doing this?) + // TODO: Delete said account? (no reason to have it or the base account anymore yea? any issues of doing this?) // if so, do we have to remove all the subAccounts first of the vacc/ keepers.AccountKeeper.RemoveAccount(ctx, vacc) // return sdk.Coin{}, fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") - return sdk.Coin{}, nil + return nil +} + +func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, now time.Time) error { + for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { + redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) + redelegationDst, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorDstAddress) + + // set all entry completionTime to now so we can complete re-delegation + for i := range activeRedelegation.Entries { + activeRedelegation.Entries[i].CompletionTime = now + } + + keepers.StakingKeeper.SetRedelegation(ctx, activeRedelegation) + _, err := keepers.StakingKeeper.CompleteRedelegation(ctx, accAddr, redelegationSrc, redelegationDst) + if err != nil { + return err + } + } + + return nil +} + +func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress) error { + // Unbond all delegations from the account + for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { + validatorValAddr := delegation.GetValidatorAddr() + _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) + if !found { + continue + } + + time, err := keepers.StakingKeeper.Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) + if err != nil { + return err + } + fmt.Printf("time: %s and err:%v\n", time, err) + } + + // Take all unbonding and complete them. + for _, unbondingDelegation := range keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) { + validatorStringAddr := unbondingDelegation.ValidatorAddress + validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) + + // Complete unbonding delegation + for i := range unbondingDelegation.Entries { + unbondingDelegation.Entries[i].CompletionTime = now + } + + keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) + _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) + if err != nil { + return err + } + } + + return nil +} + +func showLockedCoins(vacc *authvestingtypes.ContinuousVestingAccount, now time.Time) { + locked := vacc.LockedCoins(now) + lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) + fmt.Printf("locked: %v\n", locked) + fmt.Printf("lockedVesting: %v\n", lockedFromVesting) } diff --git a/x/globalfee/migrations/v2/migrator_test.go b/x/globalfee/migrations/v2/migrator_test.go index ce0f228e5..c54cd594c 100644 --- a/x/globalfee/migrations/v2/migrator_test.go +++ b/x/globalfee/migrations/v2/migrator_test.go @@ -10,23 +10,10 @@ import ( moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/CosmosContracts/juno/v16/x/globalfee" - "github.com/CosmosContracts/juno/v16/x/globalfee/keeper/exported" v2 "github.com/CosmosContracts/juno/v16/x/globalfee/migrations/v2" "github.com/CosmosContracts/juno/v16/x/globalfee/types" ) -type mockSubspace struct { - ps types.Params -} - -func newMockSubspace(ps types.Params) mockSubspace { - return mockSubspace{ps: ps} -} - -func (ms mockSubspace) GetParamSet(_ sdk.Context, ps exported.ParamSet) { - *ps.(*types.Params) = ms.ps -} - func TestMigrateMainnet(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig(globalfee.AppModuleBasic{}) cdc := encCfg.Codec From d8e94c66fc8a9fa0316c7e6905f67a968a75e41d Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 18:52:45 -0500 Subject: [PATCH 04/27] Only migrate Core1 on juno-1 chainId --- app/upgrades/v16/upgrades.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 258f2b44e..6e885f4d9 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -31,7 +30,6 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" - // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -153,10 +151,11 @@ func CreateV16UpgradeHandler( return nil, err } - // TODO: Mainnet only - // if ctx.ChainID() == "juno-1" {} - if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { - return nil, err + // Migrate Core-1 vesting account remaining funds -> Core-1 + if ctx.ChainID() == "juno-1" { + if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { + return nil, err + } } return versionMap, err From d401f7f1c5488997f62b8234315d0baf1c0dc9bb Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 19:47:03 -0500 Subject: [PATCH 05/27] Fix upgrade test for vesting with ictest --- app/upgrades/vesting.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 1885bf72a..98cb51a49 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -19,7 +19,9 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) vacc, ok := stdAcc.(*authvestingtypes.ContinuousVestingAccount) if !ok { - return fmt.Errorf("account is not a vesting account") + // For e2e testing + fmt.Printf("account " + accAddr.String() + " is not a vesting account\n") + return nil } // Shows locked funds From 03f2aabf04e2c66ce6752387930c24e66f615336 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 00:04:49 -0500 Subject: [PATCH 06/27] Fix upgrade test (due to changed GFee params) --- interchaintest/chain_upgrade_test.go | 9 +++++---- interchaintest/helpers/tokenfactory.go | 8 ++++++-- interchaintest/module_tokenfactory_test.go | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index 6406ea26c..2b3fe6708 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -100,12 +100,12 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeBran chainUser := users[0] // create a tokenfactory denom before upgrade (invalid genesis for hard forking due to x/bank validation) - emptyFullDenom := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "empty") + emptyFullDenom := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "empty", "") - mintedDenom := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "minted") + mintedDenom := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "minted", "") helpers.MintToTokenFactoryDenom(t, ctx, chain, chainUser, chainUser, 100, mintedDenom) - mintedAndModified := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "mandm") + mintedAndModified := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "mandm", "") helpers.MintToTokenFactoryDenom(t, ctx, chain, chainUser, chainUser, 100, mintedAndModified) ticker, desc, exponent := "TICKER", "desc", "6" @@ -222,7 +222,8 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeBran require.Equal(t, postModified, modifiedRes) // Ensure after the upgrade, the denoms are properly set with the Denom Metadata. - afterUpgrade := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "post") + // (Due to migrating hardcoded, we have to set a fee after the upgrade). + afterUpgrade := helpers.CreateTokenFactoryDenom(t, ctx, chain, chainUser, "post", "250000"+Denom) newRes := helpers.GetTokenFactoryDenomMetadata(t, ctx, chain, afterUpgrade) require.Equal(t, newRes.Display, afterUpgrade) require.Equal(t, newRes.Name, afterUpgrade) diff --git a/interchaintest/helpers/tokenfactory.go b/interchaintest/helpers/tokenfactory.go index 3b3871f5d..27f074f92 100644 --- a/interchaintest/helpers/tokenfactory.go +++ b/interchaintest/helpers/tokenfactory.go @@ -23,7 +23,7 @@ func debugOutput(t *testing.T, stdout string) { } } -func CreateTokenFactoryDenom(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, subDenomName string) (fullDenom string) { +func CreateTokenFactoryDenom(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, subDenomName, feeCoin string) (fullDenom string) { // TF gas to create cost 2mil, so we set to 2.5 to be safe cmd := []string{"junod", "tx", "tokenfactory", "create-denom", subDenomName, "--node", chain.GetRPCAddress(), @@ -31,11 +31,15 @@ func CreateTokenFactoryDenom(t *testing.T, ctx context.Context, chain *cosmos.Co "--chain-id", chain.Config().ChainID, "--from", user.KeyName(), "--gas", "2500000", - "--gas-adjustment", "2.0", "--keyring-dir", chain.HomeDir(), "--keyring-backend", keyring.BackendTest, "-y", } + + if feeCoin == "" { + cmd = append(cmd, "--fees", feeCoin) + } + stdout, _, err := chain.Exec(ctx, cmd, nil) require.NoError(t, err) diff --git a/interchaintest/module_tokenfactory_test.go b/interchaintest/module_tokenfactory_test.go index 1525476cd..69d855612 100644 --- a/interchaintest/module_tokenfactory_test.go +++ b/interchaintest/module_tokenfactory_test.go @@ -29,7 +29,7 @@ func TestJunoTokenFactory(t *testing.T) { user2 := users[1] uaddr2 := user2.FormattedAddress() - tfDenom := helpers.CreateTokenFactoryDenom(t, ctx, juno, user, "ictestdenom") + tfDenom := helpers.CreateTokenFactoryDenom(t, ctx, juno, user, "ictestdenom", fmt.Sprintf("0%s", Denom)) t.Log("tfDenom", tfDenom) // mint From 5c4fef563b4631e736e2146b7c7e6a4e806886cc Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 28 Jun 2023 00:21:02 -0500 Subject: [PATCH 07/27] TF: if feeCoin != "", then add the fees --- interchaintest/helpers/tokenfactory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interchaintest/helpers/tokenfactory.go b/interchaintest/helpers/tokenfactory.go index 27f074f92..07e915046 100644 --- a/interchaintest/helpers/tokenfactory.go +++ b/interchaintest/helpers/tokenfactory.go @@ -36,7 +36,7 @@ func CreateTokenFactoryDenom(t *testing.T, ctx context.Context, chain *cosmos.Co "-y", } - if feeCoin == "" { + if feeCoin != "" { cmd = append(cmd, "--fees", feeCoin) } From 182057316b529c0a664b14b384f74e66dcf794af Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 1 Jul 2023 13:11:45 -0500 Subject: [PATCH 08/27] WIP for PeriodicVestingAccount --- app/upgrades/v16/upgrades.go | 2 ++ app/upgrades/vesting.go | 52 ++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 6e885f4d9..5d868a675 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -30,6 +31,7 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" + // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 98cb51a49..ccd3dc39f 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -17,19 +18,37 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, core1AccAddr := sdk.MustAccAddressFromBech32(core1SubDaoAddress) stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) - vacc, ok := stdAcc.(*authvestingtypes.ContinuousVestingAccount) + vacc, ok := stdAcc.(*authvestingtypes.PeriodicVestingAccount) if !ok { // For e2e testing - fmt.Printf("account " + accAddr.String() + " is not a vesting account\n") + fmt.Printf("account " + accAddr.String() + " is not a vesting account. This should not run on mainnet.\n") return nil + // return fmt.Errorf("account " + accAddr.String() + " is not a vesting account") } // Shows locked funds showLockedCoins(vacc, now) + // var expectedCoins sdk.Coin + + // // account balance, vesting amounts + // accBal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) + // vaccBal := vacc.GetVestingCoins(now) + // expectedCoins = expectedCoins.Add(accBal).Add(vaccBal...) + // Finish vesting period now. - vacc.EndTime = 1 - vacc.BaseVestingAccount.EndTime = 1 + vacc.EndTime = 0 + vacc.BaseVestingAccount.EndTime = 0 + + // Since these periods have not yet vested, we are un-vesting and then minting to Core1 for future use. + ujunoAmt := 0 + for i := range vacc.VestingPeriods { + vacc.VestingPeriods[i].Length = 0 + ujunoAmt += int(vacc.VestingPeriods[i].Amount.AmountOf("ujuno").Int64()) + } + vacc.VestingPeriods = nil + vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} + keepers.AccountKeeper.SetAccount(ctx, vacc) // Set it so any re-delegations are finished. @@ -60,9 +79,28 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, accbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) fmt.Printf("bal: %v\n", accbal) + // mint ujunoAmt to core1SubDaoAddress (unvested amounts) + tfrAmt := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(int64(ujunoAmt)))) + if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, tfrAmt); err != nil { + return err + } + // transfer tfrAmt to core1 subdao + if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, core1AccAddr, tfrAmt); err != nil { + return err + } + + // update core1 bal + core1BalC = keepers.BankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(core1SubDaoAddress), bondDenom) + fmt.Printf("core1Bal: %v\n", core1BalC) + + // delete vacc + // keepers.AccountKeeper.RemoveAccount(ctx, vacc) + + return fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") + // TODO: Delete said account? (no reason to have it or the base account anymore yea? any issues of doing this?) // if so, do we have to remove all the subAccounts first of the vacc/ - keepers.AccountKeeper.RemoveAccount(ctx, vacc) + // keepers.AccountKeeper.RemoveAccount(ctx, vacc) // return sdk.Coin{}, fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") return nil @@ -124,9 +162,7 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep return nil } -func showLockedCoins(vacc *authvestingtypes.ContinuousVestingAccount, now time.Time) { - locked := vacc.LockedCoins(now) +func showLockedCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Time) { lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) - fmt.Printf("locked: %v\n", locked) fmt.Printf("lockedVesting: %v\n", lockedFromVesting) } From c3e33b86fc46298e02ffbba0a393583e96f9673a Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 1 Jul 2023 13:34:52 -0500 Subject: [PATCH 09/27] Wip2 --- app/upgrades/vesting.go | 104 +++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index ccd3dc39f..4f782a972 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + "cosmossdk.io/math" minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -11,6 +12,33 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" ) +func getUnVestedCoins(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) sdk.Coins { + var mintAmt math.Int = sdk.ZeroInt() + + for i := range vacc.VestingPeriods { + ujunoAmt := vacc.VestingPeriods[i].Amount.AmountOf(bondDenom) + + mintAmt = mintAmt.Add(ujunoAmt) + } + + return sdk.NewCoins(sdk.NewCoin(bondDenom, mintAmt)) +} + +func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) { + // Finish vesting period now. + vacc.EndTime = 0 + vacc.BaseVestingAccount.EndTime = 0 + + for i := range vacc.VestingPeriods { + vacc.VestingPeriods[i].Length = 0 + } + + vacc.VestingPeriods = nil + vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} + + keepers.AccountKeeper.SetAccount(ctx, vacc) +} + // Stops a vesting account and returns all tokens back to the Core-1 subdao. func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) error { now := ctx.BlockHeader().Time @@ -23,74 +51,46 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, // For e2e testing fmt.Printf("account " + accAddr.String() + " is not a vesting account. This should not run on mainnet.\n") return nil - // return fmt.Errorf("account " + accAddr.String() + " is not a vesting account") } // Shows locked funds showLockedCoins(vacc, now) - // var expectedCoins sdk.Coin - - // // account balance, vesting amounts - // accBal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - // vaccBal := vacc.GetVestingCoins(now) - // expectedCoins = expectedCoins.Add(accBal).Add(vaccBal...) - - // Finish vesting period now. - vacc.EndTime = 0 - vacc.BaseVestingAccount.EndTime = 0 - - // Since these periods have not yet vested, we are un-vesting and then minting to Core1 for future use. - ujunoAmt := 0 - for i := range vacc.VestingPeriods { - vacc.VestingPeriods[i].Length = 0 - ujunoAmt += int(vacc.VestingPeriods[i].Amount.AmountOf("ujuno").Int64()) - } - vacc.VestingPeriods = nil - vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} + // Gets all coins which have not been unlocked yet. + unvestedCoins := getUnVestedCoins(ctx, vacc, keepers, bondDenom) - keepers.AccountKeeper.SetAccount(ctx, vacc) + // Clears the account so all unvested coins are unlocked. + clearVestingAccount(ctx, vacc, keepers, bondDenom) - // Set it so any re-delegations are finished. + // Finish redeleations. if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { return err } // Instant unbond all delegations - // TODO: What about rewards? if err := unbondAllAndFinish(ctx, now, keepers, accAddr); err != nil { return err } - // Get balance - accbal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - fmt.Printf("bal: %v\n", accbal) - - // Send all tokens from balance to the core-1 subdao address - if e := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, sdk.NewCoins(accbal)); e != nil { - return fmt.Errorf("error sending coins: %v", e) + // Moves the accounts held balance to the subDAO (ex: all unbonded tokens). + movedBal, err := migrateBalanceToCore1SubDao(ctx, vacc, keepers, core1AccAddr, bondDenom) + if err != nil { + return err } + fmt.Printf("movedBal: %v\n", movedBal) - // get bal of core1SubDaoAddress - core1BalC := keepers.BankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(core1SubDaoAddress), bondDenom) - fmt.Printf("core1Bal: %v\n", core1BalC) - - // get balance of accAddr - accbal = keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) - fmt.Printf("bal: %v\n", accbal) - - // mint ujunoAmt to core1SubDaoAddress (unvested amounts) - tfrAmt := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(int64(ujunoAmt)))) - if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, tfrAmt); err != nil { + // mint unvested coins to be transfered. + if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, unvestedCoins); err != nil { return err } - // transfer tfrAmt to core1 subdao - if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, core1AccAddr, tfrAmt); err != nil { + + // transfer unvested coins back to the to core1 subdao + if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, core1AccAddr, unvestedCoins); err != nil { return err } // update core1 bal - core1BalC = keepers.BankKeeper.GetBalance(ctx, sdk.MustAccAddressFromBech32(core1SubDaoAddress), bondDenom) + core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) fmt.Printf("core1Bal: %v\n", core1BalC) // delete vacc @@ -106,6 +106,22 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, return nil } +func migrateBalanceToCore1SubDao(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, core1AccAddr sdk.AccAddress, bondDenom string) (sdk.Coin, error) { + // Get vesting account balance + accbal := keepers.BankKeeper.GetBalance(ctx, vacc.GetAddress(), bondDenom) + fmt.Printf("accbal: %v\n", accbal) + + // Send all tokens from balance to the core-1 subdao address + if e := keepers.BankKeeper.SendCoins(ctx, vacc.GetAddress(), core1AccAddr, sdk.NewCoins(accbal)); e != nil { + return sdk.Coin{}, fmt.Errorf("error sending coins: %v", e) + } + + core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) + fmt.Printf("core1Bal: %v\n", core1BalC) + + return accbal, nil +} + func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, now time.Time) error { for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) From 1d8a40ed44ba63dc77ffe0f3b520dd1169f1591d Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 1 Jul 2023 13:48:10 -0500 Subject: [PATCH 10/27] Much cleaner vesting functions for Core-1 transfer --- app/upgrades/v16/upgrades.go | 6 +- app/upgrades/vesting.go | 105 +++++++++++++++++------------------ 2 files changed, 54 insertions(+), 57 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 5d868a675..51b4f4e35 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -165,12 +165,10 @@ func CreateV16UpgradeHandler( } func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - addr := sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount) - return upgrades.MoveVestingCoinFromVestingAccount(ctx, - addr, keepers, - Core1SubDAOAddress, bondDenom, + sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount), + sdk.MustAccAddressFromBech32(Core1SubDAOAddress), ) } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 4f782a972..73318782b 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -12,39 +12,10 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" ) -func getUnVestedCoins(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) sdk.Coins { - var mintAmt math.Int = sdk.ZeroInt() - - for i := range vacc.VestingPeriods { - ujunoAmt := vacc.VestingPeriods[i].Amount.AmountOf(bondDenom) - - mintAmt = mintAmt.Add(ujunoAmt) - } - - return sdk.NewCoins(sdk.NewCoin(bondDenom, mintAmt)) -} - -func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) { - // Finish vesting period now. - vacc.EndTime = 0 - vacc.BaseVestingAccount.EndTime = 0 - - for i := range vacc.VestingPeriods { - vacc.VestingPeriods[i].Length = 0 - } - - vacc.VestingPeriods = nil - vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} - - keepers.AccountKeeper.SetAccount(ctx, vacc) -} - -// Stops a vesting account and returns all tokens back to the Core-1 subdao. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, keepers *keepers.AppKeepers, core1SubDaoAddress string, bondDenom string) error { +// Stops a vesting account and returns all tokens back to the Core-1 SubDAO. +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress) error { now := ctx.BlockHeader().Time - core1AccAddr := sdk.MustAccAddressFromBech32(core1SubDaoAddress) - stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) vacc, ok := stdAcc.(*authvestingtypes.PeriodicVestingAccount) if !ok { @@ -56,13 +27,14 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, // Shows locked funds showLockedCoins(vacc, now) - // Gets all coins which have not been unlocked yet. + // Gets all coins which have not been unlocked yet. (Will be minted to the Core-1 SubDAO later for usage.) unvestedCoins := getUnVestedCoins(ctx, vacc, keepers, bondDenom) - // Clears the account so all unvested coins are unlocked. + // Clears the account so all unvested coins are unlocked & removes any future vesting periods. + // (This way we can unbond and transfer all coins) clearVestingAccount(ctx, vacc, keepers, bondDenom) - // Finish redeleations. + // Finish re-deleations. if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { return err } @@ -72,13 +44,25 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, return err } - // Moves the accounts held balance to the subDAO (ex: all unbonded tokens). - movedBal, err := migrateBalanceToCore1SubDao(ctx, vacc, keepers, core1AccAddr, bondDenom) + // Moves the accounts held balance to the SubDAO. + _, err := migrateBalanceToCore1SubDao(ctx, vacc, keepers, core1AccAddr, bondDenom) if err != nil { return err } - fmt.Printf("movedBal: %v\n", movedBal) + // Mints unvested tokens to the Core-1 SubDAO for future use. + if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins); err != nil { + return err + } + + // TODO: Delete the account, not further actions needed. Any downside to this? + keepers.AccountKeeper.RemoveAccount(ctx, vacc) + + // return fmt.Errorf("DEBUGGING: not implemented MoveVestingCoinFromVestAccount") + return nil +} + +func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { // mint unvested coins to be transfered. if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, unvestedCoins); err != nil { return err @@ -89,35 +73,23 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, accAddr sdk.AccAddress, return err } - // update core1 bal core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - fmt.Printf("core1Bal: %v\n", core1BalC) - - // delete vacc - // keepers.AccountKeeper.RemoveAccount(ctx, vacc) - - return fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") - - // TODO: Delete said account? (no reason to have it or the base account anymore yea? any issues of doing this?) - // if so, do we have to remove all the subAccounts first of the vacc/ - // keepers.AccountKeeper.RemoveAccount(ctx, vacc) + fmt.Printf("Updated Core1 SubDAO Balance: %v\n", core1BalC) - // return sdk.Coin{}, fmt.Errorf("not implemented MoveVestingCoinFromVestAccount") return nil } func migrateBalanceToCore1SubDao(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, core1AccAddr sdk.AccAddress, bondDenom string) (sdk.Coin, error) { - // Get vesting account balance accbal := keepers.BankKeeper.GetBalance(ctx, vacc.GetAddress(), bondDenom) - fmt.Printf("accbal: %v\n", accbal) - // Send all tokens from balance to the core-1 subdao address if e := keepers.BankKeeper.SendCoins(ctx, vacc.GetAddress(), core1AccAddr, sdk.NewCoins(accbal)); e != nil { return sdk.Coin{}, fmt.Errorf("error sending coins: %v", e) } core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - fmt.Printf("core1Bal: %v\n", core1BalC) + + fmt.Printf("moved %v from %v to %v\n", accbal, vacc.GetAddress(), core1AccAddr) + fmt.Printf("New Core1 Bal: %v\n", core1BalC) return accbal, nil } @@ -182,3 +154,30 @@ func showLockedCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Tim lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) fmt.Printf("lockedVesting: %v\n", lockedFromVesting) } + +func getUnVestedCoins(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) sdk.Coins { + var mintAmt math.Int = sdk.ZeroInt() + + for i := range vacc.VestingPeriods { + ujunoAmt := vacc.VestingPeriods[i].Amount.AmountOf(bondDenom) + + mintAmt = mintAmt.Add(ujunoAmt) + } + + return sdk.NewCoins(sdk.NewCoin(bondDenom, mintAmt)) +} + +func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) { + // Finish vesting period now. + vacc.EndTime = 0 + vacc.BaseVestingAccount.EndTime = 0 + + for i := range vacc.VestingPeriods { + vacc.VestingPeriods[i].Length = 0 + } + + vacc.VestingPeriods = nil + vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} + + keepers.AccountKeeper.SetAccount(ctx, vacc) +} From be42155a01f1b9685e648548c2f4971db355e765 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 1 Jul 2023 13:54:51 -0500 Subject: [PATCH 11/27] lintorrr --- app/upgrades/v16/upgrades.go | 2 -- app/upgrades/vesting.go | 19 +++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 51b4f4e35..0c12cea4d 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -31,7 +30,6 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" - // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 73318782b..8ab05110a 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -4,12 +4,11 @@ import ( "fmt" "time" - "cosmossdk.io/math" - minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/CosmosContracts/juno/v16/app/keepers" + minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" ) // Stops a vesting account and returns all tokens back to the Core-1 SubDAO. @@ -28,11 +27,11 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep showLockedCoins(vacc, now) // Gets all coins which have not been unlocked yet. (Will be minted to the Core-1 SubDAO later for usage.) - unvestedCoins := getUnVestedCoins(ctx, vacc, keepers, bondDenom) + unvestedCoins := getUnVestedCoins(vacc, bondDenom) // Clears the account so all unvested coins are unlocked & removes any future vesting periods. // (This way we can unbond and transfer all coins) - clearVestingAccount(ctx, vacc, keepers, bondDenom) + clearVestingAccount(ctx, vacc, keepers) // Finish re-deleations. if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { @@ -51,7 +50,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep } // Mints unvested tokens to the Core-1 SubDAO for future use. - if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins); err != nil { + if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, core1AccAddr, unvestedCoins); err != nil { return err } @@ -62,8 +61,8 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return nil } -func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { - // mint unvested coins to be transfered. +func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { + // mint unvested coins to be transferred. if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, unvestedCoins); err != nil { return err } @@ -155,8 +154,8 @@ func showLockedCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Tim fmt.Printf("lockedVesting: %v\n", lockedFromVesting) } -func getUnVestedCoins(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) sdk.Coins { - var mintAmt math.Int = sdk.ZeroInt() +func getUnVestedCoins(vacc *authvestingtypes.PeriodicVestingAccount, bondDenom string) sdk.Coins { + mintAmt := sdk.ZeroInt() for i := range vacc.VestingPeriods { ujunoAmt := vacc.VestingPeriods[i].Amount.AmountOf(bondDenom) @@ -167,7 +166,7 @@ func getUnVestedCoins(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAcc return sdk.NewCoins(sdk.NewCoin(bondDenom, mintAmt)) } -func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, bondDenom string) { +func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers) { // Finish vesting period now. vacc.EndTime = 0 vacc.BaseVestingAccount.EndTime = 0 From 88cb3076f8bf17d7be1ef7d1212411296d64cc09 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 13:18:36 -0500 Subject: [PATCH 12/27] Only move non vested funds to Core-1. Validation checks --- app/upgrades/vesting.go | 128 +++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 54 deletions(-) diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 8ab05110a..6575e4a4d 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -19,50 +21,87 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep vacc, ok := stdAcc.(*authvestingtypes.PeriodicVestingAccount) if !ok { // For e2e testing - fmt.Printf("account " + accAddr.String() + " is not a vesting account. This should not run on mainnet.\n") + fmt.Printf("account " + accAddr.String() + " is not a vesting account.\n") return nil } - // Shows locked funds - showLockedCoins(vacc, now) + fmt.Printf("== Vesting Account Address: %s ==\n", vacc.GetAddress().String()) + + // Gets non-vested coins (These get returned back to Core-1 SubDAO) + // The SubDAO should increase exactly with this much. + unvestedCoins := getStillVestingCoins(vacc, now) + fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) - // Gets all coins which have not been unlocked yet. (Will be minted to the Core-1 SubDAO later for usage.) - unvestedCoins := getUnVestedCoins(vacc, bondDenom) + // Get Core1 and Vesting account balances before migration + core1BeforeBal := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) + // beforeBal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) // cant do anything with before block rewards. + // fmt.Printf("Core1 SubDAO Balance: %v\n", core1BeforeBal) + // fmt.Printf("Vesting Account Balance: %v\n", beforeBal) - // Clears the account so all unvested coins are unlocked & removes any future vesting periods. - // (This way we can unbond and transfer all coins) + // Clears the account so all all future vesting periods are removed. + // Sets it as a standard base account. clearVestingAccount(ctx, vacc, keepers) - // Finish re-deleations. + // Complete any re-deleations to become standard delegations. if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { return err } - // Instant unbond all delegations - if err := unbondAllAndFinish(ctx, now, keepers, accAddr); err != nil { - return err - } - - // Moves the accounts held balance to the SubDAO. - _, err := migrateBalanceToCore1SubDao(ctx, vacc, keepers, core1AccAddr, bondDenom) + // Instant unbond all delegations. Returns the amount of tokens (non rewards) which were returned. + _, err := unbondAllAndFinish(ctx, now, keepers, accAddr) if err != nil { return err } - // Mints unvested tokens to the Core-1 SubDAO for future use. + // Moves unvested tokens to the Core-1 SubDAO for future use. if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, core1AccAddr, unvestedCoins); err != nil { return err } - // TODO: Delete the account, not further actions needed. Any downside to this? - keepers.AccountKeeper.RemoveAccount(ctx, vacc) + // Ensure the post validation checks are met. + if err := postValidation(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins, core1BeforeBal); err != nil { + return err + } // return fmt.Errorf("DEBUGGING: not implemented MoveVestingCoinFromVestAccount") return nil } +func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins, core1BeforeBal sdk.Coin) error { + // Core1 balance should only increase by exactly the core1Bal + unvestedCoins + core1BalAfter := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) + if !core1BeforeBal.Add(unvestedCoins[0]).IsEqual(core1BalAfter) { + return fmt.Errorf("ERROR: core1BeforeBal (%v) + unvestedCoins (%v) != core1BalAfter (%v)", core1BeforeBal, unvestedCoins, core1BalAfter) + } + + // vesting account should have no future vesting periods + newVacc := keepers.AccountKeeper.GetAccount(ctx, accAddr) + if _, ok := newVacc.(*authvestingtypes.PeriodicVestingAccount); ok { + return fmt.Errorf("ERROR: account %s still is a vesting account", accAddr.String()) + } + + // ensure the account has 0 delegations, redelegations, or unbonding delegations + delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) + if len(delegations) != 0 { + return fmt.Errorf("ERROR: account %s still has delegations", accAddr.String()) + } + + redelegations := keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) + if len(redelegations) != 0 { + return fmt.Errorf("ERROR: account %s still has redelegations", accAddr.String()) + } + + unbondingDelegations := keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) + if len(unbondingDelegations) != 0 { + return fmt.Errorf("ERROR: account %s still has unbonding delegations", accAddr.String()) + } + + return nil +} + func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { // mint unvested coins to be transferred. + fmt.Printf("Minting Unvested Coins back to Core-1: %v\n", unvestedCoins) if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, unvestedCoins); err != nil { return err } @@ -78,21 +117,6 @@ func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKe return nil } -func migrateBalanceToCore1SubDao(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, core1AccAddr sdk.AccAddress, bondDenom string) (sdk.Coin, error) { - accbal := keepers.BankKeeper.GetBalance(ctx, vacc.GetAddress(), bondDenom) - - if e := keepers.BankKeeper.SendCoins(ctx, vacc.GetAddress(), core1AccAddr, sdk.NewCoins(accbal)); e != nil { - return sdk.Coin{}, fmt.Errorf("error sending coins: %v", e) - } - - core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - - fmt.Printf("moved %v from %v to %v\n", accbal, vacc.GetAddress(), core1AccAddr) - fmt.Printf("New Core1 Bal: %v\n", core1BalC) - - return accbal, nil -} - func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, now time.Time) error { for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) @@ -113,57 +137,50 @@ func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accA return nil } -func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress) error { +// Returns the amount of tokens which were unbonded (not rewards) +func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress) (math.Int, error) { + unbondedAmt := math.ZeroInt() + // Unbond all delegations from the account for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { + // fmt.Printf("delegation: %v\n", delegation) validatorValAddr := delegation.GetValidatorAddr() _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) if !found { continue } - time, err := keepers.StakingKeeper.Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) + _, err := keepers.StakingKeeper.Undelegate(ctx, accAddr, validatorValAddr, delegation.GetShares()) if err != nil { - return err + return math.ZeroInt(), err } - fmt.Printf("time: %s and err:%v\n", time, err) + // fmt.Printf("time: %s and err:%v\n", time, err) } // Take all unbonding and complete them. for _, unbondingDelegation := range keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) { + // fmt.Printf("unbondingDelegation: %v\n", unbondingDelegation) validatorStringAddr := unbondingDelegation.ValidatorAddress validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) // Complete unbonding delegation for i := range unbondingDelegation.Entries { unbondingDelegation.Entries[i].CompletionTime = now + unbondedAmt = unbondedAmt.Add(unbondingDelegation.Entries[i].Balance) } keepers.StakingKeeper.SetUnbondingDelegation(ctx, unbondingDelegation) _, err := keepers.StakingKeeper.CompleteUnbonding(ctx, accAddr, validatorValAddr) if err != nil { - return err + return math.ZeroInt(), err } } - return nil + return unbondedAmt, nil } -func showLockedCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Time) { - lockedFromVesting := vacc.LockedCoinsFromVesting(vacc.GetVestingCoins(now)) - fmt.Printf("lockedVesting: %v\n", lockedFromVesting) -} - -func getUnVestedCoins(vacc *authvestingtypes.PeriodicVestingAccount, bondDenom string) sdk.Coins { - mintAmt := sdk.ZeroInt() - - for i := range vacc.VestingPeriods { - ujunoAmt := vacc.VestingPeriods[i].Amount.AmountOf(bondDenom) - - mintAmt = mintAmt.Add(ujunoAmt) - } - - return sdk.NewCoins(sdk.NewCoin(bondDenom, mintAmt)) +func getStillVestingCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Time) sdk.Coins { + return vacc.GetVestingCoins(now) } func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers) { @@ -177,6 +194,9 @@ func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVesting vacc.VestingPeriods = nil vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} + vacc.BaseVestingAccount.DelegatedFree = sdk.Coins{} keepers.AccountKeeper.SetAccount(ctx, vacc) + keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) + fmt.Println("Vesting Account set to BaseAccount, not more vesting periods.") } From ff3624500bdc3fa01cb744f88ed16f1132d27062 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 13:19:29 -0500 Subject: [PATCH 13/27] Comments --- app/upgrades/vesting.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 6575e4a4d..bfc15e702 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -32,11 +32,8 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep unvestedCoins := getStillVestingCoins(vacc, now) fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) - // Get Core1 and Vesting account balances before migration + // Get Core1 and before migration core1BeforeBal := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - // beforeBal := keepers.BankKeeper.GetBalance(ctx, accAddr, bondDenom) // cant do anything with before block rewards. - // fmt.Printf("Core1 SubDAO Balance: %v\n", core1BeforeBal) - // fmt.Printf("Vesting Account Balance: %v\n", beforeBal) // Clears the account so all all future vesting periods are removed. // Sets it as a standard base account. @@ -154,7 +151,6 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep if err != nil { return math.ZeroInt(), err } - // fmt.Printf("time: %s and err:%v\n", time, err) } // Take all unbonding and complete them. From 62d2dc6bee071c47684842c7b3cb6117edd7f4c0 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 13:52:04 -0500 Subject: [PATCH 14/27] Use Wolfs actual account --- app/upgrades/v16/upgrades.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 0c12cea4d..607a76d96 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -30,6 +31,7 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" + // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -38,8 +40,8 @@ import ( ) const ( - // TODO: This is my testing local account, not wolfs. need list from Core-1. - WolfsMainnetVestingAccount = "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj" + // Wolf's periodic vesting account (confirmed with him) + WolfsMainnetVestingAccount = "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu" // Core-1 Mainnet Address Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" ) From f81e91f0a4c7895d88abd74fbe0352792297d903 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 14:50:12 -0500 Subject: [PATCH 15/27] Migrate Core-1 rough draft --- app/upgrades/v16/upgrades.go | 53 +++++++++++++++++++++++------ app/upgrades/vesting.go | 64 ++++++++++++++++++++++++++++++++++-- 2 files changed, 105 insertions(+), 12 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 607a76d96..3ad5ea12a 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -40,12 +40,24 @@ import ( ) const ( - // Wolf's periodic vesting account (confirmed with him) - WolfsMainnetVestingAccount = "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu" // Core-1 Mainnet Address Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" ) +var ( + // TODO: Need to get what addres they want it to be under now to withdraw rewards. + // https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members + Core1VestingAccounts = map[string]string{ + "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", + "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", + "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", + "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", + // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? + "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", + } +) + func CreateV16UpgradeHandler( mm *module.Manager, cfg module.Configurator, @@ -155,7 +167,12 @@ func CreateV16UpgradeHandler( // Migrate Core-1 vesting account remaining funds -> Core-1 if ctx.ChainID() == "juno-1" { - if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { + // if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { + // return nil, err + // } + + // Migrate Core-1 vesting account remaining funds -> Core-1 + if err := migrateCore1VestingAccounts(ctx, keepers, nativeDenom); err != nil { return nil, err } } @@ -164,11 +181,27 @@ func CreateV16UpgradeHandler( } } -func removeWolfCore1VestingAccountAndReturnToCore1(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - return upgrades.MoveVestingCoinFromVestingAccount(ctx, - keepers, - bondDenom, - sdk.MustAccAddressFromBech32(WolfsMainnetVestingAccount), - sdk.MustAccAddressFromBech32(Core1SubDAOAddress), - ) +func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { + for name, vestingAccount := range Core1VestingAccounts { + newContract := true + if name == "wolf" { + newContract = false + } + + fmt.Printf("Migrating '%s's vesting account (New Contract: %v)\n", name, newContract) + + if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, + keepers, + bondDenom, + name, + sdk.MustAccAddressFromBech32(vestingAccount), + sdk.MustAccAddressFromBech32(Core1SubDAOAddress), + newContract, + ); err != nil { + return err + } + } + + // return fmt.Errorf("DEBUGGING; not finished yet. (migrateCore1VestingAccounts)") + return nil } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index bfc15e702..bb8ecb42d 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -2,6 +2,7 @@ package upgrades import ( "fmt" + "strings" "time" "cosmossdk.io/math" @@ -13,8 +14,17 @@ import ( minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" ) +const ( + // TODO: Ensure mainnet codeId is used here + // Same as Reece, Noah, and Ekez contracts. + // junod q wasm code 2453 $HOME/Desktop/vesting.wasm --node https://juno-rpc.reece.sh:443 + vestingCodeID = 2453 + // vestingCodeID = 1 // testing + junoUnbondingSeconds = 2419200 +) + // Stops a vesting account and returns all tokens back to the Core-1 SubDAO. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress) error { +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, initNewContract bool) error { now := ctx.BlockHeader().Time stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) @@ -25,7 +35,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return nil } - fmt.Printf("== Vesting Account Address: %s ==\n", vacc.GetAddress().String()) + fmt.Printf("== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) // Gets non-vested coins (These get returned back to Core-1 SubDAO) // The SubDAO should increase exactly with this much. @@ -60,6 +70,56 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return err } + // Create a new vesting contract owned by Core-1 (and Juno Governance by proxy) + if initNewContract { + // End Vesting Time (Juno Network launch Oct 1st, 2021. Vested 12 years = 2033) + endVestingEpochDate := time.Date(2033, 10, 1, 0, 0, 0, 0, time.UTC) + endVestingEpochSeconds := uint64(endVestingEpochDate.Unix()) + vestingDurationSeconds := endVestingEpochSeconds - uint64(now.Unix()) + + // move vestedTokens from Core1 to the new contract we init + fmt.Printf("moving %v from core1 to new contract\n", unvestedCoins) + + owner := core1AccAddr.String() + recipient := accAddr.String() + + // TODO: Change address to their preferred recipient address + // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 + msg := fmt.Sprintf(`{"owner":"%s","recipient":"%s","title":"%s Core-1 Vesting","description":"Core-1 Vesting contract","schedule":"saturating_linear","unbonding_duration_seconds":%d,"vesting_duration_seconds":%d,"total":"%d","denom":{"native":"ujuno"}}`, + owner, + recipient, + name, + junoUnbondingSeconds, + vestingDurationSeconds, + unvestedCoins[0].Amount.Int64(), + ) + + fmt.Println(msg) + + contractAddrHex, _, err := keepers.ContractKeeper.Instantiate( + ctx, + uint64(vestingCodeID), + core1AccAddr, + core1AccAddr, + []byte(msg), + fmt.Sprintf("vest_to_%s_%d", recipient, now.Unix()), + unvestedCoins, + ) + + if err != nil { + if strings.HasSuffix(err.Error(), "no such code") { + fmt.Println("No such codeId: ", vestingCodeID, " - skipping (e2e testing, not mainnet)") + return nil + } + + return err + } + + contractAddrBech32 := sdk.AccAddress(contractAddrHex).String() + fmt.Println("Contract Created for:", contractAddrBech32, name, "With uAmount:", unvestedCoins[0].Amount) + + } + // return fmt.Errorf("DEBUGGING: not implemented MoveVestingCoinFromVestAccount") return nil } From 3392ee14f90f487edc6cae26a1fd71ad4dae5834 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 14:52:07 -0500 Subject: [PATCH 16/27] lint --- app/upgrades/v16/upgrades.go | 26 +++++++++++--------------- app/upgrades/vesting.go | 6 ++---- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 3ad5ea12a..d00df274c 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -31,7 +30,6 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" - // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -44,19 +42,17 @@ const ( Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" ) -var ( - // TODO: Need to get what addres they want it to be under now to withdraw rewards. - // https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members - Core1VestingAccounts = map[string]string{ - "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", - "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", - "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", - "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", - "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", - // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? - "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", - } -) +// Core1VestingAccounts TODO: Need to get what address they want it to be under now to withdraw rewards. +// https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members +var Core1VestingAccounts = map[string]string{ + "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", + "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", + "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", + "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", + // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? + "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", +} func CreateV16UpgradeHandler( mm *module.Manager, diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index bb8ecb42d..4126c67f3 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -96,7 +96,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Println(msg) - contractAddrHex, _, err := keepers.ContractKeeper.Instantiate( + contractAcc, _, err := keepers.ContractKeeper.Instantiate( ctx, uint64(vestingCodeID), core1AccAddr, @@ -105,7 +105,6 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Sprintf("vest_to_%s_%d", recipient, now.Unix()), unvestedCoins, ) - if err != nil { if strings.HasSuffix(err.Error(), "no such code") { fmt.Println("No such codeId: ", vestingCodeID, " - skipping (e2e testing, not mainnet)") @@ -115,8 +114,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return err } - contractAddrBech32 := sdk.AccAddress(contractAddrHex).String() - fmt.Println("Contract Created for:", contractAddrBech32, name, "With uAmount:", unvestedCoins[0].Amount) + fmt.Println("Contract Created for:", contractAcc.String(), name, "With uAmount:", unvestedCoins[0].Amount) } From 6ca1e8e1a7d5a63a5f68669c2e68f02bcf32e3eb Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 18:46:48 -0500 Subject: [PATCH 17/27] VestingContract{}, better logs, no more mint logic, insta complete vesting -> move --- app/upgrades/v16/upgrades.go | 22 +++----- app/upgrades/vesting.go | 101 +++++++++++++++++++++-------------- 2 files changed, 68 insertions(+), 55 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index d00df274c..a9765a507 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -30,6 +31,7 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" + // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -45,13 +47,15 @@ const ( // Core1VestingAccounts TODO: Need to get what address they want it to be under now to withdraw rewards. // https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members var Core1VestingAccounts = map[string]string{ - "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", - "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", + "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + + // "zlocalexample": "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj", } func CreateV16UpgradeHandler( @@ -163,11 +167,7 @@ func CreateV16UpgradeHandler( // Migrate Core-1 vesting account remaining funds -> Core-1 if ctx.ChainID() == "juno-1" { - // if err := removeWolfCore1VestingAccountAndReturnToCore1(ctx, keepers, nativeDenom); err != nil { - // return nil, err - // } - - // Migrate Core-1 vesting account remaining funds -> Core-1 + // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). if err := migrateCore1VestingAccounts(ctx, keepers, nativeDenom); err != nil { return nil, err } @@ -179,20 +179,14 @@ func CreateV16UpgradeHandler( func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { for name, vestingAccount := range Core1VestingAccounts { - newContract := true - if name == "wolf" { - newContract = false - } - - fmt.Printf("Migrating '%s's vesting account (New Contract: %v)\n", name, newContract) + // A new vesting contract will not be created if the account name is 'wolf'. if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, keepers, bondDenom, name, sdk.MustAccAddressFromBech32(vestingAccount), sdk.MustAccAddressFromBech32(Core1SubDAOAddress), - newContract, ); err != nil { return err } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 4126c67f3..0bb001248 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -1,7 +1,9 @@ package upgrades import ( + "encoding/json" "fmt" + "strconv" "strings" "time" @@ -11,7 +13,6 @@ import ( authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/CosmosContracts/juno/v16/app/keepers" - minttypes "github.com/CosmosContracts/juno/v16/x/mint/types" ) const ( @@ -23,8 +24,24 @@ const ( junoUnbondingSeconds = 2419200 ) +type VestingContract struct { + Owner string `json:"owner"` + Recipient string `json:"recipient"` + Title string `json:"title"` + Description string `json:"description"` + Schedule string `json:"schedule"` + UnbondingDurationSeconds uint64 `json:"unbonding_duration_seconds"` + VestingDurationSeconds uint64 `json:"vesting_duration_seconds"` + Total string `json:"total"` + Denom Denom `json:"denom"` +} + +type Denom struct { + Native string `json:"native"` +} + // Stops a vesting account and returns all tokens back to the Core-1 SubDAO. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, initNewContract bool) error { +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress) error { now := ctx.BlockHeader().Time stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) @@ -35,19 +52,18 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return nil } - fmt.Printf("== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) + fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) // Gets non-vested coins (These get returned back to Core-1 SubDAO) // The SubDAO should increase exactly with this much. unvestedCoins := getStillVestingCoins(vacc, now) fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) - // Get Core1 and before migration + // Pre migration balance core1BeforeBal := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) // Clears the account so all all future vesting periods are removed. - // Sets it as a standard base account. - clearVestingAccount(ctx, vacc, keepers) + clearVestingAccount(ctx, vacc, keepers, unvestedCoins) // Complete any re-deleations to become standard delegations. if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { @@ -60,8 +76,11 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return err } - // Moves unvested tokens to the Core-1 SubDAO for future use. - if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, core1AccAddr, unvestedCoins); err != nil { + // set the vesting account to a base account + keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) + + // Moves unvested tokens to the Core-1 SubDAO. + if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins); err != nil { return err } @@ -71,54 +90,60 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep } // Create a new vesting contract owned by Core-1 (and Juno Governance by proxy) - if initNewContract { + // Wolfs resignation terminates his future vesting. + if name != "wolf" { // End Vesting Time (Juno Network launch Oct 1st, 2021. Vested 12 years = 2033) endVestingEpochDate := time.Date(2033, 10, 1, 0, 0, 0, 0, time.UTC) endVestingEpochSeconds := uint64(endVestingEpochDate.Unix()) vestingDurationSeconds := endVestingEpochSeconds - uint64(now.Unix()) - // move vestedTokens from Core1 to the new contract we init - fmt.Printf("moving %v from core1 to new contract\n", unvestedCoins) - owner := core1AccAddr.String() recipient := accAddr.String() // TODO: Change address to their preferred recipient address // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 - msg := fmt.Sprintf(`{"owner":"%s","recipient":"%s","title":"%s Core-1 Vesting","description":"Core-1 Vesting contract","schedule":"saturating_linear","unbonding_duration_seconds":%d,"vesting_duration_seconds":%d,"total":"%d","denom":{"native":"ujuno"}}`, - owner, - recipient, - name, - junoUnbondingSeconds, - vestingDurationSeconds, - unvestedCoins[0].Amount.Int64(), - ) + msgBz, err := json.Marshal(VestingContract{ + Owner: owner, + Recipient: recipient, + Title: fmt.Sprintf("%s core-1", name), + Description: "Core-1 Vesting contract", + Schedule: "saturating_linear", + UnbondingDurationSeconds: junoUnbondingSeconds, + VestingDurationSeconds: vestingDurationSeconds, + Total: strconv.FormatInt(unvestedCoins[0].Amount.Int64(), 10), + Denom: Denom{ + Native: "ujuno", + }, + }) + if err != nil { + return err + } - fmt.Println(msg) + fmt.Printf("Moving %v from Core1 to new contract\n", unvestedCoins) + fmt.Println(string(msgBz)) contractAcc, _, err := keepers.ContractKeeper.Instantiate( ctx, uint64(vestingCodeID), core1AccAddr, core1AccAddr, - []byte(msg), + msgBz, fmt.Sprintf("vest_to_%s_%d", recipient, now.Unix()), unvestedCoins, ) if err != nil { if strings.HasSuffix(err.Error(), "no such code") { - fmt.Println("No such codeId: ", vestingCodeID, " - skipping (e2e testing, not mainnet)") + fmt.Printf("No such codeId: %d - skipping (e2e testing, not mainnet)\n", vestingCodeID) return nil } return err } - fmt.Println("Contract Created for:", contractAcc.String(), name, "With uAmount:", unvestedCoins[0].Amount) + fmt.Printf("Contract Address: %s for %s with amount %d\n", contractAcc.String(), name, unvestedCoins[0].Amount.Int64()) } - // return fmt.Errorf("DEBUGGING: not implemented MoveVestingCoinFromVestAccount") return nil } @@ -154,15 +179,10 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri return nil } -func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { - // mint unvested coins to be transferred. - fmt.Printf("Minting Unvested Coins back to Core-1: %v\n", unvestedCoins) - if err := keepers.BankKeeper.MintCoins(ctx, minttypes.ModuleName, unvestedCoins); err != nil { - return err - } - - // transfer unvested coins back to the to core1 subdao - if err := keepers.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, core1AccAddr, unvestedCoins); err != nil { +func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { + // bank send from acc to core1AccAddr + fmt.Printf("Sending Unvested Coins back to Core-1: %v\n", unvestedCoins) + if err := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, unvestedCoins); err != nil { return err } @@ -237,20 +257,19 @@ func getStillVestingCoins(vacc *authvestingtypes.PeriodicVestingAccount, now tim return vacc.GetVestingCoins(now) } -func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers) { +func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, unvestedCoins sdk.Coins) { // Finish vesting period now. - vacc.EndTime = 0 - vacc.BaseVestingAccount.EndTime = 0 + vacc.BaseVestingAccount.EndTime = ctx.BlockTime().Unix() for i := range vacc.VestingPeriods { vacc.VestingPeriods[i].Length = 0 } - vacc.VestingPeriods = nil + vacc.DelegatedFree = unvestedCoins + vacc.DelegatedVesting = sdk.Coins{} + + vacc.BaseVestingAccount.DelegatedFree = unvestedCoins vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} - vacc.BaseVestingAccount.DelegatedFree = sdk.Coins{} keepers.AccountKeeper.SetAccount(ctx, vacc) - keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) - fmt.Println("Vesting Account set to BaseAccount, not more vesting periods.") } From 8f1c4449a3b7a07fe6624782ceb5debdf5d5012d Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 18:47:06 -0500 Subject: [PATCH 18/27] lint --- app/upgrades/v16/upgrades.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index a9765a507..07a977fd7 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - // SDK v47 modules // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -31,7 +30,6 @@ import ( "github.com/CosmosContracts/juno/v16/app/keepers" "github.com/CosmosContracts/juno/v16/app/upgrades" - // Juno modules feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types" @@ -179,7 +177,6 @@ func CreateV16UpgradeHandler( func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { for name, vestingAccount := range Core1VestingAccounts { - // A new vesting contract will not be created if the account name is 'wolf'. if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, keepers, From bb40aa1a4ba8075ad0ea84c9c9d20a6bed88a734 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 18:52:04 -0500 Subject: [PATCH 19/27] Remove stale func, new newVestingContract func --- app/upgrades/vesting.go | 105 +++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 0bb001248..7ede6095a 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -54,9 +54,9 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) - // Gets non-vested coins (These get returned back to Core-1 SubDAO) + // Gets non-vested coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) // The SubDAO should increase exactly with this much. - unvestedCoins := getStillVestingCoins(vacc, now) + unvestedCoins := vacc.GetVestingCoins(now) fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) // Pre migration balance @@ -92,58 +92,66 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep // Create a new vesting contract owned by Core-1 (and Juno Governance by proxy) // Wolfs resignation terminates his future vesting. if name != "wolf" { - // End Vesting Time (Juno Network launch Oct 1st, 2021. Vested 12 years = 2033) - endVestingEpochDate := time.Date(2033, 10, 1, 0, 0, 0, 0, time.UTC) - endVestingEpochSeconds := uint64(endVestingEpochDate.Unix()) - vestingDurationSeconds := endVestingEpochSeconds - uint64(now.Unix()) - - owner := core1AccAddr.String() - recipient := accAddr.String() - - // TODO: Change address to their preferred recipient address - // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 - msgBz, err := json.Marshal(VestingContract{ - Owner: owner, - Recipient: recipient, - Title: fmt.Sprintf("%s core-1", name), - Description: "Core-1 Vesting contract", - Schedule: "saturating_linear", - UnbondingDurationSeconds: junoUnbondingSeconds, - VestingDurationSeconds: vestingDurationSeconds, - Total: strconv.FormatInt(unvestedCoins[0].Amount.Int64(), 10), - Denom: Denom{ - Native: "ujuno", - }, - }) - if err != nil { + if err := newVestingContract(ctx, keepers, core1AccAddr, accAddr, name, unvestedCoins); err != nil { return err } + } - fmt.Printf("Moving %v from Core1 to new contract\n", unvestedCoins) - fmt.Println(string(msgBz)) - - contractAcc, _, err := keepers.ContractKeeper.Instantiate( - ctx, - uint64(vestingCodeID), - core1AccAddr, - core1AccAddr, - msgBz, - fmt.Sprintf("vest_to_%s_%d", recipient, now.Unix()), - unvestedCoins, - ) - if err != nil { - if strings.HasSuffix(err.Error(), "no such code") { - fmt.Printf("No such codeId: %d - skipping (e2e testing, not mainnet)\n", vestingCodeID) - return nil - } + return nil +} - return err - } +func newVestingContract(ctx sdk.Context, keepers *keepers.AppKeepers, core1AccAddr, accAddr sdk.AccAddress, name string, unvestedCoins sdk.Coins) error { + now := ctx.BlockHeader().Time.Unix() + + // End Vesting Time (Juno Network launch Oct 1st, 2021. Vested 12 years = 2033) + endVestingEpochDate := time.Date(2033, 10, 1, 0, 0, 0, 0, time.UTC) + endVestingEpochSeconds := uint64(endVestingEpochDate.Unix()) + vestingDurationSeconds := endVestingEpochSeconds - uint64(now) + + owner := core1AccAddr.String() + recipient := accAddr.String() + + // TODO: Change address to their preferred recipient address + // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 + msgBz, err := json.Marshal(VestingContract{ + Owner: owner, + Recipient: recipient, + Title: fmt.Sprintf("%s core-1", name), + Description: "Core-1 Vesting contract", + Schedule: "saturating_linear", + UnbondingDurationSeconds: junoUnbondingSeconds, + VestingDurationSeconds: vestingDurationSeconds, + Total: strconv.FormatInt(unvestedCoins[0].Amount.Int64(), 10), + Denom: Denom{ + Native: "ujuno", + }, + }) + if err != nil { + return err + } - fmt.Printf("Contract Address: %s for %s with amount %d\n", contractAcc.String(), name, unvestedCoins[0].Amount.Int64()) + fmt.Printf("Moving %v from Core1 to new contract\n", unvestedCoins) + fmt.Println(string(msgBz)) + + contractAcc, _, err := keepers.ContractKeeper.Instantiate( + ctx, + uint64(vestingCodeID), + core1AccAddr, + core1AccAddr, + msgBz, + fmt.Sprintf("vest_to_%s_%d", recipient, now), + unvestedCoins, + ) + if err != nil { + if strings.HasSuffix(err.Error(), "no such code") { + fmt.Printf("No such codeId: %d - skipping (e2e testing, not mainnet)\n", vestingCodeID) + return nil + } + return err } + fmt.Printf("Contract Address: %s for %s with amount %d\n", contractAcc.String(), name, unvestedCoins[0].Amount.Int64()) return nil } @@ -180,7 +188,6 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri } func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { - // bank send from acc to core1AccAddr fmt.Printf("Sending Unvested Coins back to Core-1: %v\n", unvestedCoins) if err := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, unvestedCoins); err != nil { return err @@ -253,10 +260,6 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep return unbondedAmt, nil } -func getStillVestingCoins(vacc *authvestingtypes.PeriodicVestingAccount, now time.Time) sdk.Coins { - return vacc.GetVestingCoins(now) -} - func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, unvestedCoins sdk.Coins) { // Finish vesting period now. vacc.BaseVestingAccount.EndTime = ctx.BlockTime().Unix() From 30596ad3fc31cae8ed55825e3227484f1b35aa8b Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 3 Jul 2023 18:56:50 -0500 Subject: [PATCH 20/27] stale comments --- app/upgrades/v16/upgrades.go | 6 ++---- app/upgrades/vesting.go | 7 +------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 07a977fd7..84c3420a3 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -42,8 +42,7 @@ const ( Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" ) -// Core1VestingAccounts TODO: Need to get what address they want it to be under now to withdraw rewards. -// https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members +// Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members var Core1VestingAccounts = map[string]string{ "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", @@ -163,9 +162,8 @@ func CreateV16UpgradeHandler( return nil, err } - // Migrate Core-1 vesting account remaining funds -> Core-1 + // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). if ctx.ChainID() == "juno-1" { - // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). if err := migrateCore1VestingAccounts(ctx, keepers, nativeDenom); err != nil { return nil, err } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 7ede6095a..da55980bf 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -55,7 +55,6 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) // Gets non-vested coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) - // The SubDAO should increase exactly with this much. unvestedCoins := vacc.GetVestingCoins(now) fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) @@ -70,7 +69,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return err } - // Instant unbond all delegations. Returns the amount of tokens (non rewards) which were returned. + // Instant unbond all delegations. _, err := unbondAllAndFinish(ctx, now, keepers, accAddr) if err != nil { return err @@ -111,7 +110,6 @@ func newVestingContract(ctx sdk.Context, keepers *keepers.AppKeepers, core1AccAd owner := core1AccAddr.String() recipient := accAddr.String() - // TODO: Change address to their preferred recipient address // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 msgBz, err := json.Marshal(VestingContract{ Owner: owner, @@ -225,7 +223,6 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep // Unbond all delegations from the account for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { - // fmt.Printf("delegation: %v\n", delegation) validatorValAddr := delegation.GetValidatorAddr() _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) if !found { @@ -240,7 +237,6 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep // Take all unbonding and complete them. for _, unbondingDelegation := range keepers.StakingKeeper.GetAllUnbondingDelegations(ctx, accAddr) { - // fmt.Printf("unbondingDelegation: %v\n", unbondingDelegation) validatorStringAddr := unbondingDelegation.ValidatorAddress validatorValAddr, _ := sdk.ValAddressFromBech32(validatorStringAddr) @@ -261,7 +257,6 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep } func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, unvestedCoins sdk.Coins) { - // Finish vesting period now. vacc.BaseVestingAccount.EndTime = ctx.BlockTime().Unix() for i := range vacc.VestingPeriods { From 24f679d2441e102c25081c250c245a51fa6f1db2 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Sun, 24 Dec 2023 15:21:53 -0600 Subject: [PATCH 21/27] Move Upgrade Logic to v19 --- app/upgrades/v16/upgrades.go | 45 ++---------------------------------- app/upgrades/v19/upgrades.go | 43 ++++++++++++++++++++++++++++++++++ app/upgrades/vesting.go | 2 +- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index a0baf6859..43b20012d 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -18,6 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // SDK v47 modules authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -32,6 +33,7 @@ import ( "github.com/CosmosContracts/juno/v19/app/keepers" "github.com/CosmosContracts/juno/v19/app/upgrades" + // Juno modules feesharetypes "github.com/CosmosContracts/juno/v19/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v19/x/globalfee/types" @@ -39,24 +41,6 @@ import ( tokenfactorytypes "github.com/CosmosContracts/juno/v19/x/tokenfactory/types" ) -const ( - // Core-1 Mainnet Address - Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" -) - -// Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members -var Core1VestingAccounts = map[string]string{ - "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", - "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", - "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", - "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", - // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? - "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", - "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", - - // "zlocalexample": "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj", -} - func CreateV16UpgradeHandler( mm *module.Manager, cfg module.Configurator, @@ -164,13 +148,6 @@ func CreateV16UpgradeHandler( return nil, err } - // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). - if ctx.ChainID() == "juno-1" { - if err := migrateCore1VestingAccounts(ctx, keepers, nativeDenom); err != nil { - return nil, err - } - } - // x/POB pobAddr := keepers.AccountKeeper.GetModuleAddress(buildertypes.ModuleName) @@ -189,21 +166,3 @@ func CreateV16UpgradeHandler( return versionMap, err } } - -func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - for name, vestingAccount := range Core1VestingAccounts { - // A new vesting contract will not be created if the account name is 'wolf'. - if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, - keepers, - bondDenom, - name, - sdk.MustAccAddressFromBech32(vestingAccount), - sdk.MustAccAddressFromBech32(Core1SubDAOAddress), - ); err != nil { - return err - } - } - - // return fmt.Errorf("DEBUGGING; not finished yet. (migrateCore1VestingAccounts)") - return nil -} diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index f9f1567bd..f8147501f 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -14,6 +14,24 @@ import ( "github.com/CosmosContracts/juno/v19/app/upgrades" ) +const ( + // Core-1 Mainnet Address + Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" +) + +// Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members +var Core1VestingAccounts = map[string]string{ + "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", + "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", + "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", + "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", + // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? + "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", + "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + + // "zlocalexample": "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj", +} + func CreateV19UpgradeHandler( mm *module.Manager, cfg module.Configurator, @@ -50,6 +68,31 @@ func CreateV19UpgradeHandler( params.AllowedClients = append(params.AllowedClients, wasmlctypes.Wasm) k.IBCKeeper.ClientKeeper.SetParams(ctx, params) + // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). + if ctx.ChainID() == "juno-1" { + if err := migrateCore1VestingAccounts(ctx, k, nativeDenom); err != nil { + return nil, err + } + } + return versionMap, err } } + +func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { + for name, vestingAccount := range Core1VestingAccounts { + // A new vesting contract will not be created if the account name is 'wolf'. + if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, + keepers, + bondDenom, + name, + sdk.MustAccAddressFromBech32(vestingAccount), + sdk.MustAccAddressFromBech32(Core1SubDAOAddress), + ); err != nil { + return err + } + } + + // return fmt.Errorf("DEBUGGING; not finished yet. (migrateCore1VestingAccounts)") + return nil +} diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index da55980bf..123cae5df 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authvestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/CosmosContracts/juno/v16/app/keepers" + "github.com/CosmosContracts/juno/v19/app/keepers" ) const ( From 57ffcaa1cdd17b9d81eb2ef237380a065886c9c7 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 22 Jan 2024 19:05:05 -0600 Subject: [PATCH 22/27] Update Vesting Transfer Logic, Implement Tests with Mainnet snapshot accounts --- app/upgrades/v16/upgrades.go | 2 - app/upgrades/v19/mainnet_accounts.go | 73 +++++++++++ app/upgrades/v19/upgrade_test.go | 4 + app/upgrades/v19/upgrades.go | 63 ++++++---- app/upgrades/vesting.go | 178 ++++++--------------------- 5 files changed, 156 insertions(+), 164 deletions(-) create mode 100644 app/upgrades/v19/mainnet_accounts.go diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 43b20012d..3084ad2ef 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - // SDK v47 modules authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -33,7 +32,6 @@ import ( "github.com/CosmosContracts/juno/v19/app/keepers" "github.com/CosmosContracts/juno/v19/app/upgrades" - // Juno modules feesharetypes "github.com/CosmosContracts/juno/v19/x/feeshare/types" globalfeetypes "github.com/CosmosContracts/juno/v19/x/globalfee/types" diff --git a/app/upgrades/v19/mainnet_accounts.go b/app/upgrades/v19/mainnet_accounts.go new file mode 100644 index 000000000..f63d7c9ac --- /dev/null +++ b/app/upgrades/v19/mainnet_accounts.go @@ -0,0 +1,73 @@ +package v19 + +import ( + "encoding/json" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + + "github.com/CosmosContracts/juno/v19/app/keepers" +) + +func CreateMainnetVestingAccount(ctx sdk.Context, k keepers.AppKeepers) ([]*vestingtypes.PeriodicVestingAccount, error) { + jsonAccounts := []string{ + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Akr1IlYcH7p08W8pdYNkmAEvDRoPOXdOefg56cm3paKm"},"account_number":46158,"sequence":897},"original_vesting":[{"denom":"ujuno","amount":"431220000000"}],"delegated_free":[{"denom":"ujuno","amount":"417029796699"}],"delegated_vesting":[{"denom":"ujuno","amount":"430000000000"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, + + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"ApcEus7fRKwSRNNs4nlOy62fFH9Ep7lg9DQRsnx9Ht0H"},"account_number":14783,"sequence":991},"original_vesting":[{"denom":"ujuno","amount":"431230191000"}],"delegated_free":[{"denom":"ujuno","amount":"594329704467"}],"delegated_vesting":[{"denom":"ujuno","amount":"431220000000"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"10191000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, + + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A1SgSrlikj83agLUJPYDuWTjPkw4rPzkWgMMy/5RxANy"},"account_number":42191,"sequence":202},"original_vesting":[{"denom":"ujuno","amount":"78432000000"}],"delegated_free":[{"denom":"ujuno","amount":"31802746321"}],"delegated_vesting":[{"denom":"ujuno","amount":"57432000000"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"21000000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1665000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"833000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"416000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"375000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"333000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"291000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"208000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"166000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"124000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"83000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"42000000"}]}]}`, + + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+hZFIZ3i+5jD83trhShTmD/bAAXpIyb6tHJDJtiOAn6"},"account_number":23705,"sequence":1253},"original_vesting":[{"denom":"ujuno","amount":"433838270000"}],"delegated_free":[{"denom":"ujuno","amount":"509388774646"}],"delegated_vesting":[{"denom":"ujuno","amount":"431220000000"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"2618270000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, + + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3","pub_key":{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":3,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+hZFIZ3i+5jD83trhShTmD/bAAXpIyb6tHJDJtiOAn6"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"ApcEus7fRKwSRNNs4nlOy62fFH9Ep7lg9DQRsnx9Ht0H"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A1SgSrlikj83agLUJPYDuWTjPkw4rPzkWgMMy/5RxANy"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5fjV581bOBJSuHpBkY7ve3uZJFAv4JI14+K+RiHgr30"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Akr1IlYcH7p08W8pdYNkmAEvDRoPOXdOefg56cm3paKm"}]},"account_number":46159,"sequence":33},"original_vesting":[{"denom":"ujuno","amount":"12457737000000"}],"delegated_free":[{"denom":"ujuno","amount":"398745473523"}],"delegated_vesting":[{"denom":"ujuno","amount":"6404764327386"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"2373341000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2526000000"}]}]}`, + + `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AjQmoovTUzJNCKi0xb8fGI3GHoJtC1s90xbfFSuczxo7"},"account_number":46157,"sequence":4478},"original_vesting":[{"denom":"ujuno","amount":"431220000000"}],"delegated_free":[{"denom":"ujuno","amount":"231978485341"}],"delegated_vesting":[{"denom":"ujuno","amount":"407576000001"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, + } + + // Array of vesting accounts + var vestingAccounts []*vestingtypes.PeriodicVestingAccount + + // Iterate over json accounts, unmarshal and fund + for _, jsonEntry := range jsonAccounts { + + // Unmarshal account + var acc vestingtypes.PeriodicVestingAccount + if err := json.Unmarshal([]byte(jsonEntry), &acc); err != nil { + panic(err) + } + + stillVesting := acc.GetVestingCoins(ctx.BlockTime()) + delegatedVesting := acc.GetDelegatedVesting() // TODO: FIX: DOES NOT ACCOUNT FOR BLOCK TIME + + vestedUnlocked := acc.GetVestedCoins(ctx.BlockTime()) + delegatedUnlocked := acc.GetDelegatedFree() // TODO: FIX: DOES NOT ACCOUNT FOR BLOCK TIME + + fmt.Println("--------------------") + fmt.Println("Still Vesting: ", stillVesting) + fmt.Println("Delegated Vesting: ", delegatedVesting) + fmt.Println() + fmt.Println("Vested Unlocked: ", vestedUnlocked) + fmt.Println("Delegated Unlocked: ", delegatedUnlocked) + fmt.Println("--------------------") + // fmt.Println("Difference: ", originalVesting[0].Sub(vestedUnlocked[0])) + fmt.Println() + fmt.Println() + + // Fund the account from bank keeper + // TODO: DETERMINE HOW MUCH TO FUND THE ACCOUNT + funds := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(123_000_000_000_000))) + if err := banktestutil.FundAccount(k.BankKeeper, ctx, acc.GetAddress(), funds); err != nil { + panic(err) + } + + // Set account with keeper + k.AccountKeeper.SetAccount(ctx, &acc) + + // Append vesting account + vestingAccounts = append(vestingAccounts, &acc) + } + + return vestingAccounts, nil +} diff --git a/app/upgrades/v19/upgrade_test.go b/app/upgrades/v19/upgrade_test.go index 07e3ac969..ed69f97a0 100644 --- a/app/upgrades/v19/upgrade_test.go +++ b/app/upgrades/v19/upgrade_test.go @@ -31,6 +31,10 @@ func TestKeeperTestSuite(t *testing.T) { func (s *UpgradeTestSuite) TestUpgrade() { s.Setup() + // Setup mainnet account + _, err := v19.CreateMainnetVestingAccount(s.Ctx, s.App.AppKeepers) + s.Require().NoError(err) + preUpgradeChecks(s) upgradeHeight := int64(5) diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index f8147501f..c80e690a4 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -15,21 +15,41 @@ import ( ) const ( - // Core-1 Mainnet Address - Core1SubDAOAddress = "juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3" + // Charter Council's SubDAO Address + CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" ) +type IndividualAccount struct { + Owner string + Address string +} + // Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members -var Core1VestingAccounts = map[string]string{ - "block": "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", - "dimi": "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", - "jack": "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", - "jake": "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", - // TODO: So, can the SubDAO be the owner of the init'ed contract to claim rewards? - "multisig": "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", - "wolf": "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", - - // "zlocalexample": "juno1xz599egrd3dhq5vx63mkwja38q5q3th8h3ukjj", +var Core1VestingAccounts = []IndividualAccount{ + { + Owner: "block", + Address: "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", + }, + { + Owner: "dimi", + Address: "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", + }, + { + Owner: "jack", + Address: "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", + }, + { + Owner: "jake", + Address: "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", + }, + { + Owner: "multisig", + Address: "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", + }, + { + Owner: "wolf", + Address: "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + }, } func CreateV19UpgradeHandler( @@ -68,26 +88,27 @@ func CreateV19UpgradeHandler( params.AllowedClients = append(params.AllowedClients, wasmlctypes.Wasm) k.IBCKeeper.ClientKeeper.SetParams(ctx, params) - // Migrate Core-1 vesting account remaining funds -> Core-1, then create a new vesting contract for them (if not wolf). - if ctx.ChainID() == "juno-1" { - if err := migrateCore1VestingAccounts(ctx, k, nativeDenom); err != nil { - return nil, err - } + // Migrate Core-1 vesting account remaining funds -> Council SubDAO + // if ctx.ChainID() == "juno-1" { + + if err := migrateCore1VestingAccounts(ctx, k, nativeDenom); err != nil { + return nil, err } + // } return versionMap, err } } func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - for name, vestingAccount := range Core1VestingAccounts { + for _, account := range Core1VestingAccounts { // A new vesting contract will not be created if the account name is 'wolf'. if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, keepers, bondDenom, - name, - sdk.MustAccAddressFromBech32(vestingAccount), - sdk.MustAccAddressFromBech32(Core1SubDAOAddress), + account.Owner, + sdk.MustAccAddressFromBech32(account.Address), + sdk.MustAccAddressFromBech32(CharterCouncil), ); err != nil { return err } diff --git a/app/upgrades/vesting.go b/app/upgrades/vesting.go index 123cae5df..5380ea8af 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/vesting.go @@ -1,10 +1,7 @@ package upgrades import ( - "encoding/json" "fmt" - "strconv" - "strings" "time" "cosmossdk.io/math" @@ -15,33 +12,8 @@ import ( "github.com/CosmosContracts/juno/v19/app/keepers" ) -const ( - // TODO: Ensure mainnet codeId is used here - // Same as Reece, Noah, and Ekez contracts. - // junod q wasm code 2453 $HOME/Desktop/vesting.wasm --node https://juno-rpc.reece.sh:443 - vestingCodeID = 2453 - // vestingCodeID = 1 // testing - junoUnbondingSeconds = 2419200 -) - -type VestingContract struct { - Owner string `json:"owner"` - Recipient string `json:"recipient"` - Title string `json:"title"` - Description string `json:"description"` - Schedule string `json:"schedule"` - UnbondingDurationSeconds uint64 `json:"unbonding_duration_seconds"` - VestingDurationSeconds uint64 `json:"vesting_duration_seconds"` - Total string `json:"total"` - Denom Denom `json:"denom"` -} - -type Denom struct { - Native string `json:"native"` -} - // Stops a vesting account and returns all tokens back to the Core-1 SubDAO. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress) error { +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress) error { now := ctx.BlockHeader().Time stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) @@ -54,110 +26,45 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) - // Gets non-vested coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) - unvestedCoins := vacc.GetVestingCoins(now) - fmt.Printf("Locked / waiting to vest Coins: %v\n", unvestedCoins) + // Gets vesting coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) + vestingCoins := vacc.GetVestingCoins(now) + fmt.Printf("Vesting Coins: %v\n", vestingCoins) - // Pre migration balance - core1BeforeBal := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - - // Clears the account so all all future vesting periods are removed. - clearVestingAccount(ctx, vacc, keepers, unvestedCoins) - - // Complete any re-deleations to become standard delegations. - if err := completeAllRedelegations(ctx, keepers, accAddr, now); err != nil { + // Instantly complete any re-deleations. + amt, err := completeAllRedelegations(ctx, now, keepers, accAddr) + if err != nil { return err } + fmt.Println("Redelegated Amount: ", amt) - // Instant unbond all delegations. - _, err := unbondAllAndFinish(ctx, now, keepers, accAddr) + // Instantly unbond all delegations. + amt, err = unbondAllAndFinish(ctx, now, keepers, accAddr) if err != nil { return err } + fmt.Println("Unbonded Amount: ", amt) - // set the vesting account to a base account - keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) + // Pre transfer balance + councilBeforeBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) // Moves unvested tokens to the Core-1 SubDAO. - if err := transferUnvestedTokensToCore1SubDao(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins); err != nil { + if err := transferUnvestedTokensToCouncil(ctx, keepers, bondDenom, accAddr, councilAccAddr, vestingCoins); err != nil { return err } - // Ensure the post validation checks are met. - if err := postValidation(ctx, keepers, bondDenom, accAddr, core1AccAddr, unvestedCoins, core1BeforeBal); err != nil { - return err - } - - // Create a new vesting contract owned by Core-1 (and Juno Governance by proxy) - // Wolfs resignation terminates his future vesting. - if name != "wolf" { - if err := newVestingContract(ctx, keepers, core1AccAddr, accAddr, name, unvestedCoins); err != nil { - return err - } - } - - return nil -} - -func newVestingContract(ctx sdk.Context, keepers *keepers.AppKeepers, core1AccAddr, accAddr sdk.AccAddress, name string, unvestedCoins sdk.Coins) error { - now := ctx.BlockHeader().Time.Unix() - - // End Vesting Time (Juno Network launch Oct 1st, 2021. Vested 12 years = 2033) - endVestingEpochDate := time.Date(2033, 10, 1, 0, 0, 0, 0, time.UTC) - endVestingEpochSeconds := uint64(endVestingEpochDate.Unix()) - vestingDurationSeconds := endVestingEpochSeconds - uint64(now) - - owner := core1AccAddr.String() - recipient := accAddr.String() - - // https://github.com/DA0-DA0/dao-contracts/blob/main/contracts/external/cw-vesting/src/msg.rs#L11 - msgBz, err := json.Marshal(VestingContract{ - Owner: owner, - Recipient: recipient, - Title: fmt.Sprintf("%s core-1", name), - Description: "Core-1 Vesting contract", - Schedule: "saturating_linear", - UnbondingDurationSeconds: junoUnbondingSeconds, - VestingDurationSeconds: vestingDurationSeconds, - Total: strconv.FormatInt(unvestedCoins[0].Amount.Int64(), 10), - Denom: Denom{ - Native: "ujuno", - }, - }) - if err != nil { - return err - } - - fmt.Printf("Moving %v from Core1 to new contract\n", unvestedCoins) - fmt.Println(string(msgBz)) - - contractAcc, _, err := keepers.ContractKeeper.Instantiate( - ctx, - uint64(vestingCodeID), - core1AccAddr, - core1AccAddr, - msgBz, - fmt.Sprintf("vest_to_%s_%d", recipient, now), - unvestedCoins, - ) - if err != nil { - if strings.HasSuffix(err.Error(), "no such code") { - fmt.Printf("No such codeId: %d - skipping (e2e testing, not mainnet)\n", vestingCodeID) - return nil - } - - return err - } + // Set the vesting account to a base account + keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) - fmt.Printf("Contract Address: %s for %s with amount %d\n", contractAcc.String(), name, unvestedCoins[0].Amount.Int64()) - return nil + // Ensure the post validation checks are met. + err = postValidation(ctx, keepers, bondDenom, accAddr, councilAccAddr, vestingCoins, councilBeforeBal) + return err } -func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins, core1BeforeBal sdk.Coin) error { - // Core1 balance should only increase by exactly the core1Bal + unvestedCoins - core1BalAfter := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - if !core1BeforeBal.Add(unvestedCoins[0]).IsEqual(core1BalAfter) { - return fmt.Errorf("ERROR: core1BeforeBal (%v) + unvestedCoins (%v) != core1BalAfter (%v)", core1BeforeBal, unvestedCoins, core1BalAfter) +func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, vestingCoins sdk.Coins, councilBeforeBal sdk.Coin) error { + // Council balance should only increase by exactly the council + vestedCoins + councilAfterBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) + if !councilBeforeBal.Add(vestingCoins[0]).IsEqual(councilAfterBal) { + return fmt.Errorf("ERROR: core1BeforeBal (%v) + unvestedCoins (%v) != core1BalAfter (%v)", councilBeforeBal, vestingCoins, councilAfterBal) } // vesting account should have no future vesting periods @@ -185,19 +92,23 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri return nil } -func transferUnvestedTokensToCore1SubDao(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr, core1AccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { - fmt.Printf("Sending Unvested Coins back to Core-1: %v\n", unvestedCoins) - if err := keepers.BankKeeper.SendCoins(ctx, accAddr, core1AccAddr, unvestedCoins); err != nil { +// Transfer funds from the vesting account to the Council SubDAO. +func transferUnvestedTokensToCouncil(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr, councilAccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { + fmt.Printf("Sending Vesting Coins to Council: %v\n", unvestedCoins) + if err := keepers.BankKeeper.SendCoins(ctx, accAddr, councilAccAddr, unvestedCoins); err != nil { return err } - core1BalC := keepers.BankKeeper.GetBalance(ctx, core1AccAddr, bondDenom) - fmt.Printf("Updated Core1 SubDAO Balance: %v\n", core1BalC) + councilBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) + fmt.Printf("Updated Council SubDAO Balance: %v\n", councilBal) return nil } -func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, now time.Time) error { +// Completes all re-delegations and returns the amount of tokens which were re-delegated. +func completeAllRedelegations(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress) (math.Int, error) { + redelegatedAmt := math.ZeroInt() + for _, activeRedelegation := range keepers.StakingKeeper.GetRedelegations(ctx, accAddr, 65535) { redelegationSrc, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorSrcAddress) redelegationDst, _ := sdk.ValAddressFromBech32(activeRedelegation.ValidatorDstAddress) @@ -205,16 +116,17 @@ func completeAllRedelegations(ctx sdk.Context, keepers *keepers.AppKeepers, accA // set all entry completionTime to now so we can complete re-delegation for i := range activeRedelegation.Entries { activeRedelegation.Entries[i].CompletionTime = now + redelegatedAmt = redelegatedAmt.Add(math.Int(activeRedelegation.Entries[i].SharesDst)) } keepers.StakingKeeper.SetRedelegation(ctx, activeRedelegation) _, err := keepers.StakingKeeper.CompleteRedelegation(ctx, accAddr, redelegationSrc, redelegationDst) if err != nil { - return err + return redelegatedAmt, err } } - return nil + return redelegatedAmt, nil } // Returns the amount of tokens which were unbonded (not rewards) @@ -255,19 +167,3 @@ func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeep return unbondedAmt, nil } - -func clearVestingAccount(ctx sdk.Context, vacc *authvestingtypes.PeriodicVestingAccount, keepers *keepers.AppKeepers, unvestedCoins sdk.Coins) { - vacc.BaseVestingAccount.EndTime = ctx.BlockTime().Unix() - - for i := range vacc.VestingPeriods { - vacc.VestingPeriods[i].Length = 0 - } - - vacc.DelegatedFree = unvestedCoins - vacc.DelegatedVesting = sdk.Coins{} - - vacc.BaseVestingAccount.DelegatedFree = unvestedCoins - vacc.BaseVestingAccount.DelegatedVesting = sdk.Coins{} - - keepers.AccountKeeper.SetAccount(ctx, vacc) -} From 5a79ce85c15d73a323f8598047ab69cd0a13a55c Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Wed, 24 Jan 2024 22:17:58 -0600 Subject: [PATCH 23/27] Unbond All Except Jack, Add test validators (WIP) --- app/apptesting/test_suite.go | 19 +++++---- app/upgrades/v19/mainnet_accounts.go | 21 +--------- app/upgrades/v19/upgrade_test.go | 61 ++++++++++++++++++++++++++++ app/upgrades/v19/upgrades.go | 8 ++-- app/upgrades/{ => v19}/vesting.go | 26 +++++++----- 5 files changed, 93 insertions(+), 42 deletions(-) rename app/upgrades/{ => v19}/vesting.go (85%) diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 3c635664c..a89c65fcb 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -31,6 +31,7 @@ import ( distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakinghelper "github.com/cosmos/cosmos-sdk/x/staking/testutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -45,6 +46,8 @@ type KeeperTestHelper struct { Ctx sdk.Context QueryHelper *baseapp.QueryServiceTestHelper TestAccs []sdk.AccAddress + + StakingHelper *stakinghelper.Helper } var ( @@ -62,6 +65,9 @@ func (s *KeeperTestHelper) Setup() { Ctx: s.Ctx, } s.TestAccs = CreateRandomAccounts(3) + + s.StakingHelper = stakinghelper.NewHelper(s.Suite.T(), s.Ctx, s.App.AppKeepers.StakingKeeper) + s.StakingHelper.Denom = "ujuno" } func (s *KeeperTestHelper) SetupTestForInitGenesis() { @@ -118,21 +124,18 @@ func (s *KeeperTestHelper) MintCoins(coins sdk.Coins) { // SetupValidator sets up a validator and returns the ValAddress. func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sdk.ValAddress { - valPub := secp256k1.GenPrivKey().PubKey() + valPriv := secp256k1.GenPrivKey() + valPub := valPriv.PubKey() valAddr := sdk.ValAddress(valPub.Address()) bondDenom := s.App.AppKeepers.StakingKeeper.GetParams(s.Ctx).BondDenom selfBond := sdk.NewCoins(sdk.Coin{Amount: sdk.NewInt(100), Denom: bondDenom}) s.FundAcc(sdk.AccAddress(valAddr), selfBond) - // stakingHandler := staking.NewHandler(s.App.AppKeepers.StakingKeeper) - stakingCoin := sdk.NewCoin(appparams.BondDenom, selfBond[0].Amount) - ZeroCommission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) - _, err := stakingtypes.NewMsgCreateValidator(valAddr, valPub, stakingCoin, stakingtypes.Description{}, ZeroCommission, sdk.OneInt()) + msg := s.StakingHelper.CreateValidatorMsg(valAddr, valPub, selfBond[0].Amount) + res, err := s.StakingHelper.CreateValidatorWithMsg(s.Ctx, msg) s.Require().NoError(err) - // res, err := stakingHandler(s.Ctx, msg) - // s.Require().NoError(err) - // s.Require().NotNil(res) + s.Require().NotNil(res) val, found := s.App.AppKeepers.StakingKeeper.GetValidator(s.Ctx, valAddr) s.Require().True(found) diff --git a/app/upgrades/v19/mainnet_accounts.go b/app/upgrades/v19/mainnet_accounts.go index f63d7c9ac..e21eeadcc 100644 --- a/app/upgrades/v19/mainnet_accounts.go +++ b/app/upgrades/v19/mainnet_accounts.go @@ -2,7 +2,6 @@ package v19 import ( "encoding/json" - "fmt" sdk "github.com/cosmos/cosmos-sdk/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -38,26 +37,8 @@ func CreateMainnetVestingAccount(ctx sdk.Context, k keepers.AppKeepers) ([]*vest panic(err) } - stillVesting := acc.GetVestingCoins(ctx.BlockTime()) - delegatedVesting := acc.GetDelegatedVesting() // TODO: FIX: DOES NOT ACCOUNT FOR BLOCK TIME - - vestedUnlocked := acc.GetVestedCoins(ctx.BlockTime()) - delegatedUnlocked := acc.GetDelegatedFree() // TODO: FIX: DOES NOT ACCOUNT FOR BLOCK TIME - - fmt.Println("--------------------") - fmt.Println("Still Vesting: ", stillVesting) - fmt.Println("Delegated Vesting: ", delegatedVesting) - fmt.Println() - fmt.Println("Vested Unlocked: ", vestedUnlocked) - fmt.Println("Delegated Unlocked: ", delegatedUnlocked) - fmt.Println("--------------------") - // fmt.Println("Difference: ", originalVesting[0].Sub(vestedUnlocked[0])) - fmt.Println() - fmt.Println() - // Fund the account from bank keeper - // TODO: DETERMINE HOW MUCH TO FUND THE ACCOUNT - funds := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(123_000_000_000_000))) + funds := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(100_000_000_000_000))) if err := banktestutil.FundAccount(k.BankKeeper, ctx, acc.GetAddress(), funds); err != nil { panic(err) } diff --git a/app/upgrades/v19/upgrade_test.go b/app/upgrades/v19/upgrade_test.go index ed69f97a0..5543c1c92 100644 --- a/app/upgrades/v19/upgrade_test.go +++ b/app/upgrades/v19/upgrade_test.go @@ -3,9 +3,11 @@ package v19_test import ( "fmt" "testing" + "time" "github.com/stretchr/testify/suite" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -35,6 +37,65 @@ func (s *UpgradeTestSuite) TestUpgrade() { _, err := v19.CreateMainnetVestingAccount(s.Ctx, s.App.AppKeepers) s.Require().NoError(err) + // Create Strange Love Validator + pub, err := codectypes.NewAnyWithValue(secp256k1.GenPrivKey().PubKey()) + s.Require().NoError(err) + slVal := stakingtypes.Validator{ + OperatorAddress: "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l", + ConsensusPubkey: pub, + Status: stakingtypes.Bonded, + Tokens: sdk.NewInt(237205439625), + DelegatorShares: sdk.NewDec(237205439625), + Description: stakingtypes.Description{ + Moniker: "strangelove", + Identity: "158DA6C7FCFB7BD23988D9C0D0D8B80F1C5C70B5", + Website: "", + SecurityContact: "", + Details: "", + }, + Commission: stakingtypes.Commission{ + CommissionRates: stakingtypes.CommissionRates{ + Rate: sdk.MustNewDecFromStr("0.100000000000000000"), + MaxRate: sdk.MustNewDecFromStr("0.200000000000000000"), + MaxChangeRate: sdk.MustNewDecFromStr("0.010000000000000000"), + }, + UpdateTime: time.Date(2021, 10, 1, 15, 0, 0, 0, time.UTC), + }, + MinSelfDelegation: sdk.NewInt(1), + Jailed: false, + UnbondingHeight: 0, + UnbondingTime: time.Time{}, + UnbondingOnHoldRefCount: 0, + UnbondingIds: nil, + } + + // err = json.Unmarshal([]byte(slValidator), &slVal) + // s.Require().NoError(err) + s.App.AppKeepers.StakingKeeper.SetValidator(s.Ctx, slVal) + + // Create additional validators + val1 := s.SetupValidator(stakingtypes.Bonded) + val2 := s.SetupValidator(stakingtypes.Bonded) + val3 := s.SetupValidator(stakingtypes.Bonded) + + validators := []sdk.ValAddress{val1, val2, val3} + + // Should equal 5, including default validator + s.Require().Equal(5, len(s.App.AppKeepers.StakingKeeper.GetAllValidators(s.Ctx))) + + // Create delegations to each validator + for _, delegator := range v19.Core1VestingAccounts { + delegatorAddr := sdk.MustAccAddressFromBech32(delegator.Address) + + for _, validator := range validators { + + fmt.Println("Delegator: ", delegatorAddr.String()) + fmt.Println("Delegating to validator: ", validator.String()) + + s.StakingHelper.Delegate(delegatorAddr, validator, sdk.NewInt(1_000_000)) + } + } + preUpgradeChecks(s) upgradeHeight := int64(5) diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index c80e690a4..6261fcf4a 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -16,7 +16,9 @@ import ( const ( // Charter Council's SubDAO Address - CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" + CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" + JackKey = "jack" + JackValidatorAddress = "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l" ) type IndividualAccount struct { @@ -35,7 +37,7 @@ var Core1VestingAccounts = []IndividualAccount{ Address: "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", }, { - Owner: "jack", + Owner: JackKey, Address: "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", }, { @@ -103,7 +105,7 @@ func CreateV19UpgradeHandler( func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { for _, account := range Core1VestingAccounts { // A new vesting contract will not be created if the account name is 'wolf'. - if err := upgrades.MoveVestingCoinFromVestingAccount(ctx, + if err := MoveVestingCoinFromVestingAccount(ctx, keepers, bondDenom, account.Owner, diff --git a/app/upgrades/vesting.go b/app/upgrades/v19/vesting.go similarity index 85% rename from app/upgrades/vesting.go rename to app/upgrades/v19/vesting.go index 5380ea8af..fc0e790e7 100644 --- a/app/upgrades/vesting.go +++ b/app/upgrades/v19/vesting.go @@ -1,4 +1,4 @@ -package upgrades +package v19 import ( "fmt" @@ -13,7 +13,7 @@ import ( ) // Stops a vesting account and returns all tokens back to the Core-1 SubDAO. -func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, name string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress) error { +func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, owner string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress) error { now := ctx.BlockHeader().Time stdAcc := keepers.AccountKeeper.GetAccount(ctx, accAddr) @@ -24,7 +24,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep return nil } - fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), name) + fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), owner) // Gets vesting coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) vestingCoins := vacc.GetVestingCoins(now) @@ -38,7 +38,7 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Println("Redelegated Amount: ", amt) // Instantly unbond all delegations. - amt, err = unbondAllAndFinish(ctx, now, keepers, accAddr) + amt, err = unbondAllAndFinish(ctx, now, keepers, owner, accAddr) if err != nil { return err } @@ -56,11 +56,11 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) // Ensure the post validation checks are met. - err = postValidation(ctx, keepers, bondDenom, accAddr, councilAccAddr, vestingCoins, councilBeforeBal) + err = postValidation(ctx, keepers, bondDenom, owner, accAddr, councilAccAddr, vestingCoins, councilBeforeBal) return err } -func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, vestingCoins sdk.Coins, councilBeforeBal sdk.Coin) error { +func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, owner string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, vestingCoins sdk.Coins, councilBeforeBal sdk.Coin) error { // Council balance should only increase by exactly the council + vestedCoins councilAfterBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) if !councilBeforeBal.Add(vestingCoins[0]).IsEqual(councilAfterBal) { @@ -75,7 +75,7 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri // ensure the account has 0 delegations, redelegations, or unbonding delegations delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) - if len(delegations) != 0 { + if len(delegations) != 0 || !(owner == JackKey && len(delegations) == 1) { return fmt.Errorf("ERROR: account %s still has delegations", accAddr.String()) } @@ -93,7 +93,7 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri } // Transfer funds from the vesting account to the Council SubDAO. -func transferUnvestedTokensToCouncil(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr, councilAccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { +func transferUnvestedTokensToCouncil(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { fmt.Printf("Sending Vesting Coins to Council: %v\n", unvestedCoins) if err := keepers.BankKeeper.SendCoins(ctx, accAddr, councilAccAddr, unvestedCoins); err != nil { return err @@ -130,14 +130,18 @@ func completeAllRedelegations(ctx sdk.Context, now time.Time, keepers *keepers.A } // Returns the amount of tokens which were unbonded (not rewards) -func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, accAddr sdk.AccAddress) (math.Int, error) { +func unbondAllAndFinish(ctx sdk.Context, now time.Time, keepers *keepers.AppKeepers, owner string, accAddr sdk.AccAddress) (math.Int, error) { unbondedAmt := math.ZeroInt() // Unbond all delegations from the account for _, delegation := range keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) { validatorValAddr := delegation.GetValidatorAddr() - _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr) - if !found { + if _, found := keepers.StakingKeeper.GetValidator(ctx, validatorValAddr); !found { + continue + } + + // Jack's account has a delegation to his validator which is not unbonded. + if owner == JackKey && validatorValAddr.String() == JackValidatorAddress { continue } From f029efe694c8aeb92c0a0473deee5beec48d91c2 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 29 Jan 2024 15:21:39 -0600 Subject: [PATCH 24/27] Implement Test Cases --- app/upgrades/v19/upgrade_test.go | 66 +++++++++----------------------- app/upgrades/v19/upgrades.go | 8 ++-- app/upgrades/v19/vesting.go | 26 ++++++------- 3 files changed, 36 insertions(+), 64 deletions(-) diff --git a/app/upgrades/v19/upgrade_test.go b/app/upgrades/v19/upgrade_test.go index 5543c1c92..8f3ad7ee6 100644 --- a/app/upgrades/v19/upgrade_test.go +++ b/app/upgrades/v19/upgrade_test.go @@ -3,11 +3,9 @@ package v19_test import ( "fmt" "testing" - "time" "github.com/stretchr/testify/suite" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -37,62 +35,34 @@ func (s *UpgradeTestSuite) TestUpgrade() { _, err := v19.CreateMainnetVestingAccount(s.Ctx, s.App.AppKeepers) s.Require().NoError(err) - // Create Strange Love Validator - pub, err := codectypes.NewAnyWithValue(secp256k1.GenPrivKey().PubKey()) - s.Require().NoError(err) - slVal := stakingtypes.Validator{ - OperatorAddress: "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l", - ConsensusPubkey: pub, - Status: stakingtypes.Bonded, - Tokens: sdk.NewInt(237205439625), - DelegatorShares: sdk.NewDec(237205439625), - Description: stakingtypes.Description{ - Moniker: "strangelove", - Identity: "158DA6C7FCFB7BD23988D9C0D0D8B80F1C5C70B5", - Website: "", - SecurityContact: "", - Details: "", - }, - Commission: stakingtypes.Commission{ - CommissionRates: stakingtypes.CommissionRates{ - Rate: sdk.MustNewDecFromStr("0.100000000000000000"), - MaxRate: sdk.MustNewDecFromStr("0.200000000000000000"), - MaxChangeRate: sdk.MustNewDecFromStr("0.010000000000000000"), - }, - UpdateTime: time.Date(2021, 10, 1, 15, 0, 0, 0, time.UTC), - }, - MinSelfDelegation: sdk.NewInt(1), - Jailed: false, - UnbondingHeight: 0, - UnbondingTime: time.Time{}, - UnbondingOnHoldRefCount: 0, - UnbondingIds: nil, - } - - // err = json.Unmarshal([]byte(slValidator), &slVal) - // s.Require().NoError(err) - s.App.AppKeepers.StakingKeeper.SetValidator(s.Ctx, slVal) - - // Create additional validators + // Create 3 generic validators val1 := s.SetupValidator(stakingtypes.Bonded) val2 := s.SetupValidator(stakingtypes.Bonded) val3 := s.SetupValidator(stakingtypes.Bonded) + // Get last validator, set as mock jack validator + val, found := s.App.AppKeepers.StakingKeeper.GetValidator(s.Ctx, val3) + s.Require().True(found) + v19.JackValidatorAddress = val.OperatorAddress + validators := []sdk.ValAddress{val1, val2, val3} - // Should equal 5, including default validator - s.Require().Equal(5, len(s.App.AppKeepers.StakingKeeper.GetAllValidators(s.Ctx))) + // Should equal 4, including default validator + s.Require().Equal(4, len(s.App.AppKeepers.StakingKeeper.GetAllValidators(s.Ctx))) - // Create delegations to each validator - for _, delegator := range v19.Core1VestingAccounts { - delegatorAddr := sdk.MustAccAddressFromBech32(delegator.Address) + // Create delegations to each validator 2x, ensuring multiple delegations + // are created for each validator and combined in state. + for i := 0; i < 2; i++ { + for _, delegator := range v19.Core1VestingAccounts { + delegatorAddr := sdk.MustAccAddressFromBech32(delegator.Address) - for _, validator := range validators { + for _, validator := range validators { - fmt.Println("Delegator: ", delegatorAddr.String()) - fmt.Println("Delegating to validator: ", validator.String()) + fmt.Println("Delegator: ", delegatorAddr.String()) + fmt.Println("Delegating to validator: ", validator.String()) - s.StakingHelper.Delegate(delegatorAddr, validator, sdk.NewInt(1_000_000)) + s.StakingHelper.Delegate(delegatorAddr, validator, sdk.NewInt(1_000_000)) + } } } diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index 6261fcf4a..d0b4de2de 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -16,11 +16,13 @@ import ( const ( // Charter Council's SubDAO Address - CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" - JackKey = "jack" - JackValidatorAddress = "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l" + CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" + JackKey = "jack" ) +// JackValidatorAddress must be mutable for testing +var JackValidatorAddress = "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l" + type IndividualAccount struct { Owner string Address string diff --git a/app/upgrades/v19/vesting.go b/app/upgrades/v19/vesting.go index fc0e790e7..d48fbcc5f 100644 --- a/app/upgrades/v19/vesting.go +++ b/app/upgrades/v19/vesting.go @@ -48,10 +48,15 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep councilBeforeBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) // Moves unvested tokens to the Core-1 SubDAO. - if err := transferUnvestedTokensToCouncil(ctx, keepers, bondDenom, accAddr, councilAccAddr, vestingCoins); err != nil { + if err := transferUnvestedTokensToCouncil(ctx, keepers, accAddr, councilAccAddr, vestingCoins); err != nil { return err } + // Log new council balance + councilAfterBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) + fmt.Printf("Council Balance Before: %v\n", councilBeforeBal) + fmt.Printf("Council Balance After: %v\n", councilAfterBal) + // Set the vesting account to a base account keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) @@ -73,9 +78,10 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri return fmt.Errorf("ERROR: account %s still is a vesting account", accAddr.String()) } - // ensure the account has 0 delegations, redelegations, or unbonding delegations + // ensure the account has 0 delegations, redelegations, or unbonding delegations, + // if the account is Jack's account, ensure it has 1 delegation to his validator delegations := keepers.StakingKeeper.GetAllDelegatorDelegations(ctx, accAddr) - if len(delegations) != 0 || !(owner == JackKey && len(delegations) == 1) { + if !(len(delegations) == 0 || (owner == JackKey && len(delegations) == 1)) { return fmt.Errorf("ERROR: account %s still has delegations", accAddr.String()) } @@ -93,16 +99,10 @@ func postValidation(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom stri } // Transfer funds from the vesting account to the Council SubDAO. -func transferUnvestedTokensToCouncil(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, unvestedCoins sdk.Coins) error { - fmt.Printf("Sending Vesting Coins to Council: %v\n", unvestedCoins) - if err := keepers.BankKeeper.SendCoins(ctx, accAddr, councilAccAddr, unvestedCoins); err != nil { - return err - } - - councilBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) - fmt.Printf("Updated Council SubDAO Balance: %v\n", councilBal) - - return nil +func transferUnvestedTokensToCouncil(ctx sdk.Context, keepers *keepers.AppKeepers, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress, vestingCoins sdk.Coins) error { + fmt.Printf("Sending Vesting Coins to Council: %v\n", vestingCoins) + err := keepers.BankKeeper.SendCoins(ctx, accAddr, councilAccAddr, vestingCoins) + return err } // Completes all re-delegations and returns the amount of tokens which were re-delegated. From 87c5ad1fb59ebcd0016b93f32c1dcb96b601dd02 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 29 Jan 2024 16:15:15 -0600 Subject: [PATCH 25/27] Add v20 Upgrade Handler --- app/app.go | 2 + app/upgrades/v19/upgrade_test.go | 35 ------ app/upgrades/v19/upgrades.go | 68 ------------ app/upgrades/v20/constants.go | 22 ++++ app/upgrades/{v19 => v20}/mainnet_accounts.go | 2 +- app/upgrades/v20/upgrade_test.go | 73 +++++++++++++ app/upgrades/v20/upgrades.go | 101 ++++++++++++++++++ app/upgrades/{v19 => v20}/vesting.go | 2 +- 8 files changed, 200 insertions(+), 105 deletions(-) create mode 100644 app/upgrades/v20/constants.go rename app/upgrades/{v19 => v20}/mainnet_accounts.go (99%) create mode 100644 app/upgrades/v20/upgrade_test.go create mode 100644 app/upgrades/v20/upgrades.go rename app/upgrades/{v19 => v20}/vesting.go (99%) diff --git a/app/app.go b/app/app.go index 58b34cb40..8072a0338 100644 --- a/app/app.go +++ b/app/app.go @@ -80,6 +80,7 @@ import ( v17 "github.com/CosmosContracts/juno/v19/app/upgrades/v17" v18 "github.com/CosmosContracts/juno/v19/app/upgrades/v18" v19 "github.com/CosmosContracts/juno/v19/app/upgrades/v19" + v20 "github.com/CosmosContracts/juno/v19/app/upgrades/v20" "github.com/CosmosContracts/juno/v19/docs" ) @@ -117,6 +118,7 @@ var ( v17.Upgrade, v18.Upgrade, v19.Upgrade, + v20.Upgrade, } ) diff --git a/app/upgrades/v19/upgrade_test.go b/app/upgrades/v19/upgrade_test.go index 8f3ad7ee6..07e3ac969 100644 --- a/app/upgrades/v19/upgrade_test.go +++ b/app/upgrades/v19/upgrade_test.go @@ -31,41 +31,6 @@ func TestKeeperTestSuite(t *testing.T) { func (s *UpgradeTestSuite) TestUpgrade() { s.Setup() - // Setup mainnet account - _, err := v19.CreateMainnetVestingAccount(s.Ctx, s.App.AppKeepers) - s.Require().NoError(err) - - // Create 3 generic validators - val1 := s.SetupValidator(stakingtypes.Bonded) - val2 := s.SetupValidator(stakingtypes.Bonded) - val3 := s.SetupValidator(stakingtypes.Bonded) - - // Get last validator, set as mock jack validator - val, found := s.App.AppKeepers.StakingKeeper.GetValidator(s.Ctx, val3) - s.Require().True(found) - v19.JackValidatorAddress = val.OperatorAddress - - validators := []sdk.ValAddress{val1, val2, val3} - - // Should equal 4, including default validator - s.Require().Equal(4, len(s.App.AppKeepers.StakingKeeper.GetAllValidators(s.Ctx))) - - // Create delegations to each validator 2x, ensuring multiple delegations - // are created for each validator and combined in state. - for i := 0; i < 2; i++ { - for _, delegator := range v19.Core1VestingAccounts { - delegatorAddr := sdk.MustAccAddressFromBech32(delegator.Address) - - for _, validator := range validators { - - fmt.Println("Delegator: ", delegatorAddr.String()) - fmt.Println("Delegating to validator: ", validator.String()) - - s.StakingHelper.Delegate(delegatorAddr, validator, sdk.NewInt(1_000_000)) - } - } - } - preUpgradeChecks(s) upgradeHeight := int64(5) diff --git a/app/upgrades/v19/upgrades.go b/app/upgrades/v19/upgrades.go index d0b4de2de..f9f1567bd 100644 --- a/app/upgrades/v19/upgrades.go +++ b/app/upgrades/v19/upgrades.go @@ -14,48 +14,6 @@ import ( "github.com/CosmosContracts/juno/v19/app/upgrades" ) -const ( - // Charter Council's SubDAO Address - CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" - JackKey = "jack" -) - -// JackValidatorAddress must be mutable for testing -var JackValidatorAddress = "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l" - -type IndividualAccount struct { - Owner string - Address string -} - -// Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members -var Core1VestingAccounts = []IndividualAccount{ - { - Owner: "block", - Address: "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", - }, - { - Owner: "dimi", - Address: "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", - }, - { - Owner: JackKey, - Address: "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", - }, - { - Owner: "jake", - Address: "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", - }, - { - Owner: "multisig", - Address: "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", - }, - { - Owner: "wolf", - Address: "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", - }, -} - func CreateV19UpgradeHandler( mm *module.Manager, cfg module.Configurator, @@ -92,32 +50,6 @@ func CreateV19UpgradeHandler( params.AllowedClients = append(params.AllowedClients, wasmlctypes.Wasm) k.IBCKeeper.ClientKeeper.SetParams(ctx, params) - // Migrate Core-1 vesting account remaining funds -> Council SubDAO - // if ctx.ChainID() == "juno-1" { - - if err := migrateCore1VestingAccounts(ctx, k, nativeDenom); err != nil { - return nil, err - } - // } - return versionMap, err } } - -func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { - for _, account := range Core1VestingAccounts { - // A new vesting contract will not be created if the account name is 'wolf'. - if err := MoveVestingCoinFromVestingAccount(ctx, - keepers, - bondDenom, - account.Owner, - sdk.MustAccAddressFromBech32(account.Address), - sdk.MustAccAddressFromBech32(CharterCouncil), - ); err != nil { - return err - } - } - - // return fmt.Errorf("DEBUGGING; not finished yet. (migrateCore1VestingAccounts)") - return nil -} diff --git a/app/upgrades/v20/constants.go b/app/upgrades/v20/constants.go new file mode 100644 index 000000000..7ee4fa6be --- /dev/null +++ b/app/upgrades/v20/constants.go @@ -0,0 +1,22 @@ +package v20 + +import ( + wasmlctypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/CosmosContracts/juno/v19/app/upgrades" +) + +// UpgradeName defines the on-chain upgrade name for the upgrade. +const UpgradeName = "v20" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateV20UpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ + wasmlctypes.ModuleName, + }, + }, +} diff --git a/app/upgrades/v19/mainnet_accounts.go b/app/upgrades/v20/mainnet_accounts.go similarity index 99% rename from app/upgrades/v19/mainnet_accounts.go rename to app/upgrades/v20/mainnet_accounts.go index e21eeadcc..9dcf1aefe 100644 --- a/app/upgrades/v19/mainnet_accounts.go +++ b/app/upgrades/v20/mainnet_accounts.go @@ -1,4 +1,4 @@ -package v19 +package v20 import ( "encoding/json" diff --git a/app/upgrades/v20/upgrade_test.go b/app/upgrades/v20/upgrade_test.go new file mode 100644 index 000000000..f808eadf6 --- /dev/null +++ b/app/upgrades/v20/upgrade_test.go @@ -0,0 +1,73 @@ +package v20_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/CosmosContracts/juno/v19/app/apptesting" + v20 "github.com/CosmosContracts/juno/v19/app/upgrades/v20" +) + +type UpgradeTestSuite struct { + apptesting.KeeperTestHelper +} + +func (s *UpgradeTestSuite) SetupTest() { + s.Setup() +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +// Ensures the test does not error out. +func (s *UpgradeTestSuite) TestUpgrade() { + s.Setup() + + preUpgradeChecks(s) + + upgradeHeight := int64(5) + s.ConfirmUpgradeSucceeded(v20.UpgradeName, upgradeHeight) + + postUpgradeChecks(s) +} + +func preUpgradeChecks(s *UpgradeTestSuite) { + // Setup mainnet account + _, err := v20.CreateMainnetVestingAccount(s.Ctx, s.App.AppKeepers) + s.Require().NoError(err) + + // Create 3 generic validators + val1 := s.SetupValidator(stakingtypes.Bonded) + val2 := s.SetupValidator(stakingtypes.Bonded) + val3 := s.SetupValidator(stakingtypes.Bonded) + + // Get last validator, set as mock jack validator + val, found := s.App.AppKeepers.StakingKeeper.GetValidator(s.Ctx, val3) + s.Require().True(found) + v20.JackValidatorAddress = val.OperatorAddress + + validators := []sdk.ValAddress{val1, val2, val3} + + // Should equal 4, including default validator + s.Require().Equal(4, len(s.App.AppKeepers.StakingKeeper.GetAllValidators(s.Ctx))) + + // Create delegations to each validator 2x, ensuring multiple delegations + // are created for each validator and combined in state. + for i := 0; i < 2; i++ { + for _, delegator := range v20.Core1VestingAccounts { + delegatorAddr := sdk.MustAccAddressFromBech32(delegator.Address) + + for _, validator := range validators { + s.StakingHelper.Delegate(delegatorAddr, validator, sdk.NewInt(1_000_000)) + } + } + } +} + +func postUpgradeChecks(_ *UpgradeTestSuite) { +} diff --git a/app/upgrades/v20/upgrades.go b/app/upgrades/v20/upgrades.go new file mode 100644 index 000000000..349414a3c --- /dev/null +++ b/app/upgrades/v20/upgrades.go @@ -0,0 +1,101 @@ +package v20 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/CosmosContracts/juno/v19/app/keepers" + "github.com/CosmosContracts/juno/v19/app/upgrades" +) + +const ( + // Charter Council's SubDAO Address + CharterCouncil = "juno1nmezpepv3lx45mndyctz2lzqxa6d9xzd2xumkxf7a6r4nxt0y95qypm6c0" + JackKey = "jack" +) + +// JackValidatorAddress must be mutable for testing +var JackValidatorAddress = "junovaloper130mdu9a0etmeuw52qfxk73pn0ga6gawk2tz77l" + +type IndividualAccount struct { + Owner string + Address string +} + +// Core1VestingAccounts https://daodao.zone/dao/juno1j6glql3xmrcnga0gytecsucq3kd88jexxamxg3yn2xnqhunyvflqr7lxx3/members +var Core1VestingAccounts = []IndividualAccount{ + { + Owner: "block", + Address: "juno17py8gfneaam64vt9kaec0fseqwxvkq0flmsmhg", + }, + { + Owner: "dimi", + Address: "juno1s33zct2zhhaf60x4a90cpe9yquw99jj0zen8pt", + }, + { + Owner: JackKey, + Address: "juno130mdu9a0etmeuw52qfxk73pn0ga6gawk4k539x", + }, + { + Owner: "jake", + Address: "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", + }, + { + Owner: "multisig", + Address: "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", + }, + { + Owner: "wolf", + Address: "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", + }, +} + +func CreateV20UpgradeHandler( + mm *module.Manager, + cfg module.Configurator, + k *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := ctx.Logger().With("upgrade", UpgradeName) + + nativeDenom := upgrades.GetChainsDenomToken(ctx.ChainID()) + logger.Info(fmt.Sprintf("With native denom %s", nativeDenom)) + + // Run migrations + logger.Info(fmt.Sprintf("pre migrate version map: %v", vm)) + versionMap, err := mm.RunMigrations(ctx, cfg, vm) + if err != nil { + return nil, err + } + logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) + + // Migrate Core-1 vesting account remaining funds -> Council SubDAO + if ctx.ChainID() == "juno-1" { + if err := migrateCore1VestingAccounts(ctx, k, nativeDenom); err != nil { + return nil, err + } + } + + return versionMap, err + } +} + +// Migrate balances from the Core-1 vesting accounts to the Council SubDAO. +func migrateCore1VestingAccounts(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string) error { + for _, account := range Core1VestingAccounts { + // A new vesting contract will not be created if the account name is 'wolf'. + if err := MoveVestingCoinFromVestingAccount(ctx, + keepers, + bondDenom, + account.Owner, + sdk.MustAccAddressFromBech32(account.Address), + sdk.MustAccAddressFromBech32(CharterCouncil), + ); err != nil { + return err + } + } + return nil +} diff --git a/app/upgrades/v19/vesting.go b/app/upgrades/v20/vesting.go similarity index 99% rename from app/upgrades/v19/vesting.go rename to app/upgrades/v20/vesting.go index d48fbcc5f..721e9596c 100644 --- a/app/upgrades/v19/vesting.go +++ b/app/upgrades/v20/vesting.go @@ -1,4 +1,4 @@ -package v19 +package v20 import ( "fmt" From bd4df59900ae998e0742a45647b477373ecba510 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 29 Jan 2024 16:22:27 -0600 Subject: [PATCH 26/27] Remove Multisig (Handled in v19) --- app/upgrades/v20/mainnet_accounts.go | 2 -- app/upgrades/v20/upgrades.go | 4 ---- 2 files changed, 6 deletions(-) diff --git a/app/upgrades/v20/mainnet_accounts.go b/app/upgrades/v20/mainnet_accounts.go index 9dcf1aefe..dbc34de95 100644 --- a/app/upgrades/v20/mainnet_accounts.go +++ b/app/upgrades/v20/mainnet_accounts.go @@ -20,8 +20,6 @@ func CreateMainnetVestingAccount(ctx sdk.Context, k keepers.AppKeepers) ([]*vest `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+hZFIZ3i+5jD83trhShTmD/bAAXpIyb6tHJDJtiOAn6"},"account_number":23705,"sequence":1253},"original_vesting":[{"denom":"ujuno","amount":"433838270000"}],"delegated_free":[{"denom":"ujuno","amount":"509388774646"}],"delegated_vesting":[{"denom":"ujuno","amount":"431220000000"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"2618270000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, - `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3","pub_key":{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":3,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+hZFIZ3i+5jD83trhShTmD/bAAXpIyb6tHJDJtiOAn6"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"ApcEus7fRKwSRNNs4nlOy62fFH9Ep7lg9DQRsnx9Ht0H"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A1SgSrlikj83agLUJPYDuWTjPkw4rPzkWgMMy/5RxANy"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5fjV581bOBJSuHpBkY7ve3uZJFAv4JI14+K+RiHgr30"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Akr1IlYcH7p08W8pdYNkmAEvDRoPOXdOefg56cm3paKm"}]},"account_number":46159,"sequence":33},"original_vesting":[{"denom":"ujuno","amount":"12457737000000"}],"delegated_free":[{"denom":"ujuno","amount":"398745473523"}],"delegated_vesting":[{"denom":"ujuno","amount":"6404764327386"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":0,"amount":[{"denom":"ujuno","amount":"2373341000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"294128000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"147064000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"73952000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"66388000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"58825000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"51262000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"43867000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"36556000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"29245000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"21934000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"14623000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2522000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2526000000"}]}]}`, - `{"@type":"/cosmos.vesting.v1beta1.PeriodicVestingAccount","base_vesting_account":{"base_account":{"address":"juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AjQmoovTUzJNCKi0xb8fGI3GHoJtC1s90xbfFSuczxo7"},"account_number":46157,"sequence":4478},"original_vesting":[{"denom":"ujuno","amount":"431220000000"}],"delegated_free":[{"denom":"ujuno","amount":"231978485341"}],"delegated_vesting":[{"denom":"ujuno","amount":"407576000001"}],"end_time":2006348400},"start_time":1633100400,"vesting_periods":[{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"12500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"6250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"3125000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2812000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2500000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"2187000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1875000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1562000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"1250000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"937000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"625000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]},{"length":2592000,"amount":[{"denom":"ujuno","amount":"312000000"}]}]}`, } diff --git a/app/upgrades/v20/upgrades.go b/app/upgrades/v20/upgrades.go index 349414a3c..3fc7950dc 100644 --- a/app/upgrades/v20/upgrades.go +++ b/app/upgrades/v20/upgrades.go @@ -43,10 +43,6 @@ var Core1VestingAccounts = []IndividualAccount{ Owner: "jake", Address: "juno18qw9ydpewh405w4lvmuhlg9gtaep79vy2gmtr2", }, - { - Owner: "multisig", - Address: "juno190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", - }, { Owner: "wolf", Address: "juno1a8u47ggy964tv9trjxfjcldutau5ls705djqyu", From 1e1a2b240cfc0563a370739d60b1fa13896aed48 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 5 Feb 2024 16:43:07 -0600 Subject: [PATCH 27/27] Send Funds After Disabling Vesting, Fix Test Vesting Account Instantiation --- app/upgrades/v20/mainnet_accounts.go | 8 +++++--- app/upgrades/v20/vesting.go | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/upgrades/v20/mainnet_accounts.go b/app/upgrades/v20/mainnet_accounts.go index dbc34de95..a39cbf28c 100644 --- a/app/upgrades/v20/mainnet_accounts.go +++ b/app/upgrades/v20/mainnet_accounts.go @@ -35,15 +35,17 @@ func CreateMainnetVestingAccount(ctx sdk.Context, k keepers.AppKeepers) ([]*vest panic(err) } + acc = *vestingtypes.NewPeriodicVestingAccount(acc.BaseAccount, acc.OriginalVesting, acc.StartTime, acc.VestingPeriods) + + // Set account with keeper + k.AccountKeeper.SetAccount(ctx, &acc) + // Fund the account from bank keeper funds := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewInt(100_000_000_000_000))) if err := banktestutil.FundAccount(k.BankKeeper, ctx, acc.GetAddress(), funds); err != nil { panic(err) } - // Set account with keeper - k.AccountKeeper.SetAccount(ctx, &acc) - // Append vesting account vestingAccounts = append(vestingAccounts, &acc) } diff --git a/app/upgrades/v20/vesting.go b/app/upgrades/v20/vesting.go index 721e9596c..5da70a974 100644 --- a/app/upgrades/v20/vesting.go +++ b/app/upgrades/v20/vesting.go @@ -12,7 +12,7 @@ import ( "github.com/CosmosContracts/juno/v19/app/keepers" ) -// Stops a vesting account and returns all tokens back to the Core-1 SubDAO. +// Stops a vesting account and returns all tokens back to the council func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeepers, bondDenom string, owner string, accAddr sdk.AccAddress, councilAccAddr sdk.AccAddress) error { now := ctx.BlockHeader().Time @@ -26,10 +26,16 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Printf("\n\n== Vesting Account Address: %s (%s) ==\n", vacc.GetAddress().String(), owner) - // Gets vesting coins (These get returned back to Core-1 SubDAO / a new vesting contract made from) + // Gets vesting coins (These get returned back to council / a new vesting contract made from) vestingCoins := vacc.GetVestingCoins(now) fmt.Printf("Vesting Coins: %v\n", vestingCoins) + // Display locked & spendable funds + lockedCoins := keepers.BankKeeper.LockedCoins(ctx, accAddr) + fmt.Printf("Locked Coins: %v\n", lockedCoins) + spendableCoins := keepers.BankKeeper.SpendableCoins(ctx, accAddr) + fmt.Printf("Spendable Coins: %v\n", spendableCoins) + // Instantly complete any re-deleations. amt, err := completeAllRedelegations(ctx, now, keepers, accAddr) if err != nil { @@ -47,7 +53,10 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep // Pre transfer balance councilBeforeBal := keepers.BankKeeper.GetBalance(ctx, councilAccAddr, bondDenom) - // Moves unvested tokens to the Core-1 SubDAO. + // Set the vesting account to a base account + keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) + + // Moves vesting tokens to the council. if err := transferUnvestedTokensToCouncil(ctx, keepers, accAddr, councilAccAddr, vestingCoins); err != nil { return err } @@ -57,9 +66,6 @@ func MoveVestingCoinFromVestingAccount(ctx sdk.Context, keepers *keepers.AppKeep fmt.Printf("Council Balance Before: %v\n", councilBeforeBal) fmt.Printf("Council Balance After: %v\n", councilAfterBal) - // Set the vesting account to a base account - keepers.AccountKeeper.SetAccount(ctx, vacc.BaseAccount) - // Ensure the post validation checks are met. err = postValidation(ctx, keepers, bondDenom, owner, accAddr, councilAccAddr, vestingCoins, councilBeforeBal) return err