Skip to main content

Module 2: The Private ZK-AMM

The ZendexAmmManager operates a constant-product automated market maker (x⋅y=kx \cdot y = k) executed under zero-knowledge constraints.

  • Private Swaps: Users supply an input asset commitment, a desired output asset identifier, and a SwapVerifier proof. The Noir circuit verifies that the pricing adheres to constant-product curves, validates slippage boundaries, nullifies the input commitment, and appends the new asset commitment to TreeOperator.
  • Slippage Protection: All swaps enforce a maximum hardcoded slippage tolerance limit of 5% (500 basis points) within the circuit. Trades exceeding this tolerance fail client-side verification.
  • Dust Redirection: Non-zero fractional dust balances resulting from fixed-precision circuit arithmetic are routed to a dedicated protocol fee balance managed by RewardsEngine.

Swaps and Liquidity From the User's Side​

  • Swap: Exchange a deposit for another token at the pool price. You receive exactly the amount shown as a new shielded note. The slippage tolerance holds back part of the deposit so the swap still succeeds if the price moves, and the unused part is sent to your dust address (see The Dust Address).
  • Liquidity: Add a deposit to a pool to earn trading fees, and remove it later.
  • Whole notes: Swaps and liquidity actions use the full amount of the deposit you pick. To use only part of it, Split the deposit first.