Expand description
Peer-to-peer trading and AMM constant-product pool.
Implements the exchange surface documented in Melvin Carvalho’s Practical Guide to Solid, parts 8–9: https://melvin.me/public/solid/
- Order book (
/pay/.sell,/pay/.offers,/pay/.swap): sellers post sell orders specifying amount, currency pair, and price; buyers execute atomic swaps against the order book. - AMM pool (
/pay/.pool): constant-productx * y = kliquidity pool with configurable fee (default 30 bps / 0.3%).
All balance mutations delegate to WebLedger — this module never
owns or persists balances directly. Integer-only arithmetic with
u128 intermediates prevents overflow on multiply-before-divide.
Structs§
- AmmPool
- AMM constant-product liquidity pool (
x * y = k). - Exchange
- Combined exchange state: order book + AMM pool registry.
- Order
Book - Order book for peer-to-peer trades.
- Sell
Order - A sell order on the order book.
- Swap
Result - Result of executing a trade (either order-book or AMM).