Liquidity provider reviewing AMM pool statistics on phone, pool allocation dashboard visible, casual degen setup at home with screens.
Protocols

Stableswap (StableSwapNG) Pool Standard

Technical specification for Curve's core invariant covering the StableSwapNG architecture, amplification coefficient dynamics, dynamic fee logic, and factory-deployed pool interface for stablecoin-to-stablecoin exchanges.
introduction
CORE AMM INVARIANT FOR STABLECOINS

What is the StableSwapNG Pool Standard?

The technical specification for Curve's StableSwapNG architecture, defining the invariant, dynamic fees, and factory interface for efficient stablecoin-to-stablecoin exchanges.

The StableSwapNG Pool Standard is the foundational AMM specification for Curve's stablecoin pools, representing the next-generation evolution of the original Stableswap invariant. It defines the mathematical formula that combines a constant-sum invariant for low-slippage trading near the peg with a constant-product invariant to ensure liquidity at all prices. The 'NG' (Next Generation) architecture introduces a gas-optimized implementation, dynamic fee logic, and a factory-deployed pattern that allows permissionless pool creation for any set of pegged assets.

Operationally, the standard specifies the get_dy and exchange interface that aggregators, trading bots, and wallets must integrate to correctly route stablecoin swaps. A key technical component is the amplification coefficient (A), which is now dynamic and can adjust based on pool conditions to tighten or loosen the spread around the peg. The standard also defines the get_virtual_price method, which is critical for lending protocols and yield aggregators to accurately value LP tokens as collateral. Integrators must handle the new fee getter, which returns a dynamically calculated fee that can change per-block based on the pool's internal balance and the offpeg_fee_multiplier.

For protocol architects and risk teams, the StableSwapNG standard introduces a new trust model for factory-deployed pools. Unlike the original Stableswap, where pools were often deployed individually and verified against a canonical bytecode, the NG factory pattern means that pool logic is a child contract of a verified factory. Auditors and integrators must verify the factory's immutability and the correctness of the find_pool_for_coins lookup. Chainscore Labs can assist teams with an upgrade readiness review, ensuring that smart contract integrations, oracle consumption, and LP token valuation logic are correctly aligned with the StableSwapNG interface before mainnet deployment.

CORE INVARIANT & FACTORY INTERFACE

StableSwapNG Quick Facts

Key technical and operational facts about the StableSwapNG pool standard for integrators, auditors, and risk teams.

FieldValueWhy it matters

Core Invariant

StableSwap (amplified constant sum/constant product hybrid)

Enables low-slippage trades between pegged assets; deviation from peg increases slippage and impermanent loss.

Amplification Coefficient (A)

Dynamic; can be adjusted by governance or factory logic

Controls pool sensitivity to imbalance. A higher A makes the pool behave more like a constant sum, increasing peg-keeping efficiency but raising risk if a peg breaks.

Fee Model

Dynamic fee based on price deviation and internal balance

Fees increase when the pool is imbalanced to protect LPs and decrease when balanced to encourage arbitrage. Aggregators must query dynamic_fee().

LP Token Valuation

Uses get_virtual_price()

This method accounts for accrued fees and is the canonical way to value an LP share. Using a simple ERC-20 balance ratio will misprice the position.

Deployment Pattern

Factory-deployed via StableSwapNG Factory

Ensures a canonical, audited bytecode. Integrators should verify a pool's factory origin before interacting to avoid unverified clones.

Oracle

No native internal EMA oracle

Unlike Cryptoswap pools, StableSwapNG pools do not provide a manipulation-resistant price oracle. Protocols requiring a price feed must use an external oracle or a separate pool type.

Key Affected Actors

Aggregators, wallets, lending protocols, yield aggregators, stablecoin issuers

Any system that routes trades, values LP tokens, or uses the pool as a price reference must adapt to the dynamic fee and virtual price logic.

Primary Risk

Peg devaluation of a constituent asset

The invariant assumes assets are pegged. If one asset depegs, the pool will be drained of other assets, and LP losses are amplified by the high A coefficient.

technical-context
STABLESWAPNG AMM ENGINE

Core Invariant and Dynamic Fee Logic

How Curve's StableSwapNG invariant concentrates liquidity and adjusts fees dynamically to protect LPs and maintain the peg.

The StableSwapNG pool standard is defined by its core invariant, which mathematically combines a constant-sum formula for near-parity assets with a constant-product formula to prevent pool drainage. This creates an amplified bonding curve that concentrates liquidity tightly around the current price, enabling low-slippage swaps between stablecoins or like-kind assets. The A (amplification coefficient) parameter governs the concentration depth: a higher A flattens the curve, reducing slippage for small trades, while a lower A increases slippage and protects LPs during volatility. In StableSwapNG, the A parameter is dynamic and can be adjusted by the pool admin or factory logic, allowing the pool to adapt to changing market conditions without a full migration.

