Pool Types & Math

This page explains the three pool models HoneyPlay implements, how their math works, and when to use each. Our math is inspired by the battle-tested designs from Curve (StableSwap & “crypto/Curve v2”) and Balancer (Weighted/constant-mean), adapted to Sui with fixed-point safety and gas-aware iterations. We cite the original sources where helpful.

💡 At a glance

  • Curved Pools (Curve v2-style) — for uncorrelated assets (e.g., HONEY/USDC). Dynamic price-scaling, EMA oracles and adaptive fees keep trades efficient even when the market moves. Medium

  • Stable Pools (StableSwap) — for pegged/correlated assets (e.g., USDC/USDT, stables/derivatives). An amplification parameter A flattens the curve near the peg for ultra-low slippage. GitHub+1

  • Weighted Pools (Balancer-style) — for arbitrary assets and weights (e.g., 80/20 HONEY/SUI, tri-asset baskets). Prices come from the constant-mean invariant. docs-v2.balancer.fi

Curved Pools

Curved pools target uncorrelated pairs. They extend constant-product with a dynamic price scale, EMA oracle, and adaptive fees so the pool can “follow” the market and keep most liquidity around the current price — without LPs micromanaging ranges.

Key parameters

  • Amplification A — concentrates liquidity around the reference price; higher A “stiffens” the curve near balance.

  • Gamma γ — controls how fast the bonding curve re-centers when the pool is imbalanced (stability vs. reactivity).

  • Price scale & EMA — the pool maintains a price_scale updated using an EMA of trade prices; periodic “tweaks” gently re-peg the curve to the observed market. Medium

  • Adaptive feesmid_fee (near balance), out_fee (far from balance), and fee_gamma (how quickly fees ramp with imbalance). Medium

How pricing works (intuition)

  1. Normalize balances by scaling factors.

  2. Solve the invariant (internally tracked as _D/virtual_price) using guarded Newton steps.

  3. Apply price scale to reflect external market levels (from EMA).

  4. Charge a state-dependent fee: close to balance → mid_fee; far from balance → approach out_fee.

  5. Compute out/in with compute_ask_amount / compute_offer_amount.

These mechanics come from Curve’s crypto-pools derivations (TriCrypto-style), adapted for Sui. Medium

🔬 Why this matters

In volatile pairs, a static constant-product curve either yields too much slippage or invites toxic order flow. The EMA price scale and fee ramping harden the pool against MEV and price shocks while keeping LPs competitive.

When to use: uncorrelated mature assets. You want self-adjusting curves without active LP management.

Stable Pools

Stable pools target pegged assets. The StableSwap invariant moves between constant sum (ultra-flat near the peg) and constant product (protective when imbalanced), controlled by A (amplification).

  • Invariant D solves a polynomial that blends constant-sum and constant-product regimes; it’s computed iteratively (Newton method).

  • Given target D, we solve for the new balance y of the output asset (function often named calc_y/getTokenBalanceGivenInvariant…), then derive amount_out (or invert for amount_in).

Behavior:

  • High A → flatter around the peg → very low slippage for small trades.

  • Low A → more curvature → behaves closer to constant product when off-peg.

When to use

  • Stablecoin↔stablecoin, staked↔underlying, bridged↔native wrappers, derivative pegs.

Weighted Pools

Weighted pools extend Balancer's model for multiple uncorrelated assets with custom weights, generalizing constant-product to arbitrary proportions.

Per the Balancer whitepaper, weighted pools use a generalized constant-product invariant supporting n assets and weights w_i (sum=1). This allows imbalanced pools (e.g., 80/20) for uncorrelated assets, pricing based on weighted scarcity.

When to use

  • Non-pegged assets where you want custom exposure (e.g., 80/20, 60/40) or multi-asset pools (indexes/treasuries).

Choosing the right pool

Use case
Recommended pool
Why

Stable ↔ stable (tight peg)

Stable

High A flattens slippage near peg. GitHub+1

Volatile pair, mature assets

Curved

EMA price-scale + adaptive fees defend against drift/toxic flow. Medium

Volatile tokens / custom exposure

Weighted

Generalized constant-mean with arbitrary weights & N assets. docs-v2.balancer.fi

Last updated