Skip to content
Open
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
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
"apps/amm/client",
"modules/amm/ffi",
"programs/token/core",
"programs/token",
"programs/token/methods",
Expand Down
30 changes: 3 additions & 27 deletions apps/amm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ project(AmmUiPlugin LANGUAGES CXX)
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Network Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.8)

find_package(PkgConfig REQUIRED)
pkg_check_modules(BASE58 REQUIRED IMPORTED_TARGET libbase58)

include(CTest)

if(DEFINED ENV{LOGOS_MODULE_BUILDER_ROOT})
Expand All @@ -27,6 +24,9 @@ add_subdirectory("${LOGOS_WALLET_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/share

# ui_qml module with a hand-written C++ backend (QtRO .rep view contract +
# generated *SimpleSource/*ViewPluginBase). Mirrors the LEZ wallet UI module.
# The AMM business logic lives in the amm_module core module (declared as a
# dependency in metadata.json, reached via modules().amm_module in the backend),
# so the UI links no amm_ffi library of its own.
logos_module(
NAME amm_ui
REP_FILE src/AmmUiBackend.rep
Expand All @@ -36,34 +36,10 @@ logos_module(
src/AmmUiPlugin.cpp
src/AmmUiBackend.h
src/AmmUiBackend.cpp
src/ActiveNetwork.h
src/AmmClient.h
src/AmmClient.cpp
src/NewPositionRuntime.h
src/NewPositionRuntime.cpp
src/SwapRuntime.h
src/SwapRuntime.cpp
FIND_PACKAGES
Qt6Gui
LINK_LIBRARIES
Qt6::Gui
PkgConfig::BASE58
LINK_TARGETS
logos_wallet_access
EXTERNAL_LIBS
amm_client
)

if(BUILD_TESTING)
add_executable(amm_new_position_runtime_test
tests/cpp/NewPositionRuntimeTest.cpp
src/NewPositionRuntime.cpp
)
target_include_directories(amm_new_position_runtime_test PRIVATE src)
target_link_libraries(amm_new_position_runtime_test PRIVATE
Qt6::Core
PkgConfig::BASE58
logos_wallet_access
)
add_test(NAME amm_new_position_runtime COMMAND amm_new_position_runtime_test)
endif()
13 changes: 7 additions & 6 deletions apps/amm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ This makes `lgpm` available as a global command.

## Running the UI standalone

The app is built from the **repository-root** flake (which also provides the
`amm_client_ffi` library it links). From the repo root, launch it with its named
attribute:
The app is built from the **repository-root** flake (which also builds the
`amm_module` core module the UI delegates its AMM logic to). From the repo root,
launch it with its named attribute:

```bash
nix run .#amm-ui
```

This builds and runs the application in development mode. The Logos bridge is unavailable in standalone mode, but the UI layout and mock data are fully functional.

Build just the FFI crate with `nix build .#amm_client_ffi`. (Each UI is exposed
under its own name, so future apps are `nix run .#<name>` — there is no bare
`nix run .` default.)
Build just the AMM core module with `nix build .#amm-module`, or its underlying
logic crate with `nix build .#amm_ffi`. (Each UI is exposed under its own
name, so future apps are `nix run .#<name>` — there is no bare `nix run .`
default.)

## Running inside Logos Basecamp

Expand Down
4 changes: 2 additions & 2 deletions apps/amm/VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ syntax, and the complete module build.
Run from the repository root:

```bash
cargo +1.94.0 test -p amm_client
cargo +1.94.0 clippy -p amm_client --all-targets -- -D warnings
cargo +1.94.0 test -p amm_ffi
cargo +1.94.0 clippy -p amm_ffi --all-targets -- -D warnings
logos_qml=$(nix build github:logos-co/logos-design-system/6176f0d7a5dfeb64a7f0f98e7ca2bf71a4804772 --no-link --print-out-paths)
amm_qml=$(nix build ./apps/amm#packages.x86_64-linux.default --no-link --print-out-paths)
qt_qml=$(nix-store --query --requisites "$amm_qml" | rg -m1 -- '-qtdeclarative-[0-9]')
Expand Down
27 changes: 8 additions & 19 deletions apps/amm/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,15 @@
inputs.logos-execution-zone.url =
"github:logos-blockchain/logos-execution-zone?rev=a7e06a660940a00093b1760560d37ff84aff5a05";
};

amm_client.url = "path:../..";
};

# NOTE: this flake is no longer built standalone. The amm_client crate
# (the Rust C FFI library the AmmUiBackend C++ code links against) lives in
# the repo-root flake, and referencing it from here would require either a
# hardcoded absolute `git+file://` path or a `path:../..` input — the latter
# fails flake evaluation because the app directory is copied into the Nix
# store as its own flake root, so `../..` can't escape it there. Instead,
# the repo-root flake.nix builds this module directly (src = ./apps/amm)
# and resolves amm_client via `self`. The repo-root flake exposes the UI
# as a named attribute (there is no bare `default`): run it from the repo root
# with `nix run .#amm-ui`, and build just the FFI crate with
# `nix build .#amm_client`.
# NOTE: this flake is no longer built standalone; the repo-root flake.nix
# builds the UI directly (src = ./apps/amm). The UI links no external lib of
# its own — the AMM logic lives in the amm_ffi crate, which the amm_module
# core module links; the UI reaches it via modules().amm_module (declared in
# metadata.json `dependencies`). The repo-root flake exposes the UI as a named
# attribute (there is no bare `default`): run it with `nix run .#amm-ui`, and
# build the AMM logic crate with `nix build .#amm_ffi`.
outputs = inputs@{ logos-module-builder, shared_wallet, ... }:
logos-module-builder.lib.mkLogosQmlModule {
src = ./.;
Expand All @@ -49,12 +43,7 @@
preConfigure = ''
cmakeFlagsArray+=("-DLOGOS_WALLET_SOURCE_DIR=${shared_wallet}")
'';
externalLibInputs = {
amm_client = {
input = inputs.amm_client;
packages.default = "amm_client";
};
};
externalLibInputs = { };
postInstall = ''
# The builder installs the view under lib/qml after this hook. Its
# import descriptor points back to this compiled shared QML module.
Expand Down
8 changes: 3 additions & 5 deletions apps/amm/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@
"main": "amm_ui_plugin",
"view": "qml/Main.qml",
"icon": "icons/amm.png",
"dependencies": ["logos_execution_zone"],
"dependencies": ["logos_execution_zone", "amm_module"],

"nix": {
"packages": {
"build": ["pkg-config"],
"runtime": ["qt6.qtdeclarative", "zstd", "krb5", "abseil-cpp", "libbase58"]
},
"external_libraries": [
{ "name": "amm_client" }
],
"external_libraries": [],
"cmake": {
"find_packages": [],
"extra_sources": [],
"extra_include_dirs": ["lib"],
"extra_include_dirs": [],
"extra_link_libraries": []
}
}
Expand Down
17 changes: 0 additions & 17 deletions apps/amm/src/ActiveNetwork.h

This file was deleted.

91 changes: 0 additions & 91 deletions apps/amm/src/AmmClient.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions apps/amm/src/AmmClient.h

This file was deleted.

Loading