Smooth Swap

Smoothy implements a simple and efficient swap that supports a long list of assets in the pool. For each token in the pool, it has two swap parameters

  • Soft weight - the highest percentage of the token until it becomes unbalanced (imposing penalty);

  • Hard weight - the percentage of a token should never exceed, which should be equal to or greater than soft weight.

For any swap that results in percentage changes of the tokens in the pool, as long as the percentages fall into the range of soft weights of the swapped tokens, then 1:1 ratio swap is guaranteed. Otherwise, a penalty will be imposed for the swap.

Example A (Swap without Penalty): Suppose the pool has 120M USDC / 80M USDT and the soft weights of USDC and USDT are 60%, 60% respectively. A user can swap 10M USDT for 10M USDC as the resulting percentages of USDC/USDT are [55%, 45%], which fall into the soft weight range.

Example B (Swap with Penalty): Suppose the pool has 120M USDC / 80M USDT and the soft weights of USDC and USDT are 60%, 60% respectively. A user wants to swap 10M USDC for USDT. However, since the resulting percentage of USDC > 60%, the user will get < 10M USDT.

Note that the penalty fee will be evenly distributed to LPs, in order to compensate them for the risk of holding the excess asset in the (post-swap) pool.

Penalty Calculation

The penalty is using a bonding curve, where the penalty increases (and thus the price of returned token increases) as the percentage of a token increases.

An example of price increase as the percentage of the token in the pool increases.

The detailed idea behind the bonding curve can be found here.