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.
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; higherA“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 fees —
mid_fee(near balance),out_fee(far from balance), andfee_gamma(how quickly fees ramp with imbalance). Medium
How pricing works (intuition)
Normalize balances by scaling factors.
Solve the invariant (internally tracked as
_D/virtual_price) using guarded Newton steps.Apply price scale to reflect external market levels (from EMA).
Charge a state-dependent fee: close to balance →
mid_fee; far from balance → approachout_fee.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
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 deriveamount_out(or invert foramount_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.
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.
Choosing the right pool
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

