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

add limit order pool integration #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

0xKermo
Copy link

@0xKermo 0xKermo commented Jan 21, 2025

added limit order pool integration and tests according to rust sdk test cases.

I left comments about other changes

…riceChange property and improving code formatting. Update tests to validate new property behavior.
Copy link
Author

@0xKermo 0xKermo left a comment

Choose a reason for hiding this comment

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

comments

@@ -114,3 +114,41 @@ export function approximateNumberOfTickSpacingsCrossed(

return Math.floor(Math.abs(logPriceDiff / (tickSpacing * 251)));
}

Copy link
Author

Choose a reason for hiding this comment

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

I implemented this function from rust sdk. Limit order tests succes with this func
maybe i did something wrong here

@@ -173,7 +177,56 @@ export class BasePool implements QuoteNode {
const nextInitializedTickSqrtRatio = nextInitializedTick
? toSqrtRatio(nextInitializedTick.tick)
: null;

*/
Copy link
Author

Choose a reason for hiding this comment

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

i changed here with my implementation but It works in limit order pool tests but other test scenarios are failed (base pool, twamm...)
maybe I did smth wrong here

@@ -198,25 +251,33 @@ export class BasePool implements QuoteNode {
// cross the tick if the price moved all the way to the next initialized tick price
if (nextInitializedTick && sqrtRatio === nextInitializedTickSqrtRatio) {
activeTickIndex = isIncreasing
? activeTickIndex + 1
: activeTickIndex - 1;
? nextInitializedTick.index
Copy link
Author

Choose a reason for hiding this comment

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

change here due to the above changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant