Skip to main content

AMM Overview

The XYZ AMM is a constant-product automated market maker that provides trading for tokens that have graduated from the Launchpad. It uses the standard x * y = k formula, where trading fees stay in the pool to benefit liquidity providers.

How It Works

The AMM maintains pools of two assets: XYZ and a CW20 token. The product of both reserves stays constant (minus fees):
xyz_reserve * token_reserve = k (constant)
When you swap XYZ for tokens, you add XYZ to the pool and remove tokens. The price adjusts automatically based on the ratio of reserves.

Price Formula

output = output_reserve * input_after_fee / (input_reserve + input_after_fee)
Larger trades relative to pool size have more price impact (slippage). Deeper pools provide better prices.

Pool Creation

Pools are created automatically when a launchpad token graduates. Only the launchpad contract (an authorized creator) can create new pools. When a token graduates at its dynamic XYZ threshold:
AssetAmount Added to Pool
XYZAll curve reserves
TokenAll unsold tokens from the curve (~20.69M)
This creates a pool with deep initial liquidity from day one.

Fee Structure

FeeRateDetails
Base swap fee1% (100 bps)Applied to all swaps; stays in the pool
Augmented fee0-5% (optional)Extra fee on new pools; auto-disables at target

How Fees Work

Swap fees are deducted from your input before the trade calculation. The fee tokens stay in the pool, increasing reserves. This means LP positions grow in value over time as fees accumulate — the fee auto-compounds.

Augmented Fee

Newly graduated pools may have a temporary augmented fee (up to 5%) on top of the base 1%. This extra fee auto-disables once the pool’s total value reaches a target threshold. You can check the status:
{ "augmented_fee_status": { "token_address": "<cw20_token_address>" } }
Returns whether the augmented fee is active, the current pool value, and progress toward the target.

Querying Pool Info

Get the current state of any pool:
{ "pool": { "token_address": "<cw20_token_address>" } }
Returns:
{
  token_address: string;
  xyz_reserve: string;      // XYZ in pool (uxyz)
  token_reserve: string;    // Tokens in pool (micro-units)
  lp_token_address: string; // LP token contract
  lp_total_supply: string;  // Total LP tokens minted
  price: string;            // Current price: XYZ per token
}

Listing All Pools

{
  "all_pools": {
    "start_after": null,
    "limit": 10
  }
}
Returns up to 30 pools per page. Pass the last token_address as start_after for pagination.

Next Steps