DumpsterDumpster Docs
Protocol

Bonding Curve

Constant-product reserve math, buy and sell behavior, and the key properties of Dumpster curve trading.

Protocol

Bonding-curve pricing on Dumpster

The bonding curve decides price from two virtual reserves. When users spend GOR, the token reserve goes down and price moves up. When users sell tokens back, the token reserve goes up and price moves down. For integrations, the useful part is knowing which values move, which rounding rules matter, and when trading should switch venues.

Use the rounding rules below when calculating trade bounds for the matching program version. See fee structure for fee rules.

Core formula

x⋅y=kx \cdot y = k price=xyprice = \frac{x}{y}
  • x = virtual GOR reserves
  • y = virtual token reserves
  • k = constant product

Buy path

When a user buys Δy\Delta y tokens, the curve removes those tokens from the reserve and solves for the new GOR reserve.

y′=y−Δyy' = y - \Delta y x′=⌈ky′⌉x' = \left\lceil \frac{k}{y'} \right\rceil gross GOR in=x′−x\text{gross GOR in} = x' - x

After that, protocol and applicable creator fees are added on top of this fee-exclusive principal. Each component rounds up separately with denominator 100,000. Rates come directly from FeeConfig.curveFees, not AMM tiers or first-buy status; a default creator suppresses its component.

Sell path

When a user sells Δy\Delta y tokens back into the curve, gross GOR output rounds down before fees are deducted.

y′=y+Δyy' = y + \Delta y gross GOR out=⌊x⋅Δyy+Δy⌋\text{gross GOR out} = \left\lfloor \frac{x \cdot \Delta y}{y + \Delta y} \right\rfloor x′=x−gross GOR outx' = x - \text{gross GOR out}

The remaining virtual GOR reserve therefore rounds up, not down. Recompute k from the current reserves for each trade: buy ceiling and sell floor make the product nondecreasing across successful trades, rather than exactly constant after integer rounding.

The seller receives gross output minus separately ceiled protocol and applicable creator fees. Each fee uses the gross output and a denominator of 100,000; the creator fee is zero for a default creator. Both real and virtual GOR reserves decrease by gross output, not net. Fees exceeding gross output reject the trade.

The instruction requires positive token input, but does not require positive net output. With min_gor_output = 0, it can transfer tokens for zero GOR if every other check passes. A positive minimum rejects zero net output, including when a tiny trade rounds to zero gross. Set the minimum to the amount you are willing to receive; a zero SDK quote is not proof that a trade is valid.

What actually matters when you integrate

  • Price is entirely deterministic from the curve reserves.
  • Buy and sell previews must match the protocol's ceiling and floor rounding.
  • Once the curve is complete, trading logic needs to switch to DumpsterSwap.

Match protocol rounding

If your client-side previews ignore the protocol's ceil and floor behavior, your slippage bounds will be wrong on edge cases and larger trades.

On this page