SpiritSwap V2
  • 👻SpiritSwap V2 introduction
  • ✅Getting Started
  • 🗺️Roadmap
    • 🚉Canto Chain
  • 📖General Resources
  • 📢Marketing Material
  • CORE FEATURES
    • 🏧Exchange
      • 🦄vAMM
    • 🏬Liquidity
      • 🦄vAMM
      • ⚖️Balanced AMM (V2.1)
    • 💰Protocol Fees
      • 🦄vAMM fees - 0.18%
      • 🔀Stable Swap fees - 0.04% (customizable fees)
      • ⚖️(V2.1)Weighted pool fees - Dynamic
    • 👩‍🌾Yield Farms
      • 📟Gauges
      • ♻️Permissionless Ecosystem Farms (V2.5 Update)
    • 🗝️inSPIRIT
    • 🌉Bridge
    • 🧪Subcore Feature
      • 🔑Wrapped inSPIRIT
      • 🔖Ola Lending
  • TOKENOMICS
    • 🌎Overview
      • 💪REAL YIELD
    • 🪙$SPIRIT
      • ⏳Emissions
      • ❌Risks
    • 🗝️inSPIRIT
      • 🔄inSPIRIT weekly distribution
      • 🗳️Governance over SnapShots
      • 🔥Farm Boost
      • 🤑Bribes
  • BLOCKCHAIN DATA
    • ☄️Contracts
  • SOULLY'S HOW TO
    • 👨‍💻Pull SpiritSwap data feeds using Covalent API
    • 🦮Guide Overview
    • 🦊How to - Connecting to Metamask
    • 🌉How to - Bridge
    • 🔁How to -Exchange
      • 📔How to - Swapping Tokens & Limit Orders
    • 💦How to - Liquidity
    • 🧑‍🌾How to - Yield Farming
    • 🗝️How to - inSPIRIT
    • 📊How to - Dashboard / Portfolio
    • 💵How to - Lending and Borrowing
    • ✍️How to - Gauge Voting and Bribes
    • 🌾How to - Create a farm
    • ✅How to - Verify Contracts
      • 📃Verify Gauge Contract
    • 🖥️How to - Apply for Whitelist
  • CANTO
    • 🌉Bridging to Canto EVM
  • ARCHIVED
    • 🐵Ape mode
    • ☄️Contracts
Powered by GitBook
On this page
  1. CORE FEATURES
  2. Liquidity

vAMM

PreviousLiquidityNextBalanced AMM (V2.1)

Last updated 3 years ago

SpiritSwap offers users a simple way to provide liquidity for tokens on Fantom via automated liquidity pools (LPs). To become a liquidity provider on SpiritSwap, a user must deposit equal values of two tokens. In return, they receive SPIRIT-LP tokens (SpiritSwap Liquidity Pool tokens). SPIRIT-LP tokens represent a proportional share of the given LP and liquidity providers may claim their underlying tokens anytime. Liquidity providers receive a 0.25% fee for every swap that is made in their pair. The 0.25% fee is directly added back to the LP, increasing the value of SPIRIT-LP tokens. Liquidity providers can also participate in yield farming with supported LPs.

Anyone can make a LP on SpiritSwap, with any two tokens (on Fantom) of their choice. When an LP is created, the creator sets the price of the tokens. The amount of SPIRIT-LP (SSLP) shares minted are based on the equation:

SSLP=sqrt(x∗y)SSLP = sqrt(x*y)SSLP=sqrt(x∗y)

Swap fees are directly accumulated in the LP. For each swap a 0.3% fee is charged to the trader in the token they are selling. This is added to the LP and slightly increases the LP's k value with every swap. 5/6 of the 0.3% fee goes to the liquidity providers and 1/6 of the 0.3% swap fee goes to the protocol fee vault. The protocol fee vault only receives their fees (in the form of SPIRIT-LP tokens) when a liquidity provider enters or exits the LP. After sometime, swaps are made in the $AAA/$BBB LP, increasing the LP's k value. The change in k and number of outstanding shares can be used to calculate the number of SPIRIT-LP tokens that get minted into the protocol fee vault. The number of SSLP tokens to minted for the protocol fee vault can be calculated by the equation:

SSLP=s∗(sqrt(k2)−sqrt(k1))/(5∗sqrt(k2)+sqrt(k1))SSLP = s*(sqrt(k2)-sqrt(k1))/(5*sqrt(k2)+sqrt(k1))SSLP=s∗(sqrt(k2)−sqrt(k1))/(5∗sqrt(k2)+sqrt(k1))

Where s is the number of outstanding SSLP tokens, k2 is the current k value of the LP, and k1 is the k value of the LP at the last deposit/withdraw from the LP. Figure 2 shows a diagram of a liquidity provider depositing $AAA and $BBB tokens to the LP from Figure 1, after a swap has been made.

In Figure 2, a new liquidity provider deposits funds to the $AAA/$BBB SPIRIT-LP. The liquidity provider-must deposit $AAA and $BBB tokens in the same proportion as the LP reserve. In the example above, the liquidity provider must deposit 0.00827 $BBB tokens for every 1 $AAA token they wish to deposit. The LP first mints SPIRIT-LP tokens to the protocol fee vault, then calculates the number of SPIRIT-LP tokens minted to the new liquidity provider with the equation:

SSLP=x,deposited∗s/xSSLP=x,deposited*s/xSSLP=x,deposited∗s/x

Where x,deposited is equal to the number of $AAA tokens deposited by the new liquidity provider, s is the number of outstanding SPIRIT-LP shares (including the newly minted shares for the protocol fee vault), and x is the number of $AAA tokens in the LP.

🏬
🦄