Skip to content
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

Partial unlocking implementation #893

Merged
merged 5 commits into from
Feb 19, 2022
Merged

Partial unlocking implementation #893

merged 5 commits into from
Feb 19, 2022

Conversation

mconcat
Copy link
Collaborator

@mconcat mconcat commented Feb 17, 2022

TODO

  • logic impl
  • testing

Description


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@mattverse
Copy link
Member

It might help, the old PR #543 has partial unlocking implemented that you can reference to!

@mconcat mconcat marked this pull request as ready for review February 18, 2022 06:56
@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 83.33333% with 7 lines in your changes missing coverage. Please review.

Project coverage is 21.69%. Comparing base (b990199) to head (583e912).
Report is 3349 commits behind head on main.

Files with missing lines Patch % Lines
x/lockup/keeper/lock.go 81.81% 3 Missing and 3 partials ⚠️
x/lockup/keeper/msg_server.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
+ Coverage   20.38%   21.69%   +1.30%     
==========================================
  Files         192      192              
  Lines       24783    25626     +843     
==========================================
+ Hits         5053     5559     +506     
- Misses      18798    19065     +267     
- Partials      932     1002      +70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -59,9 +60,17 @@ func (k Keeper) GetAllSyntheticLockupsByLockup(ctx sdk.Context, lockID uint64) [
return synthLocks
}

func (k Keeper) HasAnySyntheticLockups(ctx sdk.Context, lockID uint64) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is a good fn to have!

Comment on lines +244 to +246
locked = suite.app.LockupKeeper.GetAccountLockedCoins(suite.ctx, addr1)
suite.Require().Equal(len(locked), 1)
suite.Require().Equal(locked[0].Amount.Int64(), int64(10))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this by 9?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetAccountLockedCoins returns all coins that is qualified for reward, so it includes unlocking coins. Will add logic for checking 9 case!

mconcat and others added 2 commits February 18, 2022 21:09
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
@ValarDragon ValarDragon merged commit debeb29 into main Feb 19, 2022
@ValarDragon ValarDragon deleted the mconcat/partial-unlock branch February 19, 2022 07:19
UnityChaos pushed a commit that referenced this pull request Feb 20, 2022
* add partial unlock logic

* add partial unlock test

* fix lint

* Apply suggestions from code review

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* add test for case after unlocking period

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Mar 15, 2024
@github-actions github-actions bot mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants