Overall
  • 👋Welcome to Artichoke
  • Single-Sided LP Mechanics
    • 📠Basic Mathematics
    • 💰Related Pricing
    • 📊The Bonding Curve
    • ⌛Staking & Impermanent Loss
    • 🔙Variation and Returns
    • 🧮Total Returns
  • Single-Sided Liquidity Strategies
    • 1️⃣Uniswap's Inherent Hedging
    • 2️⃣The Straddle
    • 3️⃣Delta-Zero
  • Protocol Architecture
    • 🔀Virtual Omnipool and Tails
    • ⚖️Stabilizer Pool
    • 👨‍💻Product Overview from the User Perspective
  • Token Metrics
    • 🪙CHOKE Token
    • 📈Accruing Value
    • 🔥Burn Schedule
  • Staking
    • 📗Staking Guide
    • ❔Staking FAQ
  • Security Report
    • 🔐Artichoke Alpha Phase Report
  • FAQ
    • ❓Frequently Asked Questions
Powered by GitBook
On this page
  1. Single-Sided LP Mechanics

Basic Mathematics

PreviousWelcome to ArtichokeNextRelated Pricing

Last updated 2 years ago

Lets assume a protocol with a token TPT_PTP​. On an initial cycle is going to be paired with an USD-pegged stablecoin such as USDC. In that way, the LP is going to be TPUSDC\frac{T_P}{USDC}USDCTP​​, and the bonding curve formula given by Uniswap is:

x⋅y=K x \cdot y = Kx⋅y=K

Hence,

TP⋅USDC=KT_P \cdot USDC = KTP​⋅USDC=K

This formula is responsible for calculating prices, and deciding how much TPT_PTP​ token would be received in exchange for a certain amount of USDC, or vice versa.

The formula states that KKK is a constant no matter what the reserves (x or y) are. Every swap increases the reserve of either USDC or TPT_PTP​ token and decreases the reserve of the other.

(x+Δx)⋅(y−Δy)=K(x + \Delta x) \cdot (y - \Delta y) = K(x+Δx)⋅(y−Δy)=K

Where Δx\Delta xΔx is the amount being provided by the user for sale, and Δy\Delta yΔy is the amount the user is receiving from the DEX in exchange for Δx\Delta xΔx.

Since KKK is a constant, we can asume that:

x⋅y=(x+Δx)⋅(y−Δy)x \cdot y = (x + \Delta x) \cdot (y - \Delta y)x⋅y=(x+Δx)⋅(y−Δy)

Before any swap is being made, we know the exact values of x, y, and Δx\Delta xΔx (given by the input). In that way, we are interested in calculating Δy\Delta yΔy, which is the amount of USDC or TPT_PTP​ token the user will receive:

y−Δy=x⋅yx+Δxy - \Delta y = \frac{x \cdot y}{x + \Delta x}y−Δy=x+Δxx⋅y​

−Δy=(y⋅Δx)(x+Δx)−y-\Delta y = \frac{(y \cdot \Delta x)}{(x + \Delta x)} - y −Δy=(x+Δx)(y⋅Δx)​−y

−Δy=x⋅y−y(x+Δx)x+Δx-\Delta y = \frac{x \cdot y - y(x + \Delta x) }{x+ \Delta x}−Δy=x+Δxx⋅y−y(x+Δx)​

−Δy=x⋅y−y⋅x−y⋅Δxx+Δx-\Delta y = \frac{x \cdot y - y \cdot x - y \cdot \Delta x}{x+\Delta x} −Δy=x+Δxx⋅y−y⋅x−y⋅Δx​

−Δy=−y⋅Δxx+Δx-\Delta y = \frac{-y \cdot \Delta x}{x+ \Delta x} −Δy=x+Δx−y⋅Δx​

Hence, after simplyfing the above equation to obtain Δy\Delta yΔy , we get the following:

Δy=(y⋅Δx)(x+Δx)\Delta y = \frac{(y \cdot \Delta x)}{(x + \Delta x)} Δy=(x+Δx)(y⋅Δx)​

📠