Skip to content

Commit

Permalink
EstimateTradeBasedOnPriceImpact Query (#6167)
Browse files Browse the repository at this point in the history
* query: user<>clPool positions breakdown for superfluid (#5600) (#5607)

* add user-pool position breakdown for superfluid

* fix godoc

* add basic test

* slightly expand test

* remove defense in depth

* use osmoutils

* error with locked but non superfluid positions

(cherry picked from commit bab837cbac92f08661d8474101b46597b2a379e5)

Co-authored-by: Adam Tucker <[email protected]>

* Remove unused state-sync github action (#5604) (#5605)

(cherry picked from commit 7c28d79b86964f9f8610ec5d506f47f64f43fc56)

Co-authored-by: Niccolo Raspa <[email protected]>

* fix: remove duplicate suite (#5610) (#5613)

(cherry picked from commit 7ed01124aa798932a8465e18c80f1b87ffdc533f)

Co-authored-by: Roman <[email protected]>

* chore: remove tf bank hooks from v16.x (#5614)

* Improve build Github Actions (#5603) (#5618)

(cherry picked from commit 362af3158430c11963df78e44a0abf5dfe03690a)

Co-authored-by: Niccolo Raspa <[email protected]>

* [ci] Paralleze go tests github actions (#5602) (#5619)

* Paralleze go tests

* Speculative execution of go-split-test-files to save time

* Revert "Speculative execution of go-split-test-files to save time"

This reverts commit ca5ea6f20f4e23ba2e6af68db85295fb6f4d9540.

(cherry picked from commit 35f54cb9b3b398176bfdbaf6c2fdb7dad1a5e2da)

Co-authored-by: Niccolo Raspa <[email protected]>

* Ci improvements/remove double caching (#5620) (#5622)

* Remove double caching from test github action

* Remove double caching from build github action + separate go mod download

* Update get-diff patterns in build action

* remove duplicate caching in update-go-import github action

* Rename github action

* remove duplicate caching in test-e2e-makefile

* remove duplicate caching in lint

(cherry picked from commit 24f580da12272205fab04afbd97c7a87f5b7dc56)

Co-authored-by: Niccolo Raspa <[email protected]>

* Remove proto deserialization from HasPosition (#5616) (#5629)

* Remove proto deserialization from HasPosition

* regenerate go mod

---------

Co-authored-by: alpo <[email protected]>
(cherry picked from commit 7df187a3ab9116621fbefadc71dfe19721e22f48)

Co-authored-by: Dev Ojha <[email protected]>

* Update swagger gen (#5626)

* Backport: Emited IBC errors should also be logged (#5480) (#5632)

* backporting adding errors to logs

* hardcoded string as const

(cherry picked from commit 80bf16e8441d5dde1fa9680d162cdddd09c53711)

Co-authored-by: Nicolas Lara <[email protected]>

* fix: upgrade handler dai amount change (#5633) (#5640)

* upgrade handler dai amount change

* update comment

* fix test

* update error margin

* 73 cent spot price

* update e2e json

* update init config

* just need v15 init image now

* update v15 init image

(cherry picked from commit e9f0b1eddbebc4481e212db442ed9ae9b52f4517)

Co-authored-by: Adam Tucker <[email protected]>

* repro infinite loop in swap logic (#5609) (#5649)

(cherry picked from commit 3607b3a55d2fcb6ad9e1e21ab28ec69e9879f153)

Co-authored-by: alpo <[email protected]>

* misc: final cleanup from audit results (#5641) (#5651)

Closes: #XXX

## What is the purpose of the change
This PR includes the final changes from audit results

## Testing and Verifying
Ensured that existing test cases pass
## 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

(cherry picked from commit ed8ed777a83ec54f4aaf7844310a0e4e8148c263)

Co-authored-by: Matt, Park <[email protected]>

* Revert "Optimize Genesis for CL Module (#5453)" (#5631) (#5653)

This reverts commit 70b2fff7a53a20c51b3cd1da8317d4264ea6f629.

(cherry picked from commit d8945575c0bad1a0b8860b0fbad802c2f2a3663e)

Co-authored-by: Adam Tucker <[email protected]>

* Reduce clmath test compilation time, fix discrepancy in rounding (#5650) (#5652)

* Reduce clmath test compilation time, fix discrepancy in rounding

* remove unneeded helper

(cherry picked from commit 9f7b70b0ac276261b7e3bf16ad1f6e0e159f28be)

Co-authored-by: Dev Ojha <[email protected]>

* fix: modify v16 upgrade handler (#5659) (#5660)

* modify upgrade handler

* update test

* fund community pool 1dai before upgrade e2e

* fund chain b as well

* test added

(cherry picked from commit 6138de4fdfeb2330d30ad1f5e43f232b6cb15f15)

Co-authored-by: Adam Tucker <[email protected]>

* Update test script deps (#5658) (#5661)

* update test script deps

* another update

(cherry picked from commit 13cb7e7d2f86d7a0d796bd597fbf8df3bf963748)

Co-authored-by: Jon Ator <[email protected]>

* Fix testing errors in tick tests (#5662) (#5666)

* Fix testing errors in tick tests

* Fix remaining case

* generate more test vectors rather than hardcode

* delete more unneeded lines

(cherry picked from commit d7336b5e60f8f7d0b48e64617dbc354e05b1288b)

Co-authored-by: Dev Ojha <[email protected]>

* fix: cl sf positions per user per pool query (#5668) (#5669)

* check if lock is mature in sf query

* check if lock has matured in query

* Update position.go

* simpler change

(cherry picked from commit 0b7700a4558c0418499395055166526c2f916874)

Co-authored-by: Adam Tucker <[email protected]>

* upgrade handler ascii (#5671) (#5676)

(cherry picked from commit 0a867a8e535e5c9e02ed37886720160cb1ffa192)

Co-authored-by: Adam Tucker <[email protected]>

* sf positions cl patch (#5682) (#5683)

* Introduce ResetTest, use in CL for 2x test speedup (#5611) (#5689)

* Introduce ResetTest, use in CL for 2x test speedup

* now 3.8 seconds

* remove extraneous setupTest calls

* reduce gamm test time

* speedup more of gamm

* driveby invariant test speedup

* remove extra println

* undo ResetTest being a separate fn

* same dev UX improvement to gamm

* Add comments

(cherry picked from commit 28a12d0b441796dc3df0e3fe4ab4dd854abb5027)

Co-authored-by: Dev Ojha <[email protected]>

* refactor/fix: swap step iteration limit (#5647) (#5688)

* repro infinite loop in swap logic

* refactor/fix: swap step iteration limit

* Update x/concentrated-liquidity/swaps_test.go

Co-authored-by: Adam Tucker <[email protected]>

* swap limit to 100

* clearer comments

* Update x/concentrated-liquidity/swaps.go

Co-authored-by: alpo <[email protected]>

* Update x/concentrated-liquidity/types/errors.go

Co-authored-by: alpo <[email protected]>

---------

Co-authored-by: alpo <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: alpo <[email protected]>
(cherry picked from commit a593f6aea6a1e8612f376dc58debfea2a692fbe7)

Co-authored-by: Roman <[email protected]>

* Driveby apptesting changes I made, while looking at other testing things (#5617) (#5667)

* Driveby apptesting changes I made, while looking at other testing things

* undo one change

* Fix failing test

* Fix gamm test

(cherry picked from commit 1b317e49a8f24e425a15f5429fe3602b228ed113)

Co-authored-by: Dev Ojha <[email protected]>

* Add redirect tosnapshot endpoint, add our public nodes addrbook (#5699) (#5708)

(cherry picked from commit e3466fcb8239ac96562fd82d04e9bdaa5cde7c63)

Co-authored-by: Niccolo Raspa <[email protected]>

* chore: query total liquidity across all cl pools (#5670) (#5709)

* query total liquidity across all cl pools

* add total liquidity across all three pool types

* query gen

* query gen

* use O(n) time total liquidity query

* add store entry

* no need to store total liq in genesis

(cherry picked from commit e44b5cda1db7094b7e091e49318d1262449d79ad)

Co-authored-by: Adam Tucker <[email protected]>

* chore: cl unbonding positions query (#5684) (#5711)

* cl unbonding positions query

* cl unbonding positions query

* regen proto

* add basic test

* chore: sf undelegating / delegated cl queries (#5691)

* undelegating / delegated cl queries

* correct comment

* remove switch and add errors.Is

* Update proto/osmosis/superfluid/query.proto

Co-authored-by: Jon Ator <[email protected]>

* Update proto/osmosis/superfluid/query.proto

Co-authored-by: Jon Ator <[email protected]>

* rename to delegate in place of bond

* fix errors Is

---------

Co-authored-by: Jon Ator <[email protected]>

* remove switch statement

* add position id to error

* add synth lock to q

* regen proto

---------

Co-authored-by: Jon Ator <[email protected]>
(cherry picked from commit f9b3cc10422b12d17b3620c5e1004628ca39c943)

Co-authored-by: Adam Tucker <[email protected]>

* precision increase solution to infinite loop bug (#5612) (#5712)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* add zero for one swap strategy ULP tests

* typo

* remove errors

* remove prints

---------

Co-authored-by: alpo <[email protected]>
(cherry picked from commit 950fd12f44330680fc5e90aa135679484f811260)

Co-authored-by: Roman <[email protected]>

* Add lock reward receiver testing script, add minor fix for cli command (#5687) (#5692)

* Add lock reward receiver

* Fix typo

(cherry picked from commit d5fcd089a71c39cdad0ffe6b3c9a2fcac30be1d6)

Co-authored-by: Matt, Park <[email protected]>

* refactor/security: prevent same execution price exploit within the same ULP (#5693) (#5713)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* refactor/security: prevent same execution price exploit within the same ULP

* add zero for one swap strategy ULP tests

* typo

* remove errors

* remove prints

* typos

* typo

---------

Co-authored-by: alpo <[email protected]>
(cherry picked from commit cf223be21b8530b28a326c4d0738e8dc5d0f63f2)

Co-authored-by: Roman <[email protected]>

* fix(CL): negative amount out consumed (#5695) (#5714)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* refactor/security: prevent same execution price exploit within the same ULP

* repro for negative amount consumed

* updates

* core fix, tests and code comments

* add zero for one swap strategy ULP tests

* fix zero for one test

* typo

* remove errors

* remove prints

* typos

* typo

* remove obsolete comment

---------

Co-authored-by: alpo <[email protected]>
(cherry picked from commit c00ead89801fe79b4471ac91643cdf70fd8f96e9)

Co-authored-by: Roman <[email protected]>

* Speedup approx script (#5654) (#5720)

* Speedup approx script

* further spedup

(cherry picked from commit 83d2edfef2ed84e253a96a06e073c835eb25b4c3)

Co-authored-by: Dev Ojha <[email protected]>

* chore: update sdk fork dep (backport #5716) (#5718)

Co-authored-by: Roman <[email protected]>

* [CL: Audit] Superfluid Migration audit / cleanup (#5615) (#5717)

* issue no lock send

* added verbose test

* audit progress

* lock handling case

* investigating calculation

* cleanup

* locked LP shares issue

* added issue

* issue fixed

* cleanup

* more cleanup

* Update x/superfluid/keeper/migrate.go

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

---------

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Matt, Park <[email protected]>
(cherry picked from commit a923e6c6f898c5401c35727fbf3990790fa1c7ba)

Co-authored-by: Sishir Giri <[email protected]>

* CLI fix: `create-gauge` exact args (#5663) (#5719)

* fix: increment exact args

* add more desc

(cherry picked from commit 893403f6415991b8eb418efe7b415e585df053fb)

Co-authored-by: Jon Ator <[email protected]>

* fix: cw pool import export genesis (backport #5696) (#5715)

* Remove unused state-sync github action (#5604)

* query: user<>clPool positions breakdown for superfluid (#5600)

* add user-pool position breakdown for superfluid

* fix godoc

* add basic test

* slightly expand test

* remove defense in depth

* use osmoutils

* error with locked but non superfluid positions

* fix: remove duplicate suite (#5610)

* Introduce ResetTest, use in CL for 2x test speedup (#5611)

* Introduce ResetTest, use in CL for 2x test speedup

* now 3.8 seconds

* remove extraneous setupTest calls

* reduce gamm test time

* speedup more of gamm

* driveby invariant test speedup

* remove extra println

* undo ResetTest being a separate fn

* same dev UX improvement to gamm

* Add comments

* Improve build Github Actions (#5603)

* [ci] Paralleze go tests github actions (#5602)

* Paralleze go tests

* Speculative execution of go-split-test-files to save time

* Revert "Speculative execution of go-split-test-files to save time"

This reverts commit ca5ea6f20f4e23ba2e6af68db85295fb6f4d9540.

* Ci improvements/remove double caching (#5620)

* Remove double caching from test github action

* Remove double caching from build github action + separate go mod download

* Update get-diff patterns in build action

* remove duplicate caching in update-go-import github action

* Rename github action

* remove duplicate caching in test-e2e-makefile

* remove duplicate caching in lint

* [CL]: Expand randomized position range tests to include incentive records (#5559)

* draft incentive record setup and tracking

* implement assertions and clean up base logic

* chore(deps): bump tj-actions/changed-files from 36.4.0 to 37.0.2 (#5625)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 36.4.0 to 37.0.2.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v36.4.0...v37.0.2)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove proto deserialization from HasPosition (#5616)

* Remove proto deserialization from HasPosition

* regenerate go mod

---------

Co-authored-by: alpo <[email protected]>

* Add CI to generate and update docs (#5627)

* Update docs

* Change to on push

* Backport: Emited IBC errors should also be logged (#5480)

* backporting adding errors to logs

* hardcoded string as const

* Add github action to remove old workflow run (#5621)

* fix: upgrade handler dai amount change (#5633)

* upgrade handler dai amount change

* update comment

* fix test

* update error margin

* 73 cent spot price

* update e2e json

* update init config

* just need v15 init image now

* update v15 init image

* chore(deps): bump actions/setup-go from 2 to 4 (#5635)

* chore(deps): bump actions/setup-go from 2 to 4

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update generate-docs.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jacob Gadikian <[email protected]>

* chore(deps): bump peter-evans/create-pull-request from 3 to 5 (#5638)

Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 5.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v3...v5)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump actions/setup-node from 2 to 3 (#5637)

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2 to 3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add images to README.md in tokenfactory module (#5594)

Co-authored-by: alessandromazza <[email protected]>
Co-authored-by: niilptr <[email protected]>

* repro infinite loop in swap logic (#5609)

* misc: final cleanup from audit results (#5641)

Closes: #XXX

## What is the purpose of the change
This PR includes the final changes from audit results

## Testing and Verifying
Ensured that existing test cases pass
## 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

* Reduce clmath test compilation time, fix discrepancy in rounding (#5650)

* Reduce clmath test compilation time, fix discrepancy in rounding

* remove unneeded helper

* Revert "Optimize Genesis for CL Module (#5453)" (#5631)

This reverts commit 70b2fff7a53a20c51b3cd1da8317d4264ea6f629.

* Speedup approx script (#5654)

* Speedup approx script

* further spedup

* fix: modify v16 upgrade handler (#5659)

* modify upgrade handler

* update test

* fund community pool 1dai before upgrade e2e

* fund chain b as well

* test added

* Update test script deps (#5658)

* update test script deps

* another update

* CLI fix: `create-gauge` exact args (#5663)

* fix: increment exact args

* add more desc

* Fix testing errors in tick tests (#5662)

* Fix testing errors in tick tests

* Fix remaining case

* generate more test vectors rather than hardcode

* delete more unneeded lines

* Driveby apptesting changes I made, while looking at other testing things (#5617)

* Driveby apptesting changes I made, while looking at other testing things

* undo one change

* Fix failing test

* Fix gamm test

* [CL: Audit] Superfluid Migration audit / cleanup (#5615)

* issue no lock send

* added verbose test

* audit progress

* lock handling case

* investigating calculation

* cleanup

* locked LP shares issue

* added issue

* issue fixed

* cleanup

* more cleanup

* Update x/superfluid/keeper/migrate.go

* Update x/superfluid/keeper/migrate.go

Co-authored-by: Matt, Park <[email protected]>

---------

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Matt, Park <[email protected]>

* fix: cl sf positions per user per pool query (#5668)

* check if lock is mature in sf query

* check if lock has matured in query

* Update position.go

* simpler change

* upgrade handler ascii (#5671)

* update scripts (#5677)

* sf positions cl patch (#5682)

* refactor/fix: swap step iteration limit (#5647)

* repro infinite loop in swap logic

* refactor/fix: swap step iteration limit

* Update x/concentrated-liquidity/swaps_test.go

Co-authored-by: Adam Tucker <[email protected]>

* swap limit to 100

* clearer comments

* Update x/concentrated-liquidity/swaps.go

Co-authored-by: alpo <[email protected]>

* Update x/concentrated-liquidity/types/errors.go

Co-authored-by: alpo <[email protected]>

---------

Co-authored-by: alpo <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: alpo <[email protected]>

* chore(deps): bump actions/labeler from 4.1.0 to 4.2.0 (#5685)

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/4.1.0...v4.2.0)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add lock reward receiver testing script, add minor fix for cli command (#5687)

* Add lock reward receiver

* Fix typo

* Add redirect tosnapshot endpoint, add our public nodes addrbook (#5699)

* chore: query total liquidity across all cl pools (#5670)

* query total liquidity across all cl pools

* add total liquidity across all three pool types

* query gen

* query gen

* use O(n) time total liquidity query

* add store entry

* no need to store total liq in genesis

* chore: cl unbonding positions query (#5684)

* cl unbonding positions query

* cl unbonding positions query

* regen proto

* add basic test

* chore: sf undelegating / delegated cl queries (#5691)

* undelegating / delegated cl queries

* correct comment

* remove switch and add errors.Is

* Update proto/osmosis/superfluid/query.proto

Co-authored-by: Jon Ator <[email protected]>

* Update proto/osmosis/superfluid/query.proto

Co-authored-by: Jon Ator <[email protected]>

* rename to delegate in place of bond

* fix errors Is

---------

Co-authored-by: Jon Ator <[email protected]>

* remove switch statement

* add position id to error

* add synth lock to q

* regen proto

---------

Co-authored-by: Jon Ator <[email protected]>

* precision increase solution to infinite loop bug (#5612)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* add zero for one swap strategy ULP tests

* typo

* remove errors

* remove prints

---------

Co-authored-by: alpo <[email protected]>

* refactor/security: prevent same execution price exploit within the same ULP (#5693)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* refactor/security: prevent same execution price exploit within the same ULP

* add zero for one swap strategy ULP tests

* typo

* remove errors

* remove prints

* typos

* typo

---------

Co-authored-by: alpo <[email protected]>

* fix(CL): negative amount out consumed (#5695)

* repro infinite loop in swap logic

* precision increase solution to infinite loop bug

* fix

* remove logic

* remove error

* updates

* updates

* updates

* updates

* begin switching zeroForOneStrategy.ComputeSwapWithinBucketInGivenOut

* switch remaining zero for one swap step and add rounding comments

* begin switching cur sqrt price to big dec in swaps

* try adding CalculateSqrtPriceToTickBigDec

* one for zero out given in tests

* fix one for zero tests

* update one for zero tests

* in-progress test

* updates

* fix TestComputeSwapStepOutGivenIn_ZeroForOne

* fix TestComputeSwapStepInGivenOut_ZeroForOne

* convert current sqrt price to BigDec and resolve syntax errors

* updates

* clean up

* clean ups

* clean ups

* fix TestComputeSwapState_Inverse

* comment

* updates

* clean ups

* remove unused function

* remove unused GetNextSqrtPriceFromAmount1OutRoundingDown

* switch GetNextSqrtPriceFromAmount0InRoundingUp to big dec

* fully convert GetNextSqrtPriceFromAmount0OutRoundingUp to big dec

* clean up math tests more

* more math test clean up

* fully convert calc methods to big dec

* fix model package tests

* fix TestAddToPosition

* fix TestCalculateSpotPrice

* fix TestSingleSidedAddToPosition

* fix TestUninitializePool

* go mod update

* big dec comparison correction and prints

* fix equality issues

* convert tests to big dec

* fix a few swap tests

* small e2e fix

* more swap test fixes

* updates

* fix another test

* please get fixed

* fix all out given in swap tests

* e2e

* fix all one for zero in given out

* I can fix you

* clean ups

* MulRoundUp test

* test SDKDecRoundUp

* clean up

* revert launch.json

* comment

* refactor/security: prevent same execution price exploit within the same ULP

* repro for negative amount consumed

* updates

* core fix, tests and code comments

* add zero for one swap strategy ULP tests

* fix zero for one test

* typo

* remove errors

* remove prints

* typos

* typo

* remove obsolete comment

---------

Co-authored-by: alpo <[email protected]>

* fix: cw pool import export genesis (#5696)

* cw pool genesis fix and change liq query

* keep liquidity check linear

* set codec

* set wasm keeper per pool and add genesis test

* remove prints and dead code

* revert set pool

* add Roman's fix

* add GetPoolsWithWasmKeeper

* use get pools

* fix: cw pool import export genesis (#5696)

* cw pool genesis fix and change liq query

* keep liquidity check linear

* set codec

* set wasm keeper per pool and add genesis test

* remove prints and dead code

* revert set pool

* add Roman's fix

* add GetPoolsWithWasmKeeper

* use get pools

(cherry picked from commit d0a851b56d360a6340c8d608c9ccdfec1b2c9610)

# Conflicts:
#	x/superfluid/keeper/migrate.go

* chore: update sdk fork dep (#5716)

* fix merge issue

* Revert "Merge branch 'main' into mergify/bp/v16.x/pr-5696"

This reverts commit 1e6194bea1a42ef135d3aa4257c056c0fda33984, reversing
changes made to 39412e895d440e158dc51da7e246167b6ccf2cf3.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: alpo <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: alpo <[email protected]>
Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Nicolas Lara <[email protected]>
Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: nil <[email protected]>
Co-authored-by: alessandromazza <[email protected]>
Co-authored-by: niilptr <[email protected]>
Co-authored-by: Jon Ator <[email protected]>
Co-authored-by: Sishir Giri <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* chore: bump sdk with state breaking barberry fix (#5721) (#5722)

(cherry picked from commit e1772bd92a01b0b0ed5ceb670d8c217261d57640)

Co-authored-by: Roman <[email protected]>

* chore: update in-repo dep tags to be from release branch (#5729)

* fix: accept neg lock ID for migration (#5727) (#5730)

* accept 0 or neg lock ID

* add a comment explain neg number

(cherry picked from commit 294f3c0ab3f246f5d0f8e5ea8dce8536c47529f3)

Co-authored-by: Adam Tucker <[email protected]>

* feat: e2e parallel (#5598) (#5739)

* e2e parallel

* dont add node to config

* go mod

* temp node

* temp node config

* remove mutex

* add mutex to everything

* remove mutex from upgrade.go

* remove pointer

* move node placement

* more mutex

* test

* test

* dont use config for txs

* use go routines and less blocks for vote

* sequence nums amoung other fixes

* remove no longer needed mutex

* remove old sendIBC

* reintroduce secondary sendibc func

* add back in balance check

* mod check for seq num

* more cleaning

* more speed

* parallel 4 to 8 check

* parallel to 3

* inc goroutine procs

* back to 4 procs and reorder tests

* change epoch to day from week

* updates for new upgrade handler

* final speedup

* add todos

* Minor de-duplication of logic in E2E (#5690)

* minor dedup

* more minor de-duplication continued

* Update tests/e2e/helpers_e2e_test.go

Co-authored-by: Dev Ojha <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Roman <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Dev Ojha <[email protected]>

* rename

* split ibc tests back up

* add code comment

---------

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Roman <[email protected]>
(cherry picked from commit 8e2b5b57ee68ffa3e82c2dd14cffc883d369d6fb)

Co-authored-by: Adam Tucker <[email protected]>

* fix: e2e short (#5746) (#5748)

* e2e short fix

* add sleep

(cherry picked from commit 2e06b7ba485e73a36168ff5e47d63e8f249c9f7e)

Co-authored-by: Adam Tucker <[email protected]>

* [CL][tests]: Add all remaining intended test vectors from original tracking issue (backport #5655) (#5743)

* [CL][tests]: Add all remaining intended test vectors from original tracking issue (#5655)

* add all remaining test vectors from original issue

* clean up changes

(cherry picked from commit 39a64b99cb583a2b69f4864e4ef4695947e14ec4)

# Conflicts:
#	x/concentrated-liquidity/range_test.go

* fix merge conflict

---------

Co-authored-by: alpo <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* [E2E] Add ParseEvent function (#5710) (#5744)

Closes: #5601
## What is the purpose of the change
Create a helper ParseEvent function to minimize duplication.

## Testing and Verifying

This change is already covered by existing tests.

## 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

(cherry picked from commit f7c5214c3790709ae524f2cc0e7891ae1905f3e6)

Co-authored-by: Pham Anh Minh <[email protected]>

* fix: temp cl swap bug solution (#5754) (#5756)

* temp swap bug fix

* add custom error

(cherry picked from commit 71d882a186a06de694a278f22d168916070518a6)

Co-authored-by: Adam Tucker <[email protected]>

* Add e2e initialization workflow (#5732) (#5758)

(cherry picked from commit 8da63bb520e2207ab9a91da402ca43833e9b4867)

Co-authored-by: Niccolo Raspa <[email protected]>

* feat: lock existing position and sfs (#5745) (#5760)

* lock existing sf position

* add msg server test

* add test

* Update x/superfluid/keeper/stake.go

Co-authored-by: Matt, Park <[email protected]>

* Update x/superfluid/keeper/stake_test.go

Co-authored-by: Matt, Park <[email protected]>

* add withdraw attempt after locking

* add non owner test case

* check delegated amount

* add cli

---------

Co-authored-by: Matt, Park <[email protected]>
(cherry picked from commit a8179cbae9ff137658be1f34e8883d016e7c4cd9)

Co-authored-by: Adam Tucker <[email protected]>

* Docs/Fix: Update Broken Links (#5728) (#5759)

* Update broken links

* Remove TODOs and add lycheeignore for outdated, historical links

(cherry picked from commit 8e1d5b0be9ca5014d852588ad486ea30f657831b)

Co-authored-by: Fabian Gonzalez <[email protected]>

* test: parallel fuzz swap test suite (#5755) (#5757)

* updates

* updates

* swap to next initialized tick

* parallelizm

* updates

* restore tests

* clean up

* UX updates

* fix test

* fix tests

* add fatalError concept

---------

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
(cherry picked from commit c99d7c2396ac3f6dab171b949821a91f634320f4)

Co-authored-by: Roman <[email protected]>

* fix tx fees cli cmd (#5763) (#5765)

(cherry picked from commit e1e60c2996aeaab92cf7ccda09f057be0812f27e)

Co-authored-by: Adam Tucker <[email protected]>

* [fix] Fix no-lock gauge CLI  (#5753) (#5766)

* added cli fix

* Update x/incentives/client/cli/tx.go

* import fix

---------

Co-authored-by: Roman <[email protected]>
(cherry picked from commit 1a39c3329317528e3fb866b2b8c7d6ae7694c2b7)

Co-authored-by: Sishir Giri <[email protected]>

* test(CL): add swaps in given out to fuzz suite and fix deterministic randomness (#5764) (#5767)

* test(CL): add swaps in given out to fuzz suite and fix deterministic randomness

* updates

* comments

* Update x/concentrated-liquidity/fuzz_test.go

Co-authored-by: Adam Tucker <[email protected]>

* updates

---------

Co-authored-by: Adam Tucker <[email protected]>
(cherry picked from commit 80e67d6f326d8ac8639fea38364d35a66961604f)

Co-authored-by: Roman <[email protected]>

* Fix generate docs CI (#5642) (#5762)

* Fix generate docs ci

* Bump dependency

* use older version dep

* Try updating partial deps

(cherry picked from commit 5b176f81f65bc4319ffd9b1384f4adb000d64d55)

# Conflicts:
#	.github/workflows/generate-docs.yml

Co-authored-by: Matt, Park <[email protected]>

* tests(CL): improve fuzz suite with many random LPs and removing positions (#5769) (#5771)

* test(CL): withdraw positions and random accounts in fuzzer

* add random accounts

* reset logs

* claim reward invariant

(cherry picked from commit 48a3854785784da9f595c60f3f26f060e2874ffa)

Co-authored-by: Roman <[email protected]>

* chore(deps): bump actions/setup-go from 2 to 4 (#5770) (#5772)

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 9075fe67d9b664a9a3f7aca074064b49f9c5ee20)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add Business Source License from @NickPullman (#5773) (#5774)

* Add Business Source License from @NickPullman

* Fix markdown lint

(cherry picked from commit 648d402dfbe5c62de19244c8bca9bc69e02d0b7e)

Co-authored-by: Dev Ojha <[email protected]>

* Remove Pools and LiquidityNetInDirection queries from wasmbinding list (#5775) (#5776)

(cherry picked from commit 309e05363211273d418d6dc124f34c05e6dd1fd6)

Co-authored-by: Dev Ojha <[email protected]>

* fix: CL swap fuzz error (#5778) (#5780)

(cherry picked from commit d80e16cd5eebb16eb01c151dc4f3d03b783faca4)

Co-authored-by: Roman <[email protected]>

* fix unbonding error check (#5779) (#5781)

(cherry picked from commit 7e168bd62680cd0951dcce219fbc966f3aee9d2c)

Co-authored-by: Adam Tucker <[email protected]>

* Add debug command for conversion to proto marshalled bytes (#5750) (#5777)

* Add command

* Add chagnelog

(cherry picked from commit 0bdbca2484ab7d8644d5cf3932190137a0593037)

Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* reafactor(CL): tick spacing 100 upgrade handler (#5782) (#5783)

(cherry picked from commit d2a4b16d8c7f49d14ba37605c071d8f782e69582)

Co-authored-by: Roman <[email protected]>

* chore: add v16 binary json (#5791) (#5792)

* add binary json

* Update v16_binaries.json

(cherry picked from commit 072dc717e58f79a3f68940593cd4ab6fa86d17c1)

Co-authored-by: Adam Tucker <[email protected]>

* chore: v16 upgrade guide (#5793) (#5794)

(cherry picked from commit 65117431f2cad855fcb9f6f20202a0b2674156c8)

Co-authored-by: Roman <[email protected]>

* chore: add missing cli queries CL (backport #5796) (#5797)

* chore: add missing cli queries CL (#5796)

* adds liq net in direction cli

* update osmoutils

* add pool rewards and tick accum cli q

* add query cmd

(cherry picked from commit 13f36000a0320b34ac71ae905cc7e75cf45b8e6f)

# Conflicts:
#	go.mod
#	go.sum

* go get osmoutils

* update go sum

---------

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* update pool uptime accum to now in query (#5799) (#5800)

(cherry picked from commit f19298509a52ca7a067c86f8d8201aecfc12deaf)

Co-authored-by: Adam Tucker <[email protected]>

* fix cl readme typo (#5816) (#5818)

(cherry picked from commit ebbc9faa13da4853aba58d08d6f54e21dbf43bba)

Co-authored-by: LaurensKubat <[email protected]>

* Update README.md (#5814) (#5817)

(cherry picked from commit 340290756ae6cc6788094086578ff85835dd4727)

Co-authored-by: JeremyParish69 <[email protected]>

* comments on deprecateds in WhitelistedQuery wasmbinding (#5751) (#5811)

Closes: #5735

## What is the purpose of the change

> Add a description of the overall background and high level changes that this PR introduces

*(E.g.: This pull request improves documentation of area A by adding ....*

Most of the mentioned endpoint already have a replacement.Comment on what are deprecated and their successors

## Testing and Verifying

*(Please pick one of the following options)*

- [x] This change is a trivial rework / code cleanup without any test coverage.

*(or)*

This change is already covered by existing tests, such as *(please describe tests)*.

*(or)*

This change added tests and can be verified as follows:

*(example:)*
  - *Added unit test that validates ...*
  - *Added integration tests for end-to-end deployment with ...*
  - *Extended integration test for ...*
  - *Manually verified the change by ...*

## 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

(cherry picked from commit 4c7238029997d7d4de1052b0a42f07da0b1dae85)

Co-authored-by: Đỗ Việt Hoàng <[email protected]>

* Revert "feat: lock existing position and sfs (#5745) (#5760)" (#5821)

This reverts commit 9968df44bdc3654ab771124446d005c14120c432.

* chore: cosmovisor hashes and v16.1.0 tag updates (#5824) (#5826)

(cherry picked from commit feabfe934ec8906bc509cd6a8f848443d494ea12)

Co-authored-by: Roman <[email protected]>

* chore: set correct binary name for v16 (#5828) (#5829)

(cherry picked from commit bf34c0934210054e8d49e112b70d67950dca5faf)

Co-authored-by: Artur Troian <[email protected]>

* Fix the superfluid query (backport #5831) (#5832)

* Fix the superfluid query (#5831)

* Fix the superfluid query

* Changelog

(cherry picked from commit 13c887465f1d66f9082685a5b9032492030c72dc)

* Update check-state-compatibility.yml

---------

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>

* Delete printlns that made it to prod (#5835) (#5836)

* Delete printlns that made it to prod

* add changelog

(cherry picked from commit 37b9bbe00e26504d808f99d201e73a11d1757fc7)

Co-authored-by: Dev Ojha <[email protected]>

* [Chore] Add amino name for tx msgs (backport #5784) (#5787)

* [Chore] Add amino name for tx msgs (#5784)

* updated amino name

* updated

(cherry picked from commit 1e3149f05a08c5af8d0df9b0392bb554dfc9bc78)

* cleanup

* more cleanup

* fixed conflicts

* rebased

* Delete atom

---------

Co-authored-by: Sishir Giri <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>

* Make GetSuperfluidLockByLockId more cleary indicate if its found or not (#5833) (#5838)

(cherry picked from commit b7fe65f330142102f81ba681c22097aac0f1571c)

Co-authored-by: Dev Ojha <[email protected]>

* chore: increase initial amounts for one localosmosis acc (#5798) (#5844)

(cherry picked from commit 087ff933fe1b171d4dc41e0f2d5e4606a50b74f6)

Co-authored-by: Roman <[email protected]>

* Adding estimate query based on price impact

* Fixing bugs in CalculateSpotPrice and EstimateTrade

* Fixing query and adding tests

* Running proto-gen

* Fixing test issues

* Adding docs

* Generated protofile changes

* adding query.yml entry

* Adding PR fixes and changing query

* fixing null pointer bug

* Removing comment

* PR fixes

* Reverting unwanted PR

* Removing leading lines

* Update docs

* Updating changelog

* Pr fixes, small refactoring and doc updates

* Fixing proto file

* Adding PR fixes, refactoring code from query to router.

* Adding comment to abs

* Generated protofile changes

* Adding comment to abs

* Generated protofile changes

* Running proto and lintin

* Running lint

* Running goimports

* updating query proto wrap

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Nicolas Lara <[email protected]>
Co-authored-by: alpo <[email protected]>
Co-authored-by: Jon Ator <[email protected]>
Co-authored-by: Sishir Giri <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: alpo <[email protected]>
Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: nil <[email protected]>
Co-authored-by: alessandromazza <[email protected]>
Co-authored-by: niilptr <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Pham Anh Minh <[email protected]>
Co-authored-by: Fabian Gonzalez <[email protected]>
Co-authored-by: LaurensKubat <[email protected]>
Co-authored-by: JeremyParish69 <[email protected]>
Co-authored-by: Đỗ Việt Hoàng <[email protected]>
Co-authored-by: Artur Troian <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: migueldingli1997 <[email protected]>
  • Loading branch information
1 parent 4270d68 commit d387e22
Show file tree
Hide file tree
Showing 18 changed files with 2,223 additions and 117 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Fixes mainnet bugs w/ incorrect accumulation sumtrees, and CL handling for a bal

### API breaks

* [#6167](https://github.com/osmosis-labs/osmosis/pull/6167) add EstimateTradeBasedOnPriceImpact query to x/poolmanager.
* [#6238](https://github.com/osmosis-labs/osmosis/pull/6238) switch osmomath to sdkmath types and rename BigDec constructors to contain "Big" in the name.
* Note: with the update, the Dec and Int do not get initialized to zero values
by default in proto marhaling/unmarshaling. Instead, they get set to nil values.
Expand Down
6 changes: 3 additions & 3 deletions client/docs/static/openapi/index.html

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions client/docs/static/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4198,6 +4198,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4447,6 +4448,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4700,6 +4702,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -4874,6 +4877,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -5313,6 +5317,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -5565,6 +5570,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -8052,6 +8058,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -8373,6 +8380,7 @@ paths:
- Query
"/osmosis/superfluid/v1beta1/account_delegated_cl_positions/{delegator_address}":
get:
summary: Returns all of a user's full range CL positions that are superfluid staked.
operationId: UserConcentratedSuperfluidPositionsDelegated
responses:
"200":
Expand Down Expand Up @@ -32673,6 +32681,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -32826,6 +32835,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -32974,6 +32984,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33099,6 +33110,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33227,6 +33239,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33430,6 +33443,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33583,6 +33597,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -33705,6 +33720,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand All @@ -33719,6 +33735,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35036,6 +35053,7 @@ components:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down
20 changes: 20 additions & 0 deletions client/docs/static/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4557,6 +4557,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -4833,6 +4834,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -5112,6 +5114,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query that
Expand Down Expand Up @@ -5308,6 +5311,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -5766,6 +5770,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -6046,6 +6051,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -8638,6 +8644,7 @@ paths:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: >-
LockQueryType defines the type of the lock query
Expand Down Expand Up @@ -8966,6 +8973,9 @@ paths:
- Query
/osmosis/superfluid/v1beta1/account_delegated_cl_positions/{delegator_address}:
get:
summary: >-
Returns all of a user's full range CL positions that are superfluid
staked.
operationId: UserConcentratedSuperfluidPositionsDelegated
responses:
'200':
Expand Down Expand Up @@ -35434,6 +35444,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35609,6 +35620,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35776,6 +35788,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -35909,6 +35922,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36058,6 +36072,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36281,6 +36296,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36456,6 +36472,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -36593,6 +36610,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand All @@ -36607,6 +36625,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down Expand Up @@ -38079,6 +38098,7 @@ definitions:
- ByDuration
- ByTime
- NoLock
- ByGroup
default: ByDuration
description: |-
LockQueryType defines the type of the lock query that can
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cmd/osmosisd/cmd/stargate-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ func GetStructAndFill(queryPath, module, structName string, structArguments ...s
v.BaseAssetDenom = structArguments[1]
v.QuoteAssetDenom = structArguments[2]
return v, nil
case "EstimateTradeBasedOnPriceImpactRequest":
return nil, fmt.Errorf("swap route parsing not supported yet")
}
case "txfees":
switch structName {
Expand Down
58 changes: 57 additions & 1 deletion proto/osmosis/poolmanager/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ service Query {
option (google.api.http).get =
"/osmosis/poolmanager/v1beta1/pools/total_liquidity";
}

// EstimateTradeBasedOnPriceImpact returns an estimated trade based on price
// impact, if a trade cannot be estimated a 0 input and 0 output would be
// returned.
rpc EstimateTradeBasedOnPriceImpact(EstimateTradeBasedOnPriceImpactRequest)
returns (EstimateTradeBasedOnPriceImpactResponse) {
option (google.api.http).get =
"/osmosis/poolmanager/v1beta1/{pool_id}/estimate_trade";
}
}

//=============================== Params
Expand Down Expand Up @@ -250,4 +259,51 @@ message TotalLiquidityResponse {
(gogoproto.moretags) = "yaml:\"liquidity\"",
(gogoproto.nullable) = false
];
}
}

//=============================== EstimateTradeBasedOnPriceImpact

// EstimateTradeBasedOnPriceImpactRequest represents a request to estimate a
// trade for Balancer/StableSwap/Concentrated liquidity pool types based on the
// given parameters.
message EstimateTradeBasedOnPriceImpactRequest {
// from_coin is the total amount of tokens that the user wants to sell.
cosmos.base.v1beta1.Coin from_coin = 1 [ (gogoproto.nullable) = false ];

// to_coin_denom is the denom identifier of the token that the user wants to
// buy.
string to_coin_denom = 2;

// pool_id is the identifier of the liquidity pool that the trade will occur
// on.
uint64 pool_id = 3;

// max_price_impact is the maximum percentage that the user is willing
// to affect the price of the liquidity pool.
string max_price_impact = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// external_price is an optional external price that the user can enter.
// It adjusts the MaxPriceImpact as the SpotPrice of a pool can be changed at
// any time.
string external_price = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// EstimateTradeBasedOnPriceImpactResponse represents the response data
// for an estimated trade based on price impact. If a trade fails to be
// estimated the response would be 0,0 for input_coin and output_coin and will
// not error.
message EstimateTradeBasedOnPriceImpactResponse {
// input_coin is the actual input amount that would be tradeable
// under the specified price impact.
cosmos.base.v1beta1.Coin input_coin = 1 [ (gogoproto.nullable) = false ];

// output_coin is the amount of tokens of the ToCoinDenom type
// that will be received for the actual InputCoin trade.
cosmos.base.v1beta1.Coin output_coin = 2 [ (gogoproto.nullable) = false ];
}
6 changes: 6 additions & 0 deletions proto/osmosis/poolmanager/v1beta1/query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ queries:
query_func: "k.TotalLiquidity"
cli:
cmd: "TotalLiquidity"
EstimateTradeBasedOnPriceImpact:
proto_wrapper:
query_func: "k.EstimateTradeBasedOnPriceImpact"
response: "*queryproto.EstimateTradeBasedOnPriceImpactResponse"
cli:
cmd: "EstimateTradeBasedOnPriceImpact"
Loading

0 comments on commit d387e22

Please sign in to comment.