PEPA Docs
  • 👋About PEPA
    • AMM+PMM DEX
    • IDO Launchpad
    • Bond Market
    • Contact Us
  • 💡Overview
    • ⚡Our Feature
    • 🗺️Roadmap
  • 🖱️PRODUCT DESIGN
    • 💱PMM Guided Exchange
      • User Interface
      • PMM Algorithm
      • Math Behind PMM
    • 💸One-stop IDO Center
    • 🎟️Bond Market
    • ⛽Fuel Ecosystem
  • 🪙TOKENOMICS
    • 🚗PEPA Token
    • 🏎️vPEPA Token
    • 🚌PEPA Loyalty Program
    • 🏢Governance
Powered by GitBook
On this page
  • Token Type
  • Pool Parameters
  • PMM Formula
  • AMM & Stable Swap Use Cases
  1. PRODUCT DESIGN
  2. PMM Guided Exchange

Math Behind PMM

Token Type

base and quote are two concepts that will be mentioned frequently. Two easy ways to distinguish between them are:

  • In a trading pair, the base is always the token before the hyphen, and quote is after it

  • In transactions, the price refers to how many quote tokens are needed in exchange for one base token

For example, in the ETH-USDC trading pair, ETH is the base token and USDC is the quote token.

Pool Parameters

The funding pool of PMM is described by four parameters:

  • B0B_0B0​: base token regression target - total number of base tokens deposited by liquidity providers

  • Q0Q_0Q0​: quote token regression target - total number of quote tokens deposited by liquidity providers

  • BBB: base token balance - number of base tokens currently in the pool

  • QQQ: quote token balance - number of quote tokens currently in the pool

PMM Formula

The PMM price curve is plotted by the following pricing formula:

Pmargin=iRP_{margin}=iRPmargin​=iR

Where RRR is defined to be the piecewise function below:

SellBaseToken:if B<B0, R=1−k+(B0B)2kSellBaseToken:if \ B<B_0, \ R=1-k+(\frac{B_0}{B})^2kSellBaseToken:if B<B0​, R=1−k+(BB0​​)2k

SellQuoteToken:if Q<Q0, R=1/(1−k+(Q0Q)2k)Sell Quote Token:if \ Q<Q_0, \ R=1/(1-k+(\frac{Q_0}{Q})^2k)SellQuoteToken:if Q<Q0​, R=1/(1−k+(QQ0​​)2k)

else R=1else \ R=1else R=1

AMM & Stable Swap Use Cases

PMM supports transition to AMM and stable coin trading as well.

Traditional AMM

PMM is a generalization of AMM, when:

  • k = 1

  • deposit and withdraw in proportion to the current pool ratio

Stable swap

PMM can also be used as stable swap, when:

  • i = 1

  • k = 0.0001

PreviousPMM AlgorithmNextOne-stop IDO Center

Last updated 2 years ago

🖱️
💱