Docs

The curve

A constant-product curve, like the ones you know, with one difference: its starting point is set by the creator in the units of the pair.

Constants

NameValueMeaning
SUPPLY1,000,000,000e18Total coins, minted once
SELLABLE (S)800,000,000e18Sold along the curve
LIQ (L)200,000,000e18Held for the pool
VTS² / (S − L) = 1.0667e27Virtual coin reserve
FEE_BPS1001% on every curve trade

State and the invariant

Each coin stores vPair (the virtual pair reserve), raised (pair tokens held, net of fees) and sold (coins sold). With

x = vPair + raised        // pair side
y = VT - sold             // coin side
k = vPair * VT            // the curve: x * y = k

every trade keeps x * y ≥ k, rounding in the curve's favour.

From the opening cap to the curve

vPair = startCap * VT / SUPPLY

startCap is the market cap you want at the start, in raw pair units. That one number fixes everything else:

QuantityFormulaExample: 5,000 USDG
Amount raised at graduation3 × vPair16,000 USDG
Buyers pay (with the 1% fee)raise / 0.9916,162 USDG
Market cap at graduation16 × startCap80,000 USDG

Why 800M / 200M and VT

The pool must open at the price the curve ended on, using everything that was raised and the 200M coins that were kept. Writing the curve's closing price and the pool's opening price as the same number gives VT = S² / (S − L). With S = 800M and L = 200M that is 1.0667e27, close to the virtual reserve other bonding-curve launchpads use. The result: no gap between the last curve price and the first pool price, and no pair left over.

Buying

fee   = gross * 100 / 10000
net   = gross - fee
out   = y - ceil(k / (x + net))

If sold + out would pass 800M, the buy is capped: out = S - sold, the contract recomputes the net it needs, takes the matching fee, and refunds the rest.

Selling

grossOut = x - ceil(k / (y + tokensIn))
fee      = grossOut * 100 / 10000
userOut  = grossOut - fee

A worked example

These are numbers printed by the real contract on a fork of Robinhood Chain: a coin opened at 5,000 USDG (vPair = 5,333,333,333 raw), then four buys. USDG is only an example here: the same arithmetic holds for any pair, in that pair's units.

BuyCoins receivedRaised afterSold after
100 USDG19,439,16099 USDG19.4M
1,000 USDG161,429,6821,089 USDG180.9M
5,000 USDG385,558,4516,039 USDG566.4M
40,000 USDG233,572,705 (the rest of the 800M)16,000 USDG800M, curve full

The last buyer offered 40,000 USDG and spent 10,061.62. The rest was refunded. The site's engine (engine.js) reproduces every one of these numbers exactly, and a test in the repository checks it against the contract's output.