A critical operational component of StableSwapNG is its dynamic fee logic, which replaces the static fee model of earlier Curve pools. The pool can programmatically adjust swap fees based on the current state of the pool's balance, specifically targeting deviations from the peg. When the pool becomes imbalanced, the fee increases to disincentivize further trades that would exacerbate the imbalance and to compensate LPs for the increased inventory risk. Conversely, fees decrease when the pool is near equilibrium to encourage arbitrage and restore the peg. This logic is implemented via the _dynamic_fee() function, which calculates the fee as a function of the pool's current balance deviation, an offpeg_fee_multiplier, and a base fee. Integrators must query the fee() method before routing trades, as the fee is not a constant.

For builders and risk teams, the dynamic fee model introduces a state-dependent cost that aggregators and trading bots must simulate before submitting transactions to avoid reverted trades or unexpected slippage. Auditors reviewing StableSwapNG pools should verify that the dynamic fee cannot be manipulated through flash loans or multi-block attacks to unfairly penalize LPs or traders. Chainscore Labs can assist integration teams in modeling the fee surface against historical volatility, reviewing factory-deployed pool parameters, and ensuring that off-chain pricing engines correctly consume the dynamic fee to prevent MEV leakage.

IMPACT ANALYSIS

Who is Affected by the StableSwapNG Standard?

Aggregators and Trading Bots

Aggregators and arbitrage bots must update their routing logic to correctly call the new exchange and exchange_received functions. The dynamic fee logic means that static fee assumptions will cause transaction failures or suboptimal routing.

Action Steps:

  • Integrate the get_dy and get_dx views to simulate swaps with the current amplification coefficient and dynamic fee.
  • Update on-chain router contracts to handle the new factory-deployed pool interface.
  • Monitor pool deployment events from the StableSwapNG factory to automatically index new liquidity venues.
implementation-impact
STABLESWAPNG INTEGRATION

Integration and Implementation Impact

StableSwapNG introduces a new factory-deployed architecture with dynamic fees and an updated interface. Integrators must update ABI handling, LP valuation models, and exchange routing to avoid mispricing or failed transactions.

02

Dynamic Fee Handling

Unlike legacy stableswap pools with a fixed fee parameter, StableSwapNG implements a dynamic fee that adjusts based on internal conditions such as price deviation. Integrators must query the on-chain fee state before constructing swap calldata. Off-chain routing engines that cache a static fee will produce inaccurate quotes and may cause transaction reversion.

03

LP Token Valuation Update

The get_virtual_price method remains the canonical source for LP token valuation, but the underlying amplification coefficient (A) and fee logic have changed. Yield aggregators and lending protocols using LP tokens as collateral must update their valuation oracles to read from the new pool implementation. Failing to update will result in stale or incorrect collateral pricing.

04

Exchange and Aggregator Routing

DEX aggregators must add the StableSwapNG factory address and pool interface to their routing algorithms. The dynamic fee requires a simulation or on-chain get_dy call for accurate quoting. Relying on the legacy exchange method signature without verifying the pool type will break swaps for newly deployed stablecoin pairs.

05

Oracle and Price Feed Impact

StableSwapNG pools do not contain the internal EMA oracle found in cryptoswap pools. Protocols using Curve stableswap pools as a price feed must ensure they are not incorrectly assuming an on-chain oracle interface. For stablecoin pricing, external oracles or the pool's spot price via get_dy should be used with appropriate manipulation resistance checks.

06

Audit and Security Review Scope

Protocols composing with StableSwapNG should scope audits to include the factory's permissionless deployment model and the dynamic fee module. The new architecture changes the trust assumptions for pool creation. Chainscore Labs can perform an integration review to verify correct ABI usage, fee handling, and LP token accounting before mainnet deployment.

STABLESWAPNG INTEGRATION SURFACE

Integration Risk and Compatibility Matrix

Evaluates the operational and technical changes that wallets, aggregators, lending protocols, and other integrators must handle when moving from the legacy Stableswap to the StableSwapNG pool standard.

AreaWhat changesWho is affectedAction

Pool Interface

New factory-deployed pool bytecode and ABI. Core exchange functions (e.g., exchange, add_liquidity) may have updated signatures or event structures.

Aggregators, Wallets, DeFi Protocols

Verify the canonical ABI from the Curve StableSwapNG factory repository. Update integration adapters and re-run full interface conformance tests.

LP Token Valuation

The get_virtual_price logic and fee accrual mechanism are updated. The internal balances and dynamic fee may alter the LP token's value accrual pattern.

Yield Aggregators, Lending Protocols, Wallets

Do not rely on legacy Stableswap valuation models. Re-audit the virtual price calculation and test against on-chain state to prevent mispricing of LP positions.

Dynamic Fee Logic

Fees are no longer a static parameter. The new dynamic fee algorithm adjusts based on pool imbalance and internal oracles.

