Issue 2.3 soroswap lp integration#22
Merged
soomtochukwu merged 11 commits intoDXmakers:mainfrom Mar 30, 2026
Merged
Conversation
…and LP share tracking
- Replace env.register_contract() with env.register() (SDK deprecation) - Fix dev_dependencies → dev-dependencies in Cargo.toml - Add test_initialize_gold_trustline - Add test_deposit_and_withdraw - Add test_lp_shares_accumulate_across_deposits - Add test_zero_lp_percentage_no_shares - Add test_50_50_split_precision_odd_amount - Add test_multiple_users_isolated_lp_shares - Add test_allocation_exceeds_100_percent (should_panic) - Extract shared setup_env() test helper All 8 tests pass with zero warnings.
|
@sudo-robi 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! 🚀 |
Contributor
|
@sudo-robi , could you resolve this? |
…and LP share tracking Changed things fixed
- Replace env.register_contract() with env.register() (SDK deprecation) - Fix dev_dependencies → dev-dependencies in Cargo.toml - Add test_initialize_gold_trustline - Add test_deposit_and_withdraw - Add test_lp_shares_accumulate_across_deposits - Add test_zero_lp_percentage_no_shares - Add test_50_50_split_precision_odd_amount - Add test_multiple_users_isolated_lp_shares - Add test_allocation_exceeds_100_percent (should_panic) - Extract shared setup_env() test helper All 8 tests pass with zero warnings.
…ns in contracts/src/lib.rs
Contributor
Author
|
@soomtochukwu all done |
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.
closes #7
Description
This branch resolves Issue 2.3. For the moderate and aggressive portions of a user's savings, the contract provides liquidity to Stellar-native Automated Market Makers (Soroswap) to earn higher swap fees.
Changes
SoroswapRouterTrait — #[contractclient] interface for add_liquidity and swap_exact_tokens_for_tokens
TokenTrait — #[contractclient] interface for transfer, approve, balance (SEP-41)
initialize_soroswap() — Admin-only setup storing router, USDC, and XLM token addresses
provide_lp() — Core LP logic: performs 50/50 USDC split, swaps half for XLM via Soroswap Router, adds liquidity, maps LP shares to user
get_lp_shares() — Public query for a user's tracked LP share balance
deposit() — Updated to route lp_percentage of the deposit to provide_lp
DataKey — Added UserLPShares(Address), SoroswapRouter, UsdcToken, XlmToken
Fixed dev_dependencies → dev-dependencies (Cargo 2024 edition)
Migrated deprecated env.register_contract() → env.register()