feat(amm): headless amm_module core Logos module; flip UI to consume it - #232
Open
0x-r4bbit wants to merge 1 commit into
Open
feat(amm): headless amm_module core Logos module; flip UI to consume it#2320x-r4bbit wants to merge 1 commit into
0x-r4bbit wants to merge 1 commit into
Conversation
0x-r4bbit
force-pushed
the
feat/amm-swap-onchain
branch
from
July 23, 2026 11:32
1fd73f8 to
7f17e06
Compare
0x-r4bbit
force-pushed
the
feat/amm-logos-module
branch
from
July 28, 2026 13:15
483c9db to
b147882
Compare
0x-r4bbit
marked this pull request as ready for review
July 28, 2026 13:16
3esmit
requested changes
Jul 29, 2026
…I to consume it Introduce modules/amm — the AMM business logic as a universal core Logos module, consumed identically by the QML UI (via modules().amm_module) and headlessly (logoscore call amm_module ...). The module is a thin transport adapter: the domain math lives in the Rust amm_client crate (the transport-independent JSON FFI), and the module sequences those pure ops with chain I/O delegated to the logos_execution_zone wallet module. It reaches the same shared wallet instance the UI opened (Basecamp loads core modules as singletons; standalone the LogosAPI client cache dedups the connection), so it never opens a second wallet. The module owns the full AMM surface — not just swaps: - resolvePool / swapExactInput / tokenList (the swap path) - newPositionContext / quoteNewPosition / submitNewPosition (add-liquidity) apps/amm: delete the app-side orchestration (SwapRuntime, NewPositionRuntime, AmmClient/BundledAmmClient) and the amm_client link. AmmUiBackend now owns only wallet-session lifecycle and forwards every AMM slot to modules().amm_module. The one wallet-keyset mutation add-liquidity needs — creating a fresh LP holding — stays in the backend (via its wallet provider, keeping the account model and on-disk storage coherent): the module returns "requires_fresh_lp" without submitting, the backend creates the account and resubmits with its id. flake.nix / CMakeLists / metadata: the module links the amm_client crate; the UI links no external lib and depends on amm_module (injected into the UI builder's flakeInputs so the dependency resolves). - amounts/deadline declared nlohmann::json so the generated dispatch accepts a JSON number (bare small ints on the CLI) or a string (exact u128 from the UI, or a quote-wrapped big value on the CLI); JSON floats are rejected rather than submit a silently-rounded amount. - AMM_DEBUG-gated tracing for the swap path. - Drop tests/cpp/NewPositionRuntimeTest.cpp with the class it covered (module-level tests to follow). - modules/amm/README.md: architecture, headless prerequisites, logoscore recipe.
0x-r4bbit
force-pushed
the
feat/amm-logos-module
branch
from
July 30, 2026 13:08
b147882 to
f46dc7a
Compare
Collaborator
Author
|
@3esmit Addressed your comments |
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.
Introduce modules/amm — the AMM business logic (resolvePool, swapExactInput, tokenList) as a universal core Logos module that wraps amm_client_ffi and depends on the logos_execution_zone wallet module. The same surface is now consumed by the QML UI (via modules().amm_module) and headlessly (logoscore call amm_module ...).