Bonding curve
Every token is priced by a virtual constant-product market maker until it graduates to Uniswap.
The constant-product formula
GetBased uses the same invariant as Uniswap V2: x · y = k. Here x is the virtual ETH reserve and y is the token reserve remaining on the curve. The product k stays constant across trades.
The price of one token at any moment is simply the ratio of the two reserves:
price (ETH per token)
price = virtualEthReserve / virtualTokenReserveBuying
When you buy, your ETH (minus the trading fee) is added to the virtual ETH reserve. The new token reserve is derived from k, and the difference is sent to you:
buy
newVirtualEth = virtualEthReserve + ethIn
newVirtualToken = k / newVirtualEth
tokensOut = virtualTokenReserve - newVirtualTokenSelling
Selling is the mirror image. Your tokens are added back to the token reserve, and the ETH you receive is the drop in the virtual ETH reserve:
sell
newVirtualToken = virtualTokenReserve + tokensIn
newVirtualEth = k / newVirtualToken
ethOut = virtualEthReserve - newVirtualEthReal vs. virtual reserves
The curve starts with a virtualETH reserve (1.5 ETH) so the opening price isn't zero. Sells can only ever pay out the real ETH that has actually been collected from buyers.
Starting parameters
| Parameter | Value |
|---|---|
| initialVirtualEthsets opening price | 1.5 ETH |
| BONDING_SUPPLY | 800,000,000 |
| k | initialVirtualEth × BONDING_SUPPLY |
| tradingFeeBps | 100 (1%) |
Slippage protection
buytakes a_minTokensOutand reverts if the curve would deliver fewer tokens.selltakes a_minEthOutand reverts if the payout would be smaller.