Skip to content

Commit 6cd51d6

Browse files
authored
Prevent endless swap loop when token amount exceeds available liquidity (#884)
* Add sqrt_price_limits. Add test. * Update test * Add comment for team update. * Revert changes. Add INVALID_TICK_ARRAY_SEQUENCE error. Update tests for tick array math. Add test for swap quote. * Clean up old tests * Clean up old tests * Fix test * Clean up * Add changeset * Fix ts e2e test * Revert "Fix ts e2e test" This reverts commit 35d7458. * Add cargo.lock files from integration tests to .gitignore * Fix Rust integration test * Format * Add changeset * Resolve comments. Revert integration tests. * Resolve comments: add tests and helper functions for tests.
1 parent 1fc3818 commit 6cd51d6

File tree

11 files changed

+258
-42
lines changed

11 files changed

+258
-42
lines changed

.changeset/kind-bushes-cross.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@orca-so/whirlpools-example-rust-repositioning-bot": patch
3+
"@orca-so/whirlpools-rust": patch
4+
"@orca-so/whirlpools-rust-client": patch
5+
"@orca-so/whirlpools-docs-rust": patch
6+
---
7+
8+
Updated cargo.lock

.changeset/pretty-shirts-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@orca-so/whirlpools-rust-core": patch
3+
---
4+
5+
Prevent endless swap loop when token amount exceeds available liquidity

.changeset/two-lemons-attend.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@orca-so/whirlpools-rust": patch
3+
"@orca-so/whirlpools": patch
4+
---
5+
6+
Update e2e tests to prevent INVALID_TICK_ARRAY_SEQUENCE error thrown from core library

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ generated
2929
.env
3030
wallet.json
3131
solana-release
32+
rust-sdk/integration/**/Cargo.lock
33+
ts-sdk/integration/**/Cargo.lock

docs/rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/rust-sdk/whirlpool_repositioning_bot/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-sdk/client/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-sdk/core/src/constants/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ pub const INVALID_SLIPPAGE_TOLERANCE: CoreError = "Invalid slippage tolerance";
4646

4747
#[cfg_attr(feature = "wasm", wasm_expose)]
4848
pub const TICK_INDEX_NOT_IN_ARRAY: CoreError = "Tick index not in array";
49+
50+
#[cfg_attr(feature = "wasm", wasm_expose)]
51+
pub const INVALID_TICK_ARRAY_SEQUENCE: CoreError = "Invalid tick array sequence";

0 commit comments

Comments
 (0)