-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[future] Move core-1 vesting -> contracts #660
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app/upgrades/v15/upgrades.go
Outdated
Comment on lines
106
to
161
for address, memberName := range vestingAccounts { | ||
fmt.Println(address, memberName) | ||
|
||
addr, err := sdk.AccAddressFromBech32(address) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
acc := keepers.AccountKeeper.GetAccount(ctx, addr) | ||
if acc == nil { | ||
panic("account not found") | ||
} | ||
// ensure this is a vesting account. | ||
|
||
// Does this work for vesting accounts as well under the hood? | ||
preVestedCoin := MoveVestingCoinFromVestingAccount(ctx, addr, keepers, core1SubDaoAddr) | ||
fmt.Printf("moved %d ujuno from %s to %s\n", preVestedCoin.Amount.Int64(), address, core1SubDaoAddr) | ||
|
||
// delete the old vesting base account | ||
keepers.AccountKeeper.RemoveAccount(ctx, acc) | ||
|
||
// Now funds are in Core-1 Subdao Control, and we can instantiate a vesting contract on behalf of the subdao for the amount stated | ||
|
||
// start_time is NOT set as it is Optional. Sets when it is instantiated in nano seconds. | ||
msg := fmt.Sprintf(`{"owner":"%s","recipient":"%s","title":"%s","description":"Core-1 Vesting","total":%d,"denom":{"native":"ujuno"}},"schedule":"saturating_linear","unbonding_duration_seconds":%d,"vesting_duration_seconds":%d}`, | ||
core1SubDaoAddr, | ||
address, | ||
memberName, | ||
preVestedCoin.Amount.Int64(), | ||
junoUnbondingSeconds, | ||
vestingDurationSeconds, | ||
) | ||
|
||
// set as label vest_to_juno1addr_1682213004408 where the ending is the current epoch time of prev block | ||
// also pass through funds which must == total. | ||
|
||
coins := []sdk.Coin{ | ||
sdk.NewCoin("ujuno", sdk.NewInt(preVestedCoin.Amount.Int64())), | ||
} | ||
|
||
// use wasmtypes.ContractOpsKeeper here instead of permissioned keeper? or does it matter since we are permissionless anyways | ||
contractAddr, _, err := keepers.ContractKeeper.Instantiate( | ||
ctx, | ||
uint64(vestingCodeID), | ||
sdk.MustAccAddressFromBech32(core1SubDaoAddr), | ||
sdk.MustAccAddressFromBech32(core1SubDaoAddr), | ||
[]byte(msg), | ||
fmt.Sprintf("vest_to_%s_%d", address, currentUnixSeconds), | ||
coins, | ||
) | ||
fmt.Println("Contract Created for:", contractAddr, address, memberName, "With ujuno Amount:", preVestedCoin.Amount.Int64()) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
} |
Check warning
Code scanning / CodeQL
Iteration over map
Iteration over map may be a possible source of non-determinism
Archive, will do after v47 upgrade |
Reecepbcups
changed the title
[v15] Move core-1 vesting -> contracts
[future] Move core-1 vesting -> contracts
May 10, 2023
note: the "changes" commit refers to changes after the merge. Attempted to make zero changes to the migration of c1 vesting -> contracts |
Using new logic in PR 741 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #648
POSTPONED While we put the SDK v47 upgrade as top priority.
NOTE: scrap most of this in favor of PR 725 approach in the future.
TODO:
Flow: