Swop.fi
Published in

Swop.fi

How do share tokens (aka LP tokens) work in Swop.fi?

When you add liquidity to a Swop.fi pool, you receive share tokens, also known as pool tokens or LP tokens. A share token is simply an accounting tool that represents your share of the total pool liquidity. When swaps happen, staking rewards are accrued, and other providers add and remove liquidity, share token tracks which portion of the underlying liquidity you are entitled to.

In return for your share tokens, you can obtain the corresponding share of underlying liquidity, including accumulated fees and staking rewards for USDN-containing pools. That’s the only purpose of share tokens. Of course, you can do whatever you want with them: transfer, sell, or even burn — but, if you don’t have share tokens, you cannot remove liquidity.

Swop.fi share tokens work in the same way as in many other AMMs:

  • When someone provides liquidity, the smart contract mints the share tokens and sends them to the provider.
  • Swap fees and USDN staking rewards appended to the pool liquidity do not affect the number of share tokens (but increase their worth).
  • When someone removes liquidity, the smart contract burns their share tokens.

Let’s look at a few examples explaining the share token mechanics, and the profits and risks of providing liquidity.

Adding liquidity

Suppose that the smart contract stores 200,000 WAVES and 1,000,000 USDN, and the smart contract has currently minted 400,000 share token named sWAVES_USD-N.

If you add 2,000 WAVES and 10,000 for the WAVES-USDN pool, the smart contract mints 4,000 sWAVES_USD-N — in proportion to your share:

The total supply of sWAVES_USD-N is now 404,000, and you are entitled to 4,000/404,000 ≈ 0,0099 of the pool.

Earning fees

Suppose that a user swaps 100 WAVES to USDN. According to the CPMM formula, the equivalent amount of USDN is ~ 499.75 USDN.

  • The user receives ~498.25 USDN because of a 0.3% fee.
  • 60% of the fee (~0.9 USDN) remains in the pool.
  • 40% (~0.6 USDN) goes to a separate address (this portion will be spent on increasing SWOP governance token capitalization).

For now, token amounts in the pool and your share are:

You can see that the WAVES amount in the pool and in your share increases and the USDN amount decreases. If, conversely, a user swaps USDN to WAVES, then WAVES amount in the pool decreases and USDN amount increases. Throughout the swaps, the pools accumulate the fees steadily.

Let’s assume that a large amount of swaps happened back and forth and, due to the collected fees, both amounts increased: 205,000 WAVES and 1,025,000 USDN. You still have 4,000 sWAVES_USD-N, but their worth has grown: you can now claim more WAVES and USDN than you provide.

Diluting share

If anyone else now adds 2,000 WAVES and 10,000 USDN as you did before, they only receive 3,941.46 sWAVES_USD-N — so the new LP does not get fees collected before.

Impermanent loss

Cryptocurrency market prices are often volatile. When the external market price of a token changes , the divergence between the Swop.fi price and the external market price creates an arbitrage opportunity: for instance, if the WAVES external price increases, arbitragers are able to buy it on Swop.fi and sell elsewhere for profit. The opposite happens when the WAVES price falls. As a result, the Swop.fi prices correlate closely with the external markets.

For CPMM-based pools, price and amount of tokens are interrelated:

USDN amount × WAVES amount = constant

and

USDN amount / WAVES amount = current price

In the previous examples, we suppose that WAVES to USDN price is close to 5. Now suppose that the price increases to 10. Neglecting fees, we have the following:

What happens to your capital? Compared to the initial state of 2,000 WAVES and 10,000 USDN, it is now worth less (in USD at the current price 1 WAVES = 10 USDN) than if you just hold your tokens instead of providing liquidity. This is impermanent loss. It becomes real if you decide to remove liquidity now; otherwise, it could disappear if the price moves in the opposite direction.

In other words, CPMM pools continuously rebalance the token amounts depending on their current market price, implementing the constant-mix strategy of portfolio management. The strategy is to maintain a ratio of different assets buying low and selling high. Depending on price movements that aren’t known in advance, one strategy can work better than the other. The impermanent loss is the outcome of using constant-mix strategy instead of buy-and-hold in case of one-directional price movements. Constant-mix wins if the price tends to rise and fall (see illustration).

In the example above we don’t take swap fees into account; but price changes cause more trades, which lead to more fees collected. In the long term, the income from fees can exceed the impermanent loss; however, there is no guaranteed outcome.

The impermanent loss is an inherent risk in providing liquidity to CPMM pools. If you want to eliminate it, you may prefer investing in Flat pools such as USDN-USDT.

See also questions & answers about providing liquidity and share tokens in Swop.fi FAQ.

Sign up to our Twitter not to miss out our regular updates! Join our support group on Telegram for questions related to our service.

--

--

--

Swop.fi is an instant, AMM-type crypto exchange that offers the most profitable swap formulas for each token pair.

Recommended from Medium

Introducing the Cryptobank

Your Chance To Help Us Create Our Next NFTs

+25.43% growth: How to Buy Orchid (OXT) — A Step by Step Guide | Crypto Buying Tips

https://cryptobuyingtips.com/guides/how-to-buy-orchid-oxt

Joining hands with the World Peace Coin to end the world poverty

How to buy Skycoin in 2019

Passive income opportunity

Risk Habor’s successful first payout

The September Convergence Insight

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
Swop.fi

Swop.fi

Swop.fi is an instant, AMM-type crypto exchange that offers the most profitable swap formulas for each token pair.

More from Medium

DeFi: How to Protect Yourself from Scam

NewKlayPunks X Kai Protocol Official Partnership Announcement

Partners: MetalSwap x ACryptoS