Hummus Exchange
  • Welcome to Hummus Exchange
    • Next-gen protocol design
    • Limitations of current stableswap protocols
    • The Yellow paper
    • A Platypus Finance fork
  • Tokenomics
    • Token: HUM and veHUM
    • Distribution
    • Vesting
  • Concepts
    • Coverage Ratio
    • Hummus Exchange Interest Rate Model
    • Fees
    • Swap Slippage
    • Withdrawal Fee
      • Withdrawal Arbitrage: The Risk of Attacks on the protocol
      • The countermeasure against withdrawal attacks
    • Deposit Fee
    • Haircut
  • Security
    • Audits
    • Price Oracle
    • Economic Risk
    • Impairment Loss
Powered by GitBook
On this page
  • Practical example of slippage calculation
  1. Concepts

Swap Slippage

PreviousFeesNextWithdrawal Fee

Last updated 3 years ago

The swap slippage is given by:

Si→j=Si+(−Sj)=Si−SjS_{i \rightarrow j} = S_i + (-S_j) = S_i - S_jSi→j​=Si​+(−Sj​)=Si​−Sj​

and

Si=g(ri′)−g(ri)ri′−riS_i = \dfrac{g(r'_i) - g(r_i)}{r'_i - r_i}Si​=ri′​−ri​g(ri′​)−g(ri​)​
ri′+rir'_i + r_iri′​+ri​

where is the original coverage and is the final coverage.

If the swap amount is small, the slippage can be give by

Si→j=g′(ri)−g′(ri′)S_{i \rightarrow j} = g'(r_i) - g'(r'_i)Si→j​=g′(ri​)−g′(ri′​)

Practical example of slippage calculation

We take the coverage ratio of USDT at 0.909 and ETH at 1.033. Working this out, we’d get:

USDT:

g′(0.909)=−0.00002∗70.9098=0.03%g'(0.909) = -\dfrac{0.00002*7}{0.909^8} = 0.03\%g′(0.909)=−0.90980.00002∗7​=0.03%

ETH:

g′(1.033)=−0.00002∗71.0338=0.01%g'(1.033) = -\dfrac{0.00002*7}{1.033^8} = 0.01\%g′(1.033)=−1.03380.00002∗7​=0.01%

Hence we have

SUSDT→ETH=0.03%−0.01%=0.02%S_{USDT \rightarrow ETH} = 0.03\% - 0.01\% = 0.02\%SUSDT→ETH​=0.03%−0.01%=0.02%

This represents the marginal slippage when someone is performing a small amount of swap at this coverage ratio. And yes, the slippage is positive and user can benefit from the swap!