Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- name: Clippy
run: cargo clippy --all-targets --features testutils -- -D warnings
- name: Format check
run: cargo fmt -- --check
run: cargo fmt --all -- --check
21 changes: 4 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
[package]
name = "nodus-protocol-amm"
version = "0.1.0"
authors = ["Nodus Protocol Team"]
edition = "2021"
license = "MIT"
description = "Constant-product AMM liquidity pool on Stellar Soroban"
[workspace]
resolver = "2"
members = ["contracts/pool"]

[lib]
crate-type = ["cdylib", "rlib"]

[features]
testutils = ["soroban-sdk/testutils"]

[dependencies]
[workspace.dependencies]
soroban-sdk = "26.1.0"

[dev-dependencies]
soroban-sdk = { version = "26.1.0", features = ["testutils"] }

[profile.release]
overflow-checks = true
panic = "abort"
Expand Down
43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,25 @@ LP tokens are tracked internally in the pool's persistent storage — no separat

## Repository Structure

This is a Cargo workspace; each Soroban contract is its own crate under
`contracts/`.

```
src/
lib.rs Contract entry point — all public functions
liquidity_pool.rs Pool math: optimal amounts, K-invariant, LP mint/burn
lp_token.rs Internal LP ledger: mint, burn, transfer, approve, allowance
math.rs AMM formulas: get_amount_out, get_amount_in, sqrt
storage.rs DataKey enum for all instance + persistent storage keys
events.rs Soroban event wrappers: Mint, Burn, Swap, Sync
errors.rs Stable #[contracterror] enum
traits.rs IAmmPool interface definition

tests/
unit_tests.rs Pure math + liquidity-pool unit tests (no Soroban env)
integration_tests.rs Soroban testenv contract interaction tests
fuzz_tests.rs Property tests: k-invariant, sqrt floor, fee monotonicity
contracts/
pool/
src/
lib.rs Contract entry point — all public functions
liquidity_pool.rs Pool math: optimal amounts, K-invariant, LP mint/burn
lp_token.rs Internal LP ledger: mint, burn, transfer, approve, allowance
math.rs AMM formulas: get_amount_out, get_amount_in, sqrt
storage.rs DataKey enum for all instance + persistent storage keys
events.rs Soroban event wrappers: Mint, Burn, Swap, Sync
errors.rs Stable #[contracterror] enum
traits.rs IAmmPool interface definition
tests/
unit_tests.rs Pure math + liquidity-pool unit tests (no Soroban env)
integration_tests.rs Soroban testenv contract interaction tests
fuzz_tests.rs Property tests: k-invariant, sqrt floor, fee monotonicity
```

---
Expand Down Expand Up @@ -114,7 +118,7 @@ make build
# or: stellar contract build

# Build output used by the deploy scripts
target/wasm32-unknown-unknown/release/nodus_amm.wasm
target/wasm32v1-none/release/nodus_protocol_amm.wasm

# Run tests
make test
Expand All @@ -137,11 +141,10 @@ STELLAR_SECRET_KEY=S... TOKEN_0=C... TOKEN_1=C... make deploy-mainnet

The deploy script uploads the WASM, deploys a new contract instance, and calls `initialize`.

The crate name is `nodus-amm`, so the generated WASM artifact uses the
underscore form `nodus_amm.wasm`. This differs from the repository name
(`Nodus-Protocol-Smart-Contract`) by design. Keep deploy scripts and manual
commands pointed at `nodus_amm.wasm` unless the crate name is intentionally
changed.
The pool crate is named `nodus-protocol-amm`, so the generated WASM artifact
uses the underscore form `nodus_protocol_amm.wasm`. Keep deploy scripts and
manual commands pointed at that filename unless the crate name is
intentionally changed.

---

Expand Down
19 changes: 19 additions & 0 deletions contracts/pool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "nodus-protocol-amm"
version = "0.1.0"
authors = ["Nodus Protocol Team"]
edition = "2021"
license = "MIT"
description = "Constant-product AMM liquidity pool on Stellar Soroban"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
testutils = ["soroban-sdk/testutils"]

[dependencies]
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading