# 📊Bonding Curves

## How it works

similiar to the Liquidity Book on LFJ, our curves are setup using **bins** to store token amounts and prices.

As more **BELL** is exchanged for a token, the bin will fill up until their is no more tokens in that bin, then it will go to the next non empty bin.&#x20;

Token prices per bin goes up 20% incrementally. This is a step-wise approach to the bonding curve problem. Compare that to moonshot or pumpdotfun whose bonding curves follow the a distinct curve.

This allows Bellum to cater to multiple pricing strategies.&#x20;

&#x20;

<figure><img src="https://3281518623-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiLV1wzSlJ2DFZ11A1w4C%2Fuploads%2F8gCmO4iNMa8Y2itiFpQ4%2FScreenshot%202024-08-12%20075321.png?alt=media&#x26;token=0abb0296-873d-4b6e-9ee1-eabbf534d302" alt=""><figcaption><p>Curve types seen on the create page of Bellum Exchange</p></figcaption></figure>

1. First one in the list is comparable to a **linear** pricing model, where the price per token increases linearly.
2. The second is familiar to a **carrying capacity** curve. Where initially the price goes up fast, but levels out the further along the bins it gets.
3. The third is similar to pump dot fun's model of an **exponential** curve.
4. The last is similar to a **cubic** function where the price goes up fast and consolidates in the middle, then goes up fast again.&#x20;

## Mathematical Formulas

### **Price Calculation for Each Bin**:

Calculate the price for the bin using the formula:

$$
price=basePrice×(100 + (i×20​)) / 100
$$

### Calculate Last Non-Zero Bin Price

Determine the price for the last non-zero bin using:

$$
lastNonZeroPrice=basePrice×(1+\tfrac{(length−1)×20​} {100})
$$

### Market Cap Calculation

This is the market cap at the last bin. This is the value of the token when migrated to Trader Joe.

$$
requiredMarketCap=totalDistribution×lastNonZeroPrice
$$

### Fraction Validation

This is the fraction of the total supply that we want added to the bins.

$$
cumulativeValue=\displaystyle\sum\_{i=u}^{n - 1}​lists\[i]×price\_{i}
$$

$$
fraction=10,000 × \tfrac{requiredMarketCap}{cumulativeValue + requiredMarketCap}
$$
