The bonding curve

Constant product against a phantom quote reserve. The phantom reserve sets the first buyer's price and is never real money; the creator puts up no counter-capital.

quoteReserve = phantomQuote + realQuote
tokensOut = (in × (10000 − fee) × tokenReserve) / (quoteReserve × 10000 + in × (10000 − fee))
  • The reserved allocation. The curve never sells supply × phantomQuote / (phantomQuote + graduationThreshold) tokens. They pass to the factory at graduation, so every launch opens its pool with the same amounts at the same price.
  • Graduation trigger. readyToGraduate() is true once sellableTokens() == 0.
  • Partial fills. A buy that would cross the allocation is filled up to it, charged only for what it received, and refunded the rest (CurveBuyRefunded). For a partial fill, minTokensOut bounds the price rather than the quantity.
  • Fees are always in the quote asset. On a buy they come off the input; on a sell, off the output.
  • Selling closes with the allocation. Once the sellable tokens run out, sell closes too; anyone can then graduate the token and trade in the pool.