Comment on page

# liquidity pools and bonding curves

Liquidity can be provided by anyone on hadeswap. As a user, you can either buy or sell NFTs across a range of prices (a bonding curve) or you can do both to earn from the generated trading fees.

"Liquidity pools", "bonding curves" - don't worry if you're not used to those terms yet, we'll make sure they're crystal clear to you after reading our explanation below.

It is a smart contract that enables you to instantly swap between two assets (Uniswap, ...). On hadeswap, the liquidity pools available are [NFT from collection X] <-> [SOL], which means that anyone holding an NFT from collection X can instantly swap them for SOL, and vice versa.

Each pool uses a specific bonding curve to determine how the price of SOL will fluctuate in regards with the purchases/sales of NFTs happening. Respecting the demand <-> supply mechanics, the more an NFT is being bought, the more expensive it becomes. The opposite is also true, the more an NFT is being sold, the cheaper it becomes.

In an ideal setting, a pool contains a decent amount of both assets to enable users to have a very smooth trading experience so that they can swap back and forth between [NFTs] and [SOL]. It is however possible to create a pool with just one asset, be it [NFTs] or [SOL], which represent a one-sided pool to either buy NFTs or sell NFTs!

hadeswap currently allows liquidity providers to pick between two types of bonding curve: linear and exponential curves.

They behave differently in how the price adjusts when an asset ([NFTs] or [SOL]) is bought from or sold to a pool.

With a linear curve, the price of an NFT is increased by a flat amount (delta) every time an NFT is bought from the pool. In the same fashion, the price of an NFT decreases by that same delta every time an NFT is sold to the pool.

Example:

A liquidity provider sets up a pool with a spot price

*(=the starting price of the pool)*of 10 SOL and a delta of 1 SOL.Assuming enough liquidity is provided, the price of an NFT will increase to 11 SOL after an NFT is purchased from the pool. After a second purchase, the price will increase to 12 SOL, and so on and so forth. If at any point a sale occurs, the price of the pool will decrease by 1 SOL.

With an exponential curve, the price of an NFT is increased by a certain percentage (also called delta) every time an NFT is bought from the pool. In the same fashion, the price of an NFT decreases equivalently every time an NFT is sold to the pool.

To calculate the decrease, convert the percentage to a decimal index (e.g. for 25%, the index would be 1.25) and divide the price by this number.

Example:

A liquidity provider sets up a pool with a spot price

*(=the starting price of the pool)*of 10 SOL and a delta of 25%.Assuming enough liquidity is provided, the price of an NFT will increase to 12.5 SOL after an NFT is purchased from the pool (10 + (10*25%)). After a second purchase, the price will increase to 15.625 (12.5 + (12.5*25%) SOL, and so on and so forth. If at any point a sale occurs, the price of the pool will be divided by 1.25.

Now that you know exactly what a liquidity pool is and how bonding curves work, you're good to go to start your very own liquidity pool!

Are you interested in buying NFTs, selling NFTs or doing both at the same time to earn from the generated fees? Then keep on reading!