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

[CL]: Add sqrtPrice check to swaps_test #3989

Closed
czarcas7ic opened this issue Jan 12, 2023 · 0 comments
Closed

[CL]: Add sqrtPrice check to swaps_test #3989

czarcas7ic opened this issue Jan 12, 2023 · 0 comments
Assignees
Labels
C:x/concentrated-liquidity F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board

Comments

@czarcas7ic
Copy link
Member

czarcas7ic commented Jan 12, 2023

Background

#3874 (comment)

Suggested Design

See the CalcOutAmtGivenInInternal function here

_, tokenIn, tokenOut, updatedTick, updatedLiquidity, _, err := s.App.ConcentratedLiquidityKeeper.CalcOutAmtGivenInInternal(

As well as the SwapOutAmtGivenIn function here

tokenIn, tokenOut, updatedTick, updatedLiquidity, _, err = s.App.ConcentratedLiquidityKeeper.SwapOutAmtGivenIn(

We currently do not check the return value of the newSqrtPrice. We need to do the following:

  • Either manually calculate the correct sqrtPrice / calculate with sage
  • Add a check to TestCalcAndSwapOutAmtGivenIn to ensure the resulting sqrtPrice is what we expect it to be for every test case

Everything said above must also be applied TestCalcAndSwapInAmtGivenOut, CalcInAmtGivenOutInternal, and SwapInAmtGivenOut.

The values calculated for TestCalcAndSwapOutAmtGivenIn though should be the same for TestCalcAndSwapInAmtGivenOut, so should just be a copy and paste job after that.

Acceptance Criteria

  • Calc and Swap functions are checked for all test cases for both In/Out Out/In mutative and non mutative methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/concentrated-liquidity F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board
Projects
Archived in project
Development

No branches or pull requests

3 participants