Bonding Curve Trading
While its Curve is open, a Pro token trades against its own BondingCurveV2. Quote is the launch's ERC20 payment asset. Buyers pay Quote and receive launch tokens; sellers do the reverse. Read Factory.getLaunchedToken(token) for the correct Curve and Quote addresses.
Amounts use raw integer units. Launch tokens have 18 decimals; read the Quote's decimals separately.
Buy and sell
Buy
buyExactIn(quoteInRaw, tokenRecipient, minTokenOut, deadline)
Quote allowance to Curve
tokenOut, actual quoteSpentRaw
Sell
sellExactIn(tokenIn, quoteRecipient, minQuoteOutRaw, deadline)
Launch-token allowance to Curve
Net quoteOutRaw
The caller supplies the input; the recipient receives the output and may be another address. Deadlines use Unix seconds. Each method also accepts an optional final bytes32 partnerId; zero means no Partner. Calls use value=0. See Approvals.
Quotes and actual spending
quoteBuyNet expects Quote after fees. quoteSellGross returns Quote before fees. Include the active fees when quoting, then simulate the final call with minimum output and deadline. quoteNetRequiredToBuy is a pricing calculation; Curve execution supports Exact Input only.
A closing buy can exhaust the remaining sellable tokens. The Curve caps token output, refunds unused Quote to its caller and enforces a proportional minimum:
ceil(minTokenOut × quoteSpentRaw / quoteInRaw)
For example, if a request for 200 raw Quote actually spends 115 and its original minimum is 170 raw tokens, the enforced minimum is 98. An output of 100 satisfies that limit, and 85 raw Quote is refunded. Display the actual receipt amounts. Large excess input weakens this minimum; quote the remaining fill and keep the submitted input close to it.
Fees and opening-tax exemptions
Buys charge the base fee, Creator Tax and any active Snipe Tax. Sells charge the base fee and Creator Tax. Each fee is rounded down separately in raw units. A buy is rejected if its combined fees reach 100%; refresh the recipient’s current rate or wait for the opening tax to decrease.
At creation, the original Creator, initial Creator Fee Recipient and recipient of a nonzero initial buy are automatically exempt from Snipe Tax. They still pay the base fee and Creator Tax. This exemption list is fixed at creation; later Controller or Recipient changes do not update it. Read currentSnipeTaxBps(tokenRecipient) for an ordinary buy. Token Creation explains extra exemptions and the initial-buy limit.
See Fees and Claims for the complete cost table and allocation example. When sellable tokens reach zero, Curve trading closes and the buy attempts the sweep stage of Graduation. Pool creation remains a later operation.
Last updated
Was this helpful?