Skip to content

Feat: amm module#53

Merged
Ceejaytech25 merged 2 commits intoceejaylaboratory:mainfrom
Agbasimere:feat-amm-module
Mar 28, 2026
Merged

Feat: amm module#53
Ceejaytech25 merged 2 commits intoceejaylaboratory:mainfrom
Agbasimere:feat-amm-module

Conversation

@Agbasimere
Copy link
Copy Markdown
Contributor

Closes: #28

Description

This PR implements a simple, robust Automated Market Maker (AMM) based on the Constant Product ($X \times Y = K$) formula. It allows users to provide liquidity to token pairs and swap between them with a 0.3% fee.

Features

  • Liquidity Management: Proportional deposit and withdraw mechanisms for LP participants.
  • Constant Product Swaps: Standard swapping logic with enforced slippage protection (min_amount_out).
  • Standardized Fees: Integrated 0.3% trading fee to incentivize liquidity providers.
  • Canonical Sorting: Ensures token order is consistent regardless of how the pool is initialized.
  • Soroban SDK v22: Fully updated and tested against the latest project standards.

Integration

The AMM module is implemented as a standalone workspace member in src/amm:

  • Add anchorpoint-amm = { path = "../amm" } to your contract's Cargo.toml.
  • Deploy the AMM contract and call initialize(token_a, token_b) to create a new pool.

Commands

  • Build/Check: cargo check -p anchorpoint-amm
  • Unit Tests: cargo test -p anchorpoint-amm

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Agbasimere 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

@Ceejaytech25
Copy link
Copy Markdown
Contributor

@Agbasimere , lgtm!

@Ceejaytech25 Ceejaytech25 merged commit a5e7877 into ceejaylaboratory:main Mar 28, 2026
1 check 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.

Smart Contract: Standard Automated Market Maker (AMM) Basic

2 participants