ClashTX ClashTX Docs
How it works

Bonding curve mechanics

No order book, no market maker, no liquidity to seed. One constant-product formula prices every trade against the curve's own reserves.

The formula

The curve keeps two numbers: virtual_sol_reserves and virtual_token_reserves. Their product is held constant:

k = virtual_sol_reserves × virtual_token_reserves

On a buy, SOL comes in and the invariant is solved for the new token reserves:

new_virtual_sol    = virtual_sol_reserves + sol_in
new_virtual_token  = k ÷ new_virtual_sol
tokens_out         = virtual_token_reserves − new_virtual_token

Selling runs the same formula in reverse: tokens in, SOL out. There's no separate pricing logic for buys vs. sells; it's the same curve either direction.

Virtual vs. real reserves

The curve tracks two pairs of reserves:

Every trade updates both pairs together. Virtual reserves move by the same formula, and real reserves move by the exact amount of SOL/tokens that actually changed hands.

Default curve shape

These are the parameters used when a curve auto-initializes on its first buy (a curve's authority can also set custom values via an explicit initialize_curve call before anyone buys):

ParameterDefault
Token decimals6
Total supply1,000,000,000 tokens
Initial virtual SOL reserves30 SOL
Initial virtual token reserves1,073,000,000 tokens
Target SOL reserves (completion)85 SOL

Virtual token reserves (1.073B) start above the real total supply (1B) on purpose. That gap is what gives the token a real starting price instead of an undefined one.

Price impact

Because price is a ratio of reserves, not a fixed number, every trade moves it. A small buy relative to the reserves barely moves the price; a large one moves it a lot, the same way a big market order does against a thin order book, except here it's deterministic and quoted before you confirm. The terminal shows this as Price impact, color-coded once it gets steep.

Curve completion

The curve completes the instant either condition is met:

In practice the SOL target is almost always what triggers it first, since buying the literal last token requires paying an asymptotically large amount of SOL, so the target is the realistic finish line. What happens at that exact moment is covered in The Jackpot.