-
Notifications
You must be signed in to change notification settings - Fork 632
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: transfer cl position to new owner #6623
Conversation
@devbot-wizard help |
Hi! I'm DevBot, a bot that helps with common tasks in the development process. Commands:
|
Important Notice This PR modifies an in-repo Go module. It is one of:
The dependent Go modules, especially the root one, will have to be Please follow the instructions below:
Please let us know if you need any help. |
devbot add changelog feat |
…fied dependencies locally
// Early return, emit no events if there is no spread rewards to claim. | ||
if spreadRewardsClaimed.IsZero() { | ||
return sdk.Coins{}, nil | ||
} | ||
|
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.
Slightly unrelated to this PR, but I think the change makes sense. I realized we would emit a bank send event coming from collecting spread rewards on every call, even when there are no spread rewards to claim. This logic added is similar to the incentives claiming logic that ends early if there are no incentives to claim.
if !collectedIncentivesForPosition.IsZero() { | ||
if err := k.bankKeeper.SendCoins(ctx, pool.GetIncentivesAddress(), sender, collectedIncentivesForPosition); err != nil { | ||
return sdk.Coins{}, sdk.Coins{}, err | ||
} | ||
} | ||
|
||
// Send the forfeited incentives to the community pool from the pool's address. | ||
err = k.communityPoolKeeper.FundCommunityPool(ctx, forfeitedIncentivesForPosition, pool.GetIncentivesAddress()) | ||
if err != nil { | ||
return sdk.Coins{}, sdk.Coins{}, err | ||
if !forfeitedIncentivesForPosition.IsZero() { | ||
err = k.communityPoolKeeper.FundCommunityPool(ctx, forfeitedIncentivesForPosition, pool.GetIncentivesAddress()) | ||
if err != nil { | ||
return sdk.Coins{}, sdk.Coins{}, err | ||
} |
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.
Similar to the comment above, there is no need to run this logic and emit events if the value is zero.
…fied dependencies locally
…fied dependencies locally
Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Roman <[email protected]>
…fied dependencies locally
@@ -159,7 +160,7 @@ func (s *KeeperTestSuite) TestAddToPosition_Events() { | |||
}{ | |||
"happy path": { | |||
expectedAddedToPositionEvent: 1, | |||
expectedMessageEvents: 5, | |||
expectedMessageEvents: 4, |
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.
Do we know what caused the drop here?
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.
Now that we do an early return on spread rewards claim when there are no spread rewards, we emit one less event.
return types.PositionOwnerMismatchError{PositionOwner: position.Address, Sender: sender.String()} | ||
} | ||
|
||
// If the position has an active underlying lock, we cannot transfer it. |
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.
To clarify, the implication is that superfluid positions can't be transferred right?
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.
This is correct, it is beyond the scope of requirements for this feature
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.
LGTM.
I'm wondering if we could integrate this into the fuzz test suite to ensure the system continues being operational after position transfers.
Additionally, we should make sure that we test this on edgenet where bug bash would be happening
position, err := s.App.ConcentratedLiquidityKeeper.GetPosition(ctx, positionId) | ||
s.Require().NoError(err) | ||
|
||
// We fund the account with roundedInt because, there occurs |
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.
incomplete sentence
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.
comment was outdated, I meant to remove the entire thing when I no longer funded with roundedInt but only removed it partially. Fixed here 04a3a68
…fied dependencies locally
Added transfer position to fuzz test 0b8367a |
* transer cl position * Auto: update go.mod after push to adam/transfer-position-cl that modified dependencies locally * changelog * remove commented out logic * Update CHANGELOG.md * add godoc and test for ParseUint64SliceToString * add godoc * add incentives and spread rewards to message server test * expand message server test * further expand test * godoc * Auto: update go.mod after push to adam/transfer-position-cl that modified dependencies locally * use helper methods * modify array diff method * Auto: update go.mod after push to adam/transfer-position-cl that modified dependencies locally * address test * last test fix * Update x/concentrated-liquidity/client/cli/tx.go Co-authored-by: Matt, Park <[email protected]> * Update osmoutils/compare.go Co-authored-by: Roman <[email protected]> * rename all uses * sort the result, add tests for both sorted and unsorted * extend tests * unrelated lint * add testing invariants comment to TestTransferPositions * add why actual amount should be less than expected * Auto: update go.mod after push to adam/transfer-position-cl that modified dependencies locally * regen docs * comment explaining trasferPosition in proto * add fixed gas consumption * fix scaling gas charge and add parser test case * Auto: update go.mod after push to adam/transfer-position-cl that modified dependencies locally * remove incorrect comment * tidy osmomath * transfer random position --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: Matt, Park <[email protected]> Co-authored-by: Roman <[email protected]> Co-authored-by: alpo <[email protected]>
Closes: #6541
What is the purpose of the change
Allows a user to provide a list of position IDs that they own, collect all rewards, and transfer the ownership of that position to a new address.
This is achieved slightly different than how the issue described. Instead of withdrawing and creating a new position, we change the necessary state entries. The method described in the issue was discarded when I realized the amount of the liquidity the position has before and after withdrawing would never be 1:1, while the method done here achieves an exact duplicate of the position, with the only change being the owner.
Some drive by changes:
Testing and Verifying
Rigorous testing done on the method itself as well as the events that are emitted, and any method that was created in this PR.
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)