Skip to content

Issue 2.3 soroswap lp integration#22

Merged
soomtochukwu merged 11 commits intoDXmakers:mainfrom
sudo-robi:issue-2.3-soroswap-lp-integration
Mar 30, 2026
Merged

Issue 2.3 soroswap lp integration#22
soomtochukwu merged 11 commits intoDXmakers:mainfrom
sudo-robi:issue-2.3-soroswap-lp-integration

Conversation

@sudo-robi
Copy link
Copy Markdown
Contributor

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()

- 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.
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@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! 🚀

Learn more about application limits

@soomtochukwu
Copy link
Copy Markdown
Contributor

@sudo-robi , could you resolve this?

- 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
Copy link
Copy Markdown
Contributor Author

@soomtochukwu all done

@soomtochukwu soomtochukwu merged commit 5554fa6 into DXmakers:main Mar 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue 2.3: Implement Soroswap LP Mock/Integration

2 participants