Every Baofa coin trades on a constant product bonding curve held by the core contract. The curve has two virtual reserves, one of coins and one of BNB, whose product stays constant across trades. Buyers add BNB and take coins; sellers add coins and take BNB. The price is the ratio of the two reserves.
Launch Configuration#
| Parameter | Value | Note |
|---|---|---|
| Total supply per coin | 1,000,000,000 coins (6 decimals) | fixed at creation, nothing is minted afterwards |
| Coins for sale on the curve | 793,100,000 | the real coin reserve |
| Coins reserved for the pool | 206,900,000 | moved to the PancakeSwap pair at graduation |
| Initial virtual coin reserve | 1,073,000,000 | pricing reserve, includes the real reserve |
| Initial virtual BNB reserve | 6 BNB | pricing reserve, not real BNB |
| BNB raised at completion | 17.001072 BNB | derived from the reserves above |
| Quote asset | BNB | the contracts also support registered token quotes, none registered at launch |
The curve completes when the real coin reserve reaches zero, which happens exactly when 17.001072 BNB has been paid into it. The maths below shows why.
The Formula#
With virtual coin reserve (T) and virtual BNB reserve (Q), the invariant is (k = T \cdot Q). A buy of (q) BNB (before fees) returns
[ \text{coins out} = T - \frac{k}{Q + q} = \frac{T \cdot q}{Q + q} ]
and a sale of (t) coins returns
[ \text{BNB out} = Q - \frac{k}{T + t} = \frac{Q \cdot t}{T + t} ]
The spot price is (Q / T) BNB per coin. Market capitalisation is spot price multiplied by the total supply.
Worked Figures#
| Point | Virtual BNB | Virtual coins | Spot price (BNB per coin) | Market cap |
|---|---|---|---|---|
| First trade | 6 | 1,073,000,000 | 0.00000000559 | 5.592 BNB |
| Completion | 23.001072 | 279,900,000 | 0.0000000822 | 82.176 BNB |
The price multiple from the first trade to completion is ((1073 / 279.9)^2 \approx 14.7). The BNB raised at completion is the virtual BNB at completion less the initial virtual BNB: (6 \cdot 1073 / 279.9 - 6 = 17.001) BNB.
Fees Sit Outside the Curve#
The curve maths above uses the pre-fee amount. On a buy the protocol fee (0.95 percent) and the creator fee (0.30 percent) are added on top of the curve cost; on a sale they are deducted from the proceeds. Fees never enter the reserves, so they do not move the price. See Fees.
Integer Arithmetic#
All curve arithmetic runs in unsigned 64-bit and 128-bit integers with floor division, in the same order as the reference implementation, and the rewrite's test suite checks every function against an independent model vector by vector. Outputs round in the protocol's favour by at most one unit (one millionth of a coin, or one gwei of BNB).
Completing the Curve#
A buy that would take more coins than remain takes all of them and completes the curve. The rest of the buyer's budget fills at the opening price of the pool the coin graduates into (the completion reserves less the migration fee), taken from the pool allocation, and anything that cannot be filled is refunded; without partialFill such a buy reverts instead. When the real coin reserve reaches zero the curve emits Complete, trading on it stops, and the coin waits for graduation. There is no time limit and no cancellation: a coin stays on its curve until it completes.