Skip to content

Restructure into a Cargo workspace (prep for factory/router/LP-token contracts) - #103

Merged
0takuc0mrade merged 3 commits into
Nodus-protocol:mainfrom
Jaydbrown:restructure/workspace-layout
Jul 9, 2026
Merged

Restructure into a Cargo workspace (prep for factory/router/LP-token contracts)#103
0takuc0mrade merged 3 commits into
Nodus-protocol:mainfrom
Jaydbrown:restructure/workspace-layout

Conversation

@Jaydbrown

Copy link
Copy Markdown
Contributor

Summary

First of a series of PRs to partition this repo into multiple contracts (factory, standalone LP token, router) instead of the single monolithic NodusAmm pool contract it has today. This PR is purely structural — no contract behavior changes — and lays the groundwork the others depend on.

  • Moves the existing crate to contracts/pool/, adds a workspace root Cargo.toml.
  • [profile.release] moved to the workspace root (Cargo only honors it there for members); soroban-sdk's version is now declared once via [workspace.dependencies] so every future contract crate stays in lockstep.
  • The workspace's shared target/ dir means the WASM artifact still lands at the exact same path as before (target/wasm32v1-none/release/nodus_protocol_amm.wasm), and every existing cargo build/test/clippy/fmt invocation still works unmodified from the repo root — verified locally.
  • CI: cargo fmt -- --checkcargo fmt --all -- --check. Both currently behave identically with only one workspace member, but bare cargo fmt isn't guaranteed to cover every member as more contracts are added, and this also matches what the Makefile's lint target already did.
  • README: updated the repo-structure diagram for the new path, and fixed two stale references left over from an earlier crate rename (wasm32-unknown-unknownwasm32v1-none, nodus_amm.wasmnodus_protocol_amm.wasm) — noticed while editing the same section, not otherwise related to this PR.

Test plan

  • cargo build --release --target wasm32v1-none — succeeds, same output path
  • cargo test --features testutils — 52 passed, 0 failed (unchanged)
  • cargo clippy --all-targets --features testutils -- -D warnings — clean
  • cargo fmt --all -- --check — clean

Note on account access

Opened from my personal fork — my nodus-protocol org access was revoked partway through this work (confirmed via gh api repos/.../permissions). Same situation as the mobile-repo PRs from earlier today.

What's next

  • PR 2: extract LP tokens out of the pool into their own standalone contract, with the pool calling it cross-contract for mint/burn.
  • PR 3: Factory contract (deploys + tracks a pool per token pair, replacing the current one-hardcoded-pair setup).
  • PR 4: Router contract (multi-hop swaps, convenience add/remove-liquidity across pools).

Jaydbrown added 3 commits July 9, 2026 19:13
Relocates the existing crate to contracts/pool/ and adds a workspace
root Cargo.toml, laying the groundwork for the additional contracts
(LP token, factory, router) that will live alongside it. Behavior is
unchanged: the workspace's shared target/ dir means the WASM artifact
still lands at target/wasm32v1-none/release/nodus_protocol_amm.wasm,
and every existing cargo build/test/clippy/fmt invocation still works
unmodified from the repo root.

[profile.release] moved to the workspace root, since Cargo only
honors it there for workspace members. soroban-sdk's version is now
declared once via [workspace.dependencies] so every future contract
crate stays in lockstep.
Bare 'cargo fmt' run from a virtual-manifest workspace root isn't
guaranteed to cover every member as more contracts are added;
--all makes that explicit. Matches the Makefile's lint target, which
already used --all.
Also fixes two stale references left over from before the crate was
renamed nodus-protocol-amm: the wasm32-unknown-unknown target (CI and
rust-toolchain.toml have used wasm32v1-none for a while) and the
nodus_amm.wasm filename (actual artifact is nodus_protocol_amm.wasm).
@0takuc0mrade
0takuc0mrade merged commit ec651b3 into Nodus-protocol:main Jul 9, 2026
3 checks passed
emwulrd pushed a commit to emwulrd/Nodus-Protocol-Smart-Contract that referenced this pull request Jul 20, 2026
emwulrd pushed a commit to emwulrd/Nodus-Protocol-Smart-Contract that referenced this pull request Jul 20, 2026
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.

2 participants