ๆœฌ้กต็›ฎๅ‰ๅชๆœ‰่‹ฑๆ–‡็‰ˆใ€‚

๐Ÿ“ˆ Bonding Curve

Since v2.4.0, Flap supports multiple bonding curves, but only one is active for a quote token.

What is a Bonding Curve

Before migrating to DEX, each token launched on flap is bonded to a bonding curve. When you buy tokens from the bonding curve, you send your ETH ( or other quote token: BNB, USDT etc) to the bonding curve as a reserve, and the bonding curve mints tokens to your address. Or if you sell your tokens to the bonding curve, the bonding curve will burn your selling tokens and send the ETH back to you.

Under the hood, we don't implement it as burn & mint. Initially, all the tokens are in our bonding curve contract until the user buys 80% of the total supply and the remaining token will be added to DEX as liquidity.

A bonding curve defines the relationship between the trading token's supply and the reserve (i.e. Quote tokens like ETH or BNB). The change of the reserve respect to the supply is the price. Our bonding curve is based on a constant product equation. You may have heard about this equation, which Uniswap popularized.

You may even wonder what is the difference between a bonding curve token launching platform like flap and Unsiwap? The answer is the liquidity. The liquidity does not change on the bonding curve. However, anyone can add liquidity to the Uniswap pools.

Flap's Bonding Curve V2

The token created on our platform has the same max supply of 10910^9 , with 18 decimals. For each token, the amounts of token and the Quote (ETH, BNB or USD*) follow the following constant product equation:

(x+h)(y+r)=K(x+ h)(y + r) = K

rr ,hh and KK are constant parameters dependent on the target chain ( check Bonding Curves On Different Chains for more details).

(x+h)(y+r)=K(x+ h)(y + r) = K
  • xx is the amount of token in the bonding curve (i.e: token reserve), initially, it is 10910^9, which means all the tokens are in the bonding curve in the beginning.
  • yy is the amount of quote token (i.e: quote reserve) , it is 0 in the beginning.
  • Our curve have 3 constant parameters:
    • rr can be interpreted as the virtual reserve of quote token in the bonding curve
    • hh can be interpreted as the virtual reserve of the launched token in the bonding curve
    • KK is the square of the virtual liquidity

Bonding Curves On Different Chains

The following table may be out of date.

We don't recommend that you hardcode the bonding curve parameters in your application. Instead, you should use getTokenV5 method from the Portal contract to get the parameters for each token. The parameters are immutable for each token, so you only need to fetch them once and cache them in your application.

For different and different quote token , the constants are different:

ChainrhK
BSC (Legacy before block #42042177 )15015โ‹…10915 \cdot 10^{9}
BSC (Legacy since block 42042177 and before 47855189 )404โ‹…1094 \cdot 10^{9}
BSC (Legacy since block 47855189 and before 51314696)202โ‹…1092 \cdot 10^{9}
BSC(before 61837444, BNB as payment Token)404โ‹…1094 \cdot 10^{9}
BSC(before 61837444, USD1/lisUSD as payment token)250002500โ‹…1092500 \cdot 10^{9}
BSC(lastest, BNB as payment Token)6.141070367526797205657.28
BSC(latest, USD1/lisUSD as payment token)38371070367524247700017424
ToshiMart0.500.5โ‹…1090.5 \cdot 10^{9}
XLayer (Before block 31564005)28028โ‹…10928 \cdot 10^{9}
XLayer (Before block 32470187)21.25021.25โ‹…10921.25 \cdot 10^{9}
XLayer(Since block 32470187)28.2510800212631301060059
Monad (mainnet)5000010703675255351837600000

Example Curve BNB

โ†— https://www.desmos.com/calculator/qu77rif6q0