AFK-AlignedFamKernel / afk_monorepo

AFK: Aligned Fam Kernel - Monorepo
https://portal.afk-community.xyz
MIT License
9 stars 20 forks source link

Launchpad cairo test #46

Open MSghais opened 3 weeks ago

MSghais commented 3 weeks ago

Polish and improve Cairo test for the Launchpad with bonding curve:

https://github.com/AFK-AlignedFamKernel/afk_monorepo/blob/main/onchain/cairo/src/tests/launchpad_tests.cairo

Do assert and a great test of all assert etc.

Other issues can be created if fixes or bugs are found. Already one are coming

ooochoche commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a smart contract developer and I've read the description and i will be able to fix this current issue

ScottyDavies commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am front end developer with years of experience. this will be my first time contributing to the ecosystem and i am ready to work

How I plan on tackling this issue

I would approach this issue with following steps Thorough Testing of Launchpad Functionality: Ensure all the core functionalities of the Launchpad are thoroughly tested, including: Initialization of the Launchpad with the correct parameters (e.g., token address, quote token address, bonding curve parameters, etc.) Successful minting and burning of Launchpad tokens Proper handling of the quote token and Launchpad token transfers Correct implementation of the bonding curve for buying and selling Launchpad tokens Validation of access control mechanisms (e.g., MINTER_ROLE, ADMIN_ROLE) Edge cases, such as attempting to exceed the total supply, buying or selling with insufficient funds, etc. Add comprehensive test cases to cover all the expected behaviors and edge cases. Use appropriate asserts to verify the expected outcomes for each test case. Testing of Events and Callbacks: Ensure all relevant events are emitted correctly, such as TokenMinted, TokenBurned, TokenBought, TokenSold, etc. Verify that the event data matches the expected values. Test the callback functionality, if any, to ensure it is correctly invoked and the provided data is as expected. Testing of Bonding Curve Calculations: Thoroughly test the bonding curve calculations, including: Accurate calculation of the current price based on the total supply Correct conversion between the quote token and Launchpad token amounts Handling of decimal precision and rounding Add test cases to cover different stages of the bonding curve (e.g., initial, middle, and near-maximum supply). Testing of Access Control: Verify that the access control mechanisms work as expected, including: Only authorized accounts (e.g., with the MINTER_ROLE or ADMIN_ROLE) can perform privileged actions like minting and burning tokens. Attempts by unauthorized accounts to perform privileged actions are correctly rejected. Test edge cases, such as attempting to revoke or grant roles to accounts. Testing of Pausability and Upgradability: If the Launchpad contract is designed to be pausable and/or upgradable, add test cases to verify the correct behavior in these scenarios. Test the pause and unpause functionality, ensuring that only authorized accounts can pause and unpause the contract. If the contract is upgradable, test the upgrade process, including the preservation of state and the correct functioning of the contract after the upgrade. Code Coverage and Readability: Ensure the test suite achieves a high level of code coverage, covering both happy paths and edge cases. Make the test code as readable and maintainable as possible, using meaningful variable and function names, and providing clear comments explaining the purpose of each test case.

ShantelPeters commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have extensive experience with Cairo and blockchain development, including smart contract testing and optimization. I can enhance the existing Cairo test for the Launchpad with bonding curve by improving assertions, adding comprehensive test cases, and identifying and addressing potential bugs. My familiarity with Cairo’s testing framework will ensure robust and effective test coverage.

How I plan on tackling this issue

I would start by reviewing the existing Cairo test for the Launchpad with bonding curve to understand its current structure and coverage. I’d then:

Enhance Assertions: Add more precise and comprehensive assertions to ensure all critical functionalities are tested. Expand Test Cases: Include edge cases and scenarios to thoroughly evaluate the bonding curve logic. Refactor Code: Improve test readability and organization for better

PoulavBhowmick03 commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Poulav Bhowmick, a software engineer at Invisible Studios with a robust background in TypeScript, Rust, Solidity Cairo, fullstack development and blockchain technology. My experience includes building robust applications, optimizing functionalities and blockchain integration. I have actively participated in events and open source contributions, enhancing my capability to tackle real-world tech challenges. My projects can be viewed on my GitHub Profile and OnlyDust Profile. Plus I´m active member of Starknet community🇷.

How I plan on tackling this issue

To address the issue of improving the Cairo test for the Launchpad with a bonding curve, I plan to undertake the following steps:

Enhance Assertions: I will implement comprehensive assertions throughout the test cases to ensure that all critical aspects of the bonding curve logic are thoroughly tested. This will include validating the correct calculation of token prices, liquidity thresholds, market cap thresholds, and the successful creation and launching of tokens.

Test Coverage Expansion: I'll expand the test coverage by adding new test cases for edge scenarios, such as boundary conditions for token purchases and sales, variations in liquidity and market cap thresholds, and the behavior of the contract under stress conditions (e.g., multiple consecutive buy/sell operations).

Bug Detection and Issue Creation: While enhancing the tests, I will be on the lookout for potential bugs or inconsistencies in the bonding curve implementation. If any issues are detected, I will document them and create separate GitHub issues for tracking and resolution.

Polish Test Code: I will also clean up and polish the test code by removing any redundant comments, ensuring consistency in naming conventions, and optimizing the test logic where possible.

Review and Feedback: After completing the above steps, I will review the tests and gather feedback from the team to ensure that all critical aspects are covered and that the tests are robust and maintainable.

This approach should significantly improve the reliability of the Launchpad's bonding curve functionality and provide better assurance that it operates as expected under various conditions.

ETA- 1 day

Shoetan commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi I am Emmanuel a returning OD hack contributor

How I plan on tackling this issue

I intend to solve this problem by understanding the contract and what is expected of the contract. Will communicate with maintainers on progress and blockers if any arise. Contributed to a similar thing before https://github.com/carbonable-labs/carbon-protocol-v3/pull/82

manlikeHB commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I am a cairo dev with experience contributing to lots of other cairo projects, you can check my profile to confirm this.

How I plan on tackling this issue

ETA - 2 days.

onlydustapp[bot] commented 3 weeks ago

The maintainer MSghais has assigned manlikeHB to this issue via OnlyDust Platform. Good luck!

CollinsC1O commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a smart contract developer and I write cairo

How I plan on tackling this issue

love to work on this test, please assign

onlydustapp[bot] commented 2 weeks ago

The maintainer MSghais has assigned PoulavBhowmick03 to this issue via OnlyDust Platform. Good luck!