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

Launchpad and Unrug fix and tests #531

Open
20 tasks
MSghais opened this issue Feb 24, 2025 · 2 comments
Open
20 tasks

Launchpad and Unrug fix and tests #531

MSghais opened this issue Feb 24, 2025 · 2 comments
Assignees
Labels
cairo Cairo smart contract ODBuild ODBuild onchain Cairo & Solidity smart contracts test Testing for developers and contributors/users urgent Urgent! Let's go

Comments

@MSghais
Copy link
Member

MSghais commented Feb 24, 2025

Description

Ekubo initial_tick calculation before was incorrect.

Folder: onchain/cairo/launchpad/
Scope: launchpad.cairo, unrug.cairo, edge_cases_tests.cairo

TODO:
We have done severals todo here #527, we need to verify and test it correctly.

  • 1. Sort the tokens

  • 2. Calculate y/x with liquidity_raised and initial_pool_supply.

  • If token1 == quote_address, we need to scale the factor to not get a 0 value.

  • 4. Calculate the sqrt_ratio with the y_x factor calculated before.

  • 5. Use the library MathLib of Ekubo and call: sqrt_ratio_to_tick (Issue SQRT_RATIO_TOO_LOW)

  • 6. Ensure the computed tick aligns with tick_spacing:If not divisible, round it down to the nearest valid tick.

  • 7. Calculate the bounds accordingly

  • Add edge tests

  • Verify pool initialization with test

  • Add test to buy tokens and verify it in the pool.

  • Add library MathLib sqrt_to_ratio

  • sort_token in launchpad

  • Calculate y_x with the correct scale factor ratio

  • Calculate sqrt_ratio

  • Calculate sqrt_ratio_to_tick

  • Bounds for full range liquidity

Continue the tests in the edge_cases_tests.cairo :

  • edge cases
  • verify unrug pool
  • sqrt_ratio
  • initial_tick

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 added cairo Cairo smart contract ODBuild ODBuild onchain Cairo & Solidity smart contracts test Testing for developers and contributors/users labels Feb 24, 2025
@Jagadeeshftw
Copy link

I'd like to work on this issue @MSghais

@MSghais MSghais added the urgent Urgent! Let's go label Feb 24, 2025
@MSghais
Copy link
Member Author

MSghais commented Feb 24, 2025

@Jagadeeshftw give us some update on this issue please, pretty urgent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cairo Cairo smart contract ODBuild ODBuild onchain Cairo & Solidity smart contracts test Testing for developers and contributors/users urgent Urgent! Let's go
Projects
None yet
Development

No branches or pull requests

2 participants