Skip to main content

Swap Details

Constant Function Market Maker (CFMM)#

The swap feature uses a CFMM with a curve which has the following features.

  1. It is flat around x = y.
  2. As in a CPMM, even very high inputs of asset 1 in a trade will never empty the asset 2 side of the trade as the function can make the outgoing asset arbitrarily expensive.

This flat curve function is suitable for asset pairs that are highly correlated.


Before Fees#

U(x,y) = (x+y)^8 - (x-y)^8

Application and Integration of Fees#

The fees on each pair will be applied to the gross input on the swap, leaving the net input. The output of the swap is calculated using the Newton-Raphson method (MathWorld or Wikipedia) applied to the CFMM curve and the net input.

Below are graphs for the constant sum, the constant product and the constant function.

Utility Curve#

utility curve



For convenience the youves swap frontend also offers to swap pairs, which are not on the youves backend. This includes for example the uUSD/YOU pair on Quipuswap.

Pairs considered for the flat curve CFMM, should be highly correlated.

#PairFeesStatusSwap Location
1wwBTC/tzBTC0.15%Activeyouves swap
2uBTC/tzBTC0.15%Activeyouves swap
3uUSD/wUSDC0.15%Activeyouves swap
4uUSD/kUSD0.15%Activeyouves swap

Fee Allocation#

For the pairs on youves, 50% of the fees go to the platform profits and 50% go to the liquidity providers.

Liquidity Provision#

Any user can become a liquidity provider.

Adding Liquidity#

For each pair, a user can become a liquidty provider by adding the tokens of the first and the second asset exactly in the same proportion as they are in the liquidity pool at that moment.

Removing Liquidity#

At any point in time a liquidity provider can remove its share of liquidity from the Swap feature. The proportion of the two assets may be different than what was initially put in.