SpiritSwap
  • This Docs page is now redundant.
  • Getting Started
  • Roadmap
  • Resources
  • Contracts
  • Marketing Material
  • Educational Infographics
  • Features
  • Swap
  • Liquidity
  • Farm
  • inSPIRIT
  • winSPIRIT
  • Tokenomics
    • Overview
    • $SPIRIT Distribution
    • Emissions
    • Fees
    • Risks
  • How To
    • Pull SpiritSwap data feeds using Covalent API
    • Connect MetaMask
    • inSPIRIT
      • 1) Generate inSPIRIT
      • 2) Vote for boosted farms
      • 3) Yield Farm in boosted farms
    • Get winSPIRIT
      • Get ginSPIRIT
      • Get linSPIRIT
    • Swap Tokens
    • Add Liquidity
    • Yield Farm in Farms
    • Stake SPIRIT
    • Zap
    • Bridge from BSC, Ethereum, Polygon, Avalanche or Arbitrum
    • Get FTM (Coinbase Route)
    • How to place a limit order
    • How to use Migrate
    • How to bond SPIRIT/FTM LPs
    • How to vote on gauges and receive bribes.
Powered by GitBook
On this page

Was this helpful?

Swap

PreviousEducational InfographicsNextLiquidity

Last updated 4 years ago

Was this helpful?

SpiritSwap provides users a simple way to swap tokens on Fantom via automated liquidity pools. In a swap, one token is sold to buy another token. The rate of the swap is determined by the AMM with the equation:

x∗y=kx*y=kx∗y=k

Where x = the number of $AAA tokens, y = the number of $BBB tokens, and k is a constant. The trader is charged a 0.3% fee to make a swap.

In Figure 1, a trader is swapping $AAA token for $BBB tokens. The trader sends 100 $AAA tokens to the AMM. A 0.3% fee is applied and 0.3 $AAA tokens are not included in the swap. The remaining 99.7 $AAA tokens are swapped in the AMM to $BBB tokens. Since the AMM will be losing $BBB tokens, it must gain $AAA tokens to keep k constant. The equation:

Can be solved for y to give the number of $BBB tokens that the trader will receive. The 0.3% fee of 0.3 $AAA tokens are directly added to the liquidity pool reserves, slightly increasing the value of k.

(1,000+99.7)∗(10−y)=10,000(1,000+99.7)*(10-y)=10,000 (1,000+99.7)∗(10−y)=10,000
Figure 1. Example of a swap on SpiritSwap.