Arbitrage Bots, Trading Desks, Aggregators

Replace static fee assumptions with an on-chain query of the current fee before constructing swap transactions. Backtest strategies against the new fee volatility.

Amplification Coefficient (A)

The A parameter dynamics and optimization logic have been refined. The pool's sensitivity to imbalance may differ from legacy pools.

Liquidity Providers, Risk Teams

Re-evaluate impermanent loss and liquidity concentration models. Monitor pool behavior under volatile conditions to understand the new A parameter's practical effect.

Oracle Integration

The internal EMA oracle implementation and its interface may differ from legacy cryptoswap pools. The standard for querying price data is updated.

Lending Protocols, Derivatives Platforms

Do not assume the legacy EMA oracle interface. Verify the new price_oracle function signature, update staleness checks, and reassess manipulation resistance assumptions.

Event Monitoring

Event signatures and indexed parameters for swaps, deposits, and withdrawals are likely changed to support new features.

Data Indexers, Subgraph Operators, Monitoring Tools

Update subgraph mappings and event listeners to parse the new StableSwapNG event schemas. Rebuild historical data pipelines to ensure continuity.

Gauge Compatibility

The interface for depositing LP tokens into a LiquidityGauge is standardized but must be verified for the new pool type.

Protocols Launching Pools, veCRV Voters

Confirm the StableSwapNG LP token is compatible with the canonical LiquidityGauge contract. Test the full deposit-stake-reward flow on a testnet deployment.

STABLESWAPNG INTEGRATION

Integrator and Auditor Readiness Checklist

A technical checklist for teams integrating or auditing StableSwapNG pools. Each item maps to a specific architectural change from the legacy stableswap invariant, highlighting the verification steps, failure modes, and signals that confirm correct handling of the new dynamic fee, amplification coefficient, and oracle logic.

StableSwapNG introduces a dynamic fee that adjusts based on internal state variables, replacing the fixed fee model of legacy pools. Integrators must confirm that their swap routing, aggregator logic, and liquidity management bots do not rely on a static fee assumption.

  • What to check: Trace the exchange, add_liquidity, and remove_liquidity functions to ensure the fee is read from the pool's state at the time of transaction simulation, not from a hardcoded constant or off-chain registry.
  • Why it matters: A mismatch between the expected and actual fee can cause transaction reversions, failed MEV bundles, or incorrect profit calculations for arbitrageurs and solvers.
  • Readiness signal: Successful mainnet-fork simulation of a multi-hop trade through a StableSwapNG pool where the fee changes between the quote and the settlement.
Chains We Build On

Looking to build on a specific blockchain?

We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.

EVM ecosystems

  • Ethereum logo
    Ethereum
  • Arbitrum logo
    Arbitrum
  • Optimism logo
    Optimism
  • Polygon logo
    Polygon
  • Avalanche logo
    Avalanche
  • Cronos logo
    Cronos

Non-EVM ecosystems

  • Solana logo
    Solana
  • Sui logo
    Sui
  • Aptos logo
    Aptos
  • Hedera logo
    Hedera
  • Stellar logo
    Stellar
  • NEAR logo
    NEAR

Additional ecosystems

  • Polkadot logo
    Polkadot
  • Cosmos logo
    Cosmos
  • TON logo
    TON
  • Cardano logo
    Cardano
  • Algorand logo
    Algorand
  • Tempo logo
    Tempo

Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.

STABLESWAPNG INTEGRATION FAQ

Frequently Asked Questions

Common questions from integrators, aggregators, and risk teams about the StableSwapNG architecture, dynamic fees, oracle compatibility, and LP token valuation.

StableSwapNG pools can adjust fees dynamically based on internal conditions such as price imbalance or volatility, rather than using a single static fee parameter.

What to check:

  • Query the fee() method on the pool contract before constructing a swap path. Do not cache a static fee value.
  • Monitor the ma_exp_time and offpeg_fee_multiplier parameters to understand how aggressively fees can change.
  • For aggregators, ensure your routing algorithm can handle fee variability within a single block; the fee at simulation time may differ from the fee at execution time.

Why it matters: A static fee assumption leads to failed transactions, unexpected slippage, or suboptimal routing. Dynamic fees are a core architectural change from the original Stableswap invariant.

Signal of readiness: Your integration correctly simulates and executes swaps using the live fee() return value and includes a slippage buffer that accounts for potential fee movement between simulation and execution.

Trusted by Industry Leaders

Delivering blockchain solutions for 5+ years.

We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.

Selected Partners & Clients

ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.
L
Lee Erswell
CEO, Telos Foundation
how to get started

How to get started?

If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.

01

Exploration & Strategy

Define your product goals and choose the right blockchain architecture for your use case.

02

Architecture & Design

Design the smart contracts, tokenomics, and security parameters of your system.

03

Development & Integration

Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.

04

Security & Launch

Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.

Start a build

Need a blockchain engineering team?

Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.