Open MSghais opened 3 months ago
I am applying to this issue via OnlyDust platform.
I am a smart contract developer, and i can work on the issue
I am applying to this issue via OnlyDust platform.
I'm a smart contract developer
Use the bonding curve to determine how many tokens the user can sell for the given quote amount. Check that the user owns enough tokens to cover the sale amount. Deduct the sold tokens from the user's balance, adjust the total supply, and update any other relevant state variables. ETA: 2 business days
I am applying to this issue via OnlyDust platform.
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🇷.
I'll address the issue with the sell_coin function by implementing the following steps:
Calculate Sellable Tokens:
I'll first calculate the amount of tokens that can be sold based on the quote_amount provided. This calculation will take into account the bonding curve formula, ensuring that the correct number of tokens is derived from the quoted amount. Verify Purchase History:
Before proceeding with the sale, I'll add a verification step to ensure that the user has already purchased the corresponding amount of tokens. This will involve checking the user's share in the contract state and confirming that the amount they wish to sell does not exceed their purchased balance. Update Contract State:
Once the sale is validated, I'll update the relevant contract states. This includes: Reducing the user's token balance by the sold amount. Adjusting the pool's total supply and liquidity based on the sale. Calculating and applying any protocol and creator fees associated with the transaction. Transferring the correct amount of tokens or quote tokens between the user's address and the contract. Emit Events:
After successfully updating the states, I'll ensure that appropriate events are emitted to reflect the transaction. This will include details like the amount sold, the price received, and the fees deducted. Testing:
I'll also write unit tests to verify the correctness of the sell_coin function with various edge cases, including scenarios where the user attempts to sell more tokens than they own or where the bonding curve might affect the pricing. This approach will ensure that the sell_coin function correctly calculates and processes token sales according to the bonding curve, maintaining the integrity of the marketplace.
I am applying to this issue via OnlyDust platform.
I am a Cairo smart contract developer with experience working on projects such as Just Art Peace, Dojo, Kart, TBA, and Shinigami. Before transitioning to Cairo development, I was a backend developer specializing in Rust.
My recent work with cairo starknet
i should complete this in 1 DAYS
I am applying to this issue via OnlyDust platform.
I have experience in Cairo and smart contract development, including implementing and refining functionality in complex systems. I would approach this problem by:
sell
function to understand its current implementation and identify gaps.To address the issue with the sell
function:
I am applying to this issue via OnlyDust platform.
I am a blockchain developer With background on JavaScript
I would approach this issue with following steps
Calculating the Correct Sellable Token Amount: The sell function should correctly calculate the amount of Launchpad tokens that can be sold for the given quote token amount. This calculation should take into account the current price of the Launchpad token, as determined by the bonding curve. Ensure that the calculation accurately reflects the token price at the current total supply, and that the result is rounded correctly to avoid any loss of precision. Verifying Existing Token Balances: Before allowing the sale to proceed, the sell function should verify that the user has a sufficient balance of the Launchpad tokens to sell. This can be done by checking the user's balance against the calculated sellable token amount. Ensure that the contract accurately tracks the user's Launchpad token balance and updates it correctly during the buy and sell operations. Updating Contract States: After a successful sell operation, the contract's states should be updated accordingly: The total supply of Launchpad tokens should be decreased by the amount sold. The user's Launchpad token balance should be decreased by the amount sold. The quote token amount received from the sale should be transferred to the user's account. Ensure that these state updates are performed atomically and that the contract's internal consistency is maintained. Emitting Relevant Events: The sell function should emit relevant events, such as TokenSold, to notify off-chain systems and users about the sale transaction. The event data should include the details of the sale, such as the user's address, the amount of Launchpad tokens sold, and the quote token amount received. Error Handling and Validation: Implement proper error handling and validation checks within the sell function to ensure that it can only be called under the correct conditions. This includes validating the input parameters, checking for sufficient Launchpad token balances, and handling any potential edge cases or exceptions. Maintainability and Readability: Ensure the code is well-structured, with clear function and variable naming, and appropriate comments explaining the purpose and behavior of the sell function. Consider breaking down the sell function into smaller, reusable helper functions to improve code organization and readability.
I am applying to this issue via OnlyDust platform.
Hi, I am a cairo dev with experience contributing to lots of other cairo projects, you can check my profile to confirm this.
The maintainer MSghais has assigned mubarak23 to this issue via OnlyDust Platform. Good luck!
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
I'll address the issue with the sell_coin function by implementing the following steps:
Calculate Sellable Tokens:
I'll first calculate the amount of tokens that can be sold based on the quote_amount provided. This calculation will take into account the bonding curve formula, ensuring that the correct number of tokens is derived from the quoted amount. Verify Purchase History:
Before proceeding with the sale, I'll add a verification step to ensure that the user has already purchased the corresponding amount of tokens. This will involve checking the user's share in the contract state and confirming that the amount they wish to sell does not exceed their purchased balance. Update Contract State:
Once the sale is validated, I'll update the relevant contract states. This includes: Reducing the user's token balance by the sold amount. Adjusting the pool's total supply and liquidity based on the sale. Calculating and applying any protocol and creator fees associated with the transaction. Transferring the correct amount of tokens or quote tokens between the user's address and the contract. Emit Events:
After successfully updating the states, I'll ensure that appropriate events are emitted to reflect the transaction. This will include details like the amount sold, the price received, and the fees deducted. Testing:
I'll also write unit tests to verify the correctness of the sell_coin function with various edge cases, including scenarios where the user attempts to sell more tokens than they own or where the bonding curve might affect the pricing. This approach will ensure that the sell_coin function correctly calculates and processes token sales according to the bonding curve, maintaining the integrity of the marketplace.
ETA- 1-2 days
Gm! I appreciate the description and the ETA etc in your application! Just assigned one other person that's want to work on Cairo side before you (we discuss it)
Can you the AFK TG group please https://t.me/afk_aligned_fam_kernel? Also ping me in TG, my handle is MSG_Encrypted.
We can discuss other issues incoming in the Contract side for Cairo and Solidity
https://diwakar-portfolio.vercel.app/ i want to work on this issue
Hi @DIWAKARKASHYAP! Maintainers during the ODHack # 7.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.
I will like to work on this
hey, im willing to work on this issue.
Hi @MSghais ! Do you still need some helps on this task ?
Fix sell coin to get the correct amount with the bonding curve, the token already buy.
The sell function need to:
Located here: https://github.com/AFK-AlignedFamKernel/afk_monorepo/blob/de78feed22d2a1f43e0fe4d22afa0dbf48434c2e/onchain/cairo/src/launchpad/launchpad.cairo#L571