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

test(CL): rewards logic to work on the extended price range #6328

Merged
merged 18 commits into from
Sep 8, 2023

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Sep 6, 2023

Closes: #6320

What is the purpose of the change

Adds tests for collecting spread and incentive rewards. The test structure is similar to #6327

We attempt to swap to new min tick and back. Then, for positions defined over that range, we collect spread and incentive rewards and assert that the total is as expected

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

@p0mvn p0mvn added V:state/compatible/no_backport State machine compatible PR, depends on prior breaks A:no-changelog labels Sep 6, 2023
// There are 3 positions setup over the swapped range (see setupPositionsForMinSpotPriceMigration for details).
// Additionally, spread factor and incentive rewards are configurable as parameters.
// Returns pool id position data and actual tokens swapped in (in zero for one direction and back).
func (s *KeeperTestSuite) swapToMinTickAndBack(spreadFactor osmomath.Dec, incentiveRewards sdk.Coins) (poolId uint64, positions []cl.CreatePositionData, actualAmountsSwappedIn sdk.Coins) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to reviewer: the majority of the setup is extracted from TestSwap_MinSpotPriceMigration

@p0mvn p0mvn marked this pull request as ready for review September 6, 2023 20:47
@p0mvn
Copy link
Member Author

p0mvn commented Sep 6, 2023

Please do not merge before #6327

Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

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

Nice work, LGTM

x/concentrated-liquidity/keeper_test.go Show resolved Hide resolved
@p0mvn p0mvn force-pushed the roman/min-spot-price-swap-tests branch from a2dbf41 to 7bd6801 Compare September 8, 2023 16:33
Base automatically changed from roman/min-spot-price-swap-tests to main September 8, 2023 20:29
@p0mvn p0mvn merged commit 3b5d993 into main Sep 8, 2023
@p0mvn p0mvn deleted the roman/min-spt-price-rewards-tests branch September 8, 2023 20:47
czarcas7ic added a commit that referenced this pull request Oct 12, 2023
@czarcas7ic czarcas7ic mentioned this pull request Oct 12, 2023
czarcas7ic added a commit that referenced this pull request Oct 12, 2023
czarcas7ic added a commit that referenced this pull request Oct 13, 2023
* revert 6b3273f

* Revert "refactor/test(CL): LP methods with lower min spot price (#6323)"

This reverts commit 013cd96.

* Revert "test(CL): rewards logic to work on the extended price range (#6328)"

This reverts commit 3b5d993.

* adds check back to fuzzer

* Revert "test(CL): swap to new min tick and back (#6327)"

This reverts commit e2ef44f.

* remove unused imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:no-changelog C:x/concentrated-liquidity V:state/compatible/no_backport State machine compatible PR, depends on prior breaks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test(CL): rewards logic to work on the extended price range
2 participants