Bonding Curve
The pump and auction strategies utilize the constant product invariant popularized by UniswapV2. The stable strategy utilizes a fixed rate to provide a no loss bonding curve.
Constant Product
k = constant
x = Reserves of Coin X
y = Reserves of Coin Y
This formula defines the pricing relationship between Coin X and Coin Y in a pool.
Pricing Function
X’ * Y’ = K
X’ = X + amountIn
Y’ = Y - amountOut
X * Y = (X + amountIn) * (Y - amountOut)
XY / (X + amountIn) = Y - amountOut
XY / (X + amountIn) - Y = -amountOut
XY / (X + amountIn) - Y (X + amountIn) / (X + amountIn) = - amountOut
- Y *amountIn / (X + amountIn) = - amountOut
We conclude that amountOut in Y is defined by
After every mutation, we ensure that the pool always maintains the invariant k = x * y by using the pricing formula above.
Virtual Liquidity
The use of virtual liquidity to create a floor price for the meme coin brings two benefits:
Allows the token creator to start a market without supplying any Sui liquidity
Prevents early buyers from getting too much supply.
Let us assume a pool of Meme/Sui. All pools on Memez.Fun use the Meme coin as the base coin and Sui as the quote coin. For example, let's imagine the absence of fees and first buy from the coin creator. If we would set up a pool with 1 billion coins of Meme and 0 Sui, we would break the invariant as k = 1e9 * 0.
This means that the pool would always be worth 0. To circumvent this issue, UniV2 forces the user to always supply both coins: the base coin and the quote coin. This is where virtual liquidity comes in, we can virtually set the pool with a floor price without requiring any investment from the token creator.
For example, We can set the virtual liquidity to be 1,000 Sui. If we assume that Sui is 5 dollars for simplicity sake, this means that at pool creation. The pool would be worth 10 thousand USD:
5 Thousand worth of Sui
5 Thousand worth of Meme
Assume we create Meme coin with 1e9 supply. 1 Meme coin would be worth 0.000001 Sui or ~$0.000005 (assuming Sui is $5).
Memez.Fun has a target Sui reserve that once it is achieved, the pool is migrated to a DEX.
Let's assume that we want the pool to migrate once the Meme achieves a market cap of $60,000.
Pool at start:
Virtual Liquidity: 1,000 Sui
Sui Reserves: 0
Meme Reserves: 1e9
Target Sui Reserve: 2,464 Sui
Meme Coin price: 0.000001 Sui
Target Meme Coin price: 0.000012 SUI
Pool Value: $0
Pool Virtual Value: $10,000
Target Meme Coin price explanation:
$60_000 / 1e9 Meme coin = $0.00006 per Meme
In Sui: $0.00006/$5 = 0.000012 SUI per Meme
0.000012 SUI per Meme Coin * 1e9 Meme Coin = 12,000 Sui ~ ($60,000)
How do we come up with a target Sui Reserve of 2,464 Sui?
Target Price = 0.000012 Sui
k = x * y = 1e12 (1e9 * 1000)
x * (0.000012x) = 1e12
0.000012x² = 1e12
x = sqrt(1e12/0.000012) ≈ 288,675,135 Meme tokens
Final y = 1e12/288,675,135 ≈ 3,464 Sui
Sui needed = 3,464 - 1,000 = 2,464 Sui
Conclusion: We would need a total of $12,321 (2,464 Sui) to migrate.
If we use the pricing formula above, we can see that it holds true:
(1e9 Meme * 2,464 Sui) / (1,000 Sui + 2,464 Sui) = 711,316,397 Meme
1e9 - 711,316,397 = 288,683,603
The pool would have 288,683,603 Meme and 3,464 Sui after a 2,464 Sui purchase. Using the price formula.
Price = y / x
3,464 Sui / 288,683,603 Meme ~ 0.000012
0.000012 * 1e9 = 12,000 Sui ($60,000)
Pool at the end:
Virtual Liquidity: 1,000 Sui
Sui Reserves: 2,464
Meme Reserves: 288,683,603
Target Sui Reserve: 2,464 Sui
Meme Coin price: 0.000012 Sui
Target Meme Coin price: 0.000012 Sui
Pool Value: $12,320
Pool Virtual Value: $17,320
Last updated