# Swapping Mechanics

The core functionality of veSwap is to allow users to exchange token in a secure, seamless way, with very low fees and low slippage.

To provide access to the best rates on the market, we identified two types of assets:

- correlated - for example
*stable coins*(`$USDC`

,`$USDT`

, etc.) - uncorrelated - for example
`$LINK`

and`$CRV`

veSwap offers two different liquidity pool types based on token pair needs,

*Stable Pools*and*Variable Pools*.The protocol router evaluates both pool types to determine the most efficient price quotation and trade execution route available.

veSwap liquidity pools support one of two different price invariant formulas to accommodate either stable or volatile liquidity pairs.

`x × y = k`

The Volatile Pools use a Uniswap v2 style constant-product curve which is the industry standard for non-correlated pairs, such as WETH and USDC. In the Uniswap V2 model, fluctuations in the price of the two underlying tokens automatically recalibrate the quantity of those tokens to conform to the equation x*y=k, where x and y are the quantities of the two paired tokens, and k is constant. This means that even though you supply equal parts of two tokens to the pool, the quantities you receive when you reclaim your liquidity will change relative to the difference in the change in price of the two tokens when you remove the liquidity. If the price of x token goes up, and y token goes down, you will have less of x and more of y, and vice versa.

`x³y + y³x = k`

The Stable Pools use a hybrid price invariant curve based on Curve Finance's Stable Swap, which is best suited towards highly correlated assets like stablecoins. Curve achieves extremely efficient stablecoin trades by implementing the StableSwap invariant, which has significantly lower slippage for stablecoin trades than constant product invariant.

The chart above compares both the Curve and Uniswap style price invariant curves. It shows how much price impact you can expect in a liquidity pool between the assets X & Y depending on their prices.

The green "Curve-like Stable AMM" curve will enable low price impact trades since the price curve is linear until pushed into its outer bounds by being unbalanced; the x/y ratio have little change while in the linear area.

The brown "Uniswap-like AMM" curve is much more susceptible to price impact because it does not have any linearity on the curve where the liquidity concentrates; every trade will be changing the ratio of X and Y.

Last modified 3mo ago