Tutorial: how to set the amplification coefficient for stableswap pools


One of Astroport’s core design principles is flexibility. This is achieved by combining various specialized pool types (constant product, stableswap) and routing seamlessly across them. Choosing the appropriate parameters and pool type for a given token market can increase efficiency for both traders and liquidity providers.

The beginning of this article compares constant product and stableswap pools. The second half discusses setting the amplification coefficient for stableswap pools. The last section covers the technical implementation for creating a stableswap pool.

Stableswap invariant: an addition to the constant product formula

Constant product pools work well for volatile pairs like ASTRO/USDC and ASTRO/LUNA. The price of one token relative to another is calculated by the ratio of each type of token in a pool and the constant product formula (x * y = k). When a user swaps tokens, a pool’s values for x and y in a pool will change, but the value of k remains constant. In other words, the pool recalculates the ratio between the two tokens in the pair and updates prices accordingly. In this way, we can say that liquidity for constant product pools is spread across all possible ranges in the price curve [0, ∞] which works well for volatile pairs.

But, capital is not always used in all ranges, especially for stable pairs. For example, USDC/USDT trades closely around the 1:1 exchange rate with some price deviation between $0.99 and $1.01. In this case, a constant product formula would require liquidity providers to allocate capital even at price ranges that are unlikely. This hurts liquidity providers since they could be earning more fees if their capital was concentrated around a stable rate and it hurts traders since they are subject to slippage given the lack of concentrated liquidity.

A solution to this problem is the stableswap invariant formula. Instead of spreading liquidity evenly across all possible price ranges, liquidity tends to concentrate around the 1:1 exchange rate. This is achieved by combining the constant product formula with the constant sum formula and an amplification coefficient.

A constant price pool is similar to a constant product pool but uses a constant sum formula (x + y = k), resulting in a constant price (x / y = 1). And an amplification coefficient determines how close the stableswap curve should be to the constant price curve. When amplification is set to 0, the stableswap curve looks identical to the constant product curve. However, as the amplification increases, the stableswap curve gets closer to the constant price curve, resulting in lower slippages for exchange rates close to 1:1.

Setting an amplification coefficient

If the constant price curve is so great for stable pairs, why don’t we use it instead? Why do we need an amplification parameter? Having our stableswap curve closer to the constant price curve comes at a cost. If assets in a pool become imbalanced, trades would likely suffer from increased slippage, and a token’s reserves could easily be depleted.

A proper balance between constant product and constant price curves must be maintained to maximize capital efficiency and lower slippage in stable pairs, and this is achieved through an appropriate value for the amplification parameter. This article makes no specific recommendations, but some factors to consider include whether the stablecoin is bridged, algorithmic, collateralized, and/or redeemable.


There is existing documentation on creating a stableswap pool and setting the amplification parameter. In this section, we briefly gather these resources:

  1. The easiest method to create a stableswap pool is the Astroport WebApp. Under the Pool tab, you can select “Create a Pool,” specify a stableswap pool, and set the amplification parameter. You can even import IBC tokens and create cross-chain pairs directly.
  2. If you are more technically savvy, you can interact with the Factory contract directly and create a pool. For stableswap pools, you will need to include an embedded message that specifies the amplification parameter. More details can be found here (note that this tutorial uses the LCDC client for Terra Classic. For an updated tutorial on setting up Terra.js with Terra 2.0, look here).
  3. You’ve created a stableswap pool, and now you want ASTRO incentives? Create a proposal! A step-by-step technical guide on implementing an on-chain proposal can be found here (note that before submitting an on-chain proposal, the proposal needs to go through the Astroport forum and the Astroport Improvement Proposal (AIPs) process. For more information on the general governance process, visit here.)


Creating a stableswap pool, or any pool, on Astroport is permissionless. Anyone can interact with the Astroport smart contracts directly, and the WebApp makes it easy for non-technical users as well. More importantly, anyone can engage in the forums, launch a proposal, and get incentives passed for their pool entirely on their own. Make sure to review our previous guides for more details, and stay tuned for any future tutorials coming up.


Follow Astroport on Twitter and subscribe to the Astroport email newsletter to get the latest alerts from the mothership.‍


Remember, Terra 2.0 and Astroport are experimental technologies. This article does not constitute investment advice and is subject to and limited by the Astroport disclaimers, which you should review before interacting with the protocol.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



An automated, decentralised exchange protocol on the Terra blockchain. http://astroport.fi