📈Bonding Curve
General Definition of Bonding Curve
The bonding curve is a mathematical concept used in issuing digital assets, where the price of a token is determined by its current supply, based on a predefined price-supply relationship. When someone buys or sells these digital assets, the smart contract automatically calculates the corresponding amount of payment tokens (Base Asset). It mints new tokens for buyers by taking payment tokens into the bonding curve pool, or burns sold tokens, returning the Base Asset from the pool to the seller.
This model was first introduced in 2017 by Simon De La Rouvière in his article "Tokens 2.0: Curved Token Bonding in Curation Markets," and was subsequently implemented into a protocol by Bancor.network in 2018.
Bonding Curve Model in Mint Club V2 Protocol
Mint Club employs the Discrete Bonding Curve (DBC) model, characterized by a step array that incrementally increases the price along the curve. In this design, each curve possesses price variation intervals, defining specific ranges where the price remains constant across each interval step. These intervals are denoted as BondStep[] { rangeTo, price }
, allowing for structured and predictable pricing within the bonding curve.
This price step array-based bonding curve model offers two advantages over continuous price graph models like y = ax^b
:
Testing the price step array model is much simpler compared to the
y = ax^b
curve. It eliminates the need for approximations in calculating power functions of the form(_baseN / _baseD) ^ (_expN / _expD)
, simplifying the process significantly.Utilizing an array of price steps allows for straightforward calculations and complete customizability. In contrast, implementing a single continuous bonding curve model in Solidity can be overly complex or, in some cases, unfeasible.
To gain further insight into our design choices for the V2 protocol bonding curve model of Mint Club, please visit our detailed explanation here: Mint Club V2 Protocol Design Choices.
Buying/Selling Mechanism
Trading a bonding curve-backed asset works differently compared to traditional liquidity pool-based protocols such as Uniswap. In the AMM (Automated Market Maker) system, users swap one token for another directly through liquidity pools manually added by LPs (Liquidity Providers), based on the asset swap ratio determined by the pool's algorithm.
In this setup, the tokens for purchase are already deposited in the pool by LPs, and users exchange paired tokens to acquire the target tokens from the liquidity pool. When users sell tokens, they return them to the pool and withdraw the paired tokens. This process is referred to as "Swap" because it essentially involves moving tokens between the user and the pool, without altering the token's supply level.
However, trading tokens on a bonding curve system is quite different. It involves a token minting and burning process when users purchase or sell bonding curve tokens. Since there are no individual LPs and the contract automatically runs the pool through the bonding curve metrics, only the base asset (akin to the paired token in the AMM case) moves between the user and the pool, with trading tokens being newly minted for purchases and burned in selling situations.
Let's delve deeper with the following case. The CAT token (a test bonding token deployed on Sepolia) has an exponential bonding curve with 20 price BondSteps
(called Price Intervals), setting WETH as the base asset. The token specs are:
Max minting supply: 1,000 CAT
Initial minting price: 0.0001 WETH
Final minting price: 0.01 WETH
Now, let's examine what happens when you buy 500 CAT tokens. From the 0 to 500 CAT token supply levels, you are required to pay an equivalent of 0.441 WETH for 10 Price Intervals (0.005+0.006+0.011+0.017+0.027+0.04+0.054+0.072+0.093+0.116). This sum is the total of 10 squared areas on the graph. For instance, the first area is 50 * 0.0001 = 0.005 WETH, the second area is 50 * 0.00013 = 0.006 WETH, ... and the 10th area is 50 * 0.00232 = 0.116 WETH.
After you initiate this purchase transaction, the following steps will occur:
You pay 0.441+ WETH (the amount will be higher when there is a Creator Royalty set for this token).
500 CAT tokens will be newly minted to your wallet.
The paid WETH tokens will be added to the bonding curve pool.
The current supply of CAT will become 500.
The price per CAT token will rise to 0.00284 WETH, which is in the 10th Price Interval.
In the final transaction, you can see that 500 CAT tokens are minted to your wallet directly from the bonding curve contract, and 0.4428245 WETH (since this CAT token has 0.3% Creator Royalties set by the token creator, the final WETH payment is higher than the area calculations above) is sent to the bonding curve pool.
Now, let's consider selling 250 CAT tokens. In this case, you're selling the CAT tokens from the 10th to the 5th Price Intervals, and the area calculations will total 0.375 WETH. When you sell the tokens, the transaction will occur as follows:
250 CAT tokens will be removed from your wallet and burned.
You will receive 0.375 WETH or less (when there are Creator Royalties).
The WETH tokens you receive will be deducted from the bonding curve pool.
The current supply of CAT will decrease to 250.
The price per CAT token will reduce to 0.00079 WETH, which is in the 5th Price Interval.
In the final transaction, you can see that 250 CAT tokens are burned from your wallet, and 0.373875 WETH (since this CAT token has 0.3% Creator Royalties, the final WETH amount you receive is lower than the area calculations above) is transferred to your wallet from the bonding curve pool.
Last updated