Bonding Curve

Concentrated XYK Curve

The Concentrated XYK curve is used to adjust the price of assets in liquidity positions so that the product of two virtual reserves remains constant after each transaction. When the pool is created, the virtual reserves are set as follows:

  • nftBalance: The number of NFTs to be sold in the position + 1

  • tokenBalance: The number of NFTs to be sold in the position * starting price

The net price for selling X NFTs (excluding fees) is:

inputValueWithoutFee = (x * tokenBalance) / (nftBalance - x)

Conversely, the net price for buying X NFTs is:

outputValueWithoutFee = (x * tokenBalance) / (nftBalance + x)

After each transaction, the virtual reserves are updated immediately.

For selling NFTs:

nftBalance = nftBalance - x, tokenBalance = tokenBalance + outputValueWithoutFee

For buying NFTs:

nftBalance = nftBalance + x, tokenBalance = tokenBalance - outputValueWithoutFee

Last updated