feat(#377-#378-#379-#380): Implement liquidity functions#502
Merged
Olowodarey merged 3 commits intoArena1X:mainfrom Mar 30, 2026
Merged
Conversation
…idity functions Implement all liquidity module functions for the InsightArena prediction market: Arena1X#377 - Implement add_liquidity Function - Add liquidity to a market pool and mint LP tokens - Validate market exists and is active - Calculate LP tokens to mint using calculate_lp_tokens - Update pool reserves - Store LP position - Emit liquidity added event Arena1X#378 - Implement remove_liquidity Function - Remove liquidity from a pool by burning LP tokens - Validate LP position exists - Calculate withdrawal amount using calculate_liquidity_value - Burn LP tokens - Transfer funds back to provider - Update pool state - Emit liquidity removed event Arena1X#379 - Implement swap_outcome Function - Core trading function to swap between outcome positions - Validate market and pool exist - Calculate swap output using calculate_swap_output - Update pool reserves - Collect and distribute fees - Record swap in history - Emit swap event Arena1X#380 - Update lib.rs and Expose Functions - Add liquidity functions to InsightArenaContract impl - Add proper documentation for each function - Export storage types from lib.rs - Verify all functions compile - Test functions are callable from client Changes: - Updated contract/src/liquidity.rs with complete implementations - Updated contract/tests/liquidity_tests.rs with comprehensive tests - Updated contract/src/lib.rs to expose all liquidity functions - Exported LiquidityPool, LPPosition, and SwapRecord types
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Hexstar-labs Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Liquidity Pool & AMM Implementation
Implement core liquidity management and trading functions for InsightArena prediction markets.
Changes
Implementation Details
Files Modified
contract/src/liquidity.rs- Core implementationscontract/tests/liquidity_tests.rs- Test suitecontract/src/lib.rs- Function exports and type exportsCloses #377
Closes #378
Closes #379
Closes #380