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

Audit/ekubo init params #527

Merged
merged 16 commits into from
Feb 24, 2025

Conversation

MSghais
Copy link
Member

@MSghais MSghais commented Feb 21, 2025

Description

Ekubo initial_tick calculation before was incorrect.

TODO:
We need to:

  1. Sort the tokens
  2. Scale factor with liquidity_raised and initial_pool_supply
  3. Calculate the sqrt_ratio
  4. Use the library MathLib of Ekubo and call: sqrt_ratio_to_tick (Issue SQRT_RATIO_TOO_LOW)
  5. Ensure the computed tick aligns with tick_spacing:
    If not divisible, round it down to the nearest valid tick.
  6. Calculate the bounds accordingly
  • Add library MathLib sqrt_to_ratio
  • sort_token in launchpad
  • Calculate sqrt_ratio
  • Calculate sqrt_ratio_to_tick
  • Bounds

Actual error:

SQRT_RATIO_TOO_LOW
BOUND_TICK_SPACING
TICK_MAGNITUDE

Docs:

https://docs.ekubo.org/integration-guides/reference/math-1-pager

https://github.com/EkuboProtocol/abis/blob/main/src/interfaces/mathlib.cairo

https://github.com/EkuboProtocol/starknet-rust-sdk/blob/main/src/math/tick.rs

@MSghais MSghais marked this pull request as draft February 21, 2025 21:29
@MSghais MSghais mentioned this pull request Feb 24, 2025
20 tasks
@MSghais MSghais marked this pull request as ready for review February 24, 2025 07:50
@MSghais MSghais merged commit 8ad4120 into AFK-AlignedFamKernel:main Feb 24, 2025
1 of 3 checks passed
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