-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat(v0.4.x): unbond tokens when dissolving the alliance #294
Conversation
7a7de12
to
989741b
Compare
…/alliance into feat/v0.4.x/unbond-on-delete
…/alliance into feat/v0.4.x/unbond-on-delete
…/alliance into feat/v0.4.x/unbond-on-delete
if err != nil { | ||
return nil, err | ||
if asset.TotalTokens.GT(math.ZeroInt()) { | ||
asset.IsDissolving = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WHen deleting an asset, we should make it such that we disable the rewards as well. I'm thinking we set the reward weight to be zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.... Good point!
// the alliance has never had delegations or that all the delegations have been unbonded already, | ||
// so going back to the line 52 of this file we avoid doing unnecessary comput. | ||
if amountOfUndelegationsExecuted == 0 { | ||
dereferencedAsset.IsInitialized = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should delete the alliance asset instead of setting IsInitialized
to be false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiersuweijie shouldn't the alliance be deleted only when all the tokens have been unbonded?
…o feat/v0.4.x/unbond-on-delete
This pull request allow Alliances to be deleted even when there are still tokens staked. The flow starts when DeleteAllianceProposal is executed:
if there is no stake
: it will just delete the alliance,else
: will set the alliance to dissolving state.In the
ABCI#EndBlocker
fromx/alliance
: iterates the alliances in search of the ones with the dissolving flag enabled, when an alliance with the dissolving flag is found, all delegations are iterated matching the Denom of the delegation with the Denom of the alliance; when a match is found it will delegate that stake and assign to the alliance theallianceDissolutionTime
as the completion time of the unbonding.isInitialised property from alliance to false
(the alliance will also not receive more rewards when the flag is set to false.