# πBonding Curve

A bonding curve is a mathematical formula within a smart contract that defines the relationship between the price and supply of a token. As more tokens are minted and bought, the price increases along the bonding curve. Conversely, when tokens are sold or burned, the price decreases. This mechanism ensures a dynamic pricing model based on supply and demand.

Bonding curves simplify the creation and management of community tokens by eliminating traditional barriers such as writing, testing, and auditing smart contracts, as well as setting up liquidity pools. This ensures instant liquidity and automated pricing, allowing users to create and trade community coins with a single click. By leveraging bonding curves, Musing enables effortless token creation and trading, allowing communities to focus on growth and engagement without technical hassles.

### Key Elements of the Bonding Curve Logic:

**Dynamic Pricing**: The price of the token increases as more tokens are minted and decreases as tokens are burned. This is managed through a constant product formula.**Instant Liquidity**: The bonding curve ensures that there is always a price at which tokens can be bought or sold, providing continuous liquidity.

**Price Interval-based Bonding Curve**

**Price Interval-based Bonding Curve**

Musing employs the Discrete Bonding Curve (DBC) model, which divides the curve into specific price intervals. Unlike a continuous linear curve (y = x), the DBC model uses stepped intervals, providing greater customization and addressing technical challenges in implementing bonding curves with smart contracts.

## Mathematical Formula

The bonding curve is divided into steps, each with a specific price and supply range. The steps are calculated using a quadratic formula based on the initial and final prices, as well as the initial and maximum supply.

### Steps Calculation

The steps in the bonding curve are determined using a quadratic formula based on the initial and final prices, as well as the initial and maximum supply.

Let $P_0$β be the initial price.

Let $P_n$β be the final price.

Let $S_0$β be the initial supply.

Let $S_n$β be the maximum supply.

Let $C$ be the creator allocation.

Let $N$ be the number of steps.

**Step Size (**$ΞX$**)**

$ΞX$: Increment in supply for each step

$S_n$β: Maximum supply

$C$: Creator allocation

$N$: Number of steps

**Total Range (**$totalX$**) and Total Price Difference (**$totalY$**):**

$totalX$: Total range in supply

$ΞX$: Increment in supply for each step

$totalY$: Total price difference

$P_n$β: Final price

$P_0$β: Initial price

**Quadratic Coefficient (**$π$**):**

$π$: Coefficient for the quadratic curve

**Supply at Each Step (**$π₯_π$**):**

$x_i$β: Supply at step i

$i$: Step number

**Price at Each Step (**$π¦ π$**):**

$y_i$ β : Price at step π

**Final Step Price (**$y_N$**):**

$y_N$ : Price at the final step

### Determining the Current Step in the Bonding Curve:

To find the current step based on the total supply:

This formula means that the current step is the smallest step index i such that the current supply is less than or equal to the upper limit of the supply range ($rangeTo_i$) for that step.

$minβ‘$: This denotes the minimum function, which finds the smallest value in a set.

$i$: This represents the step index.

$currentSupply$: The current total supply of the token.

$rangeTo_i$β: The upper limit of the supply range for step i.

### Calculating the Reserve Amount for Minting

To calculate the reserve amount for minting tokens:

$tokensToMint$: The number of tokens to be minted.

$price_i$β: The price per token at step iii.

$decimals$: The decimal places of the token.

### Calculating the Refund Amount for Burning

To calculate the refund amount for burning tokens:

$β_{i=1}^{steps}$β: This denotes the summation, meaning that the value inside the parentheses is summed for each step i from 1 to the total number of steps.

$tokensToBurn$: The number of tokens to be burned.

$price_i$β: The price per token at step iii.

$10^{decimals}$: The factor to adjust for the token's decimal places.

Minting and burning tokens will incur a 7% tax, which will be split between the platform and rewards.

### Future Improvements

Musing successfully launched on the Avalanche Mainnet with core platform features implemented. The following are enhancements to be added in the future.

**Automated Liquidity Pools**: Automated liquidity pools will enhance liquidity and price stability. This feature will automatically deploy liquidity to a DEX when community coins reach a certain market cap.**Governance Tools**: Governance tools are being developed to empower community members with the ability to vote on critical decisions, such as selecting community leaders, configuring rewards, and appointing moderators.**Musing Coin (MSC) Integration**: The MSC token will be integrated into the platform, backing community coins and providing additional utility. This integration will enhance the value and functionality of the platform, ensuring that the token is actively used within the ecosystem.

Last updated