Infinity Pool is an automated market maker (AMM) protocol that allows for the buying and selling of NFT assets with a specified fungible token. The buy and sell price of the NFT assets are determined by the parameters of the pool, the bonding curve, and the assets custodied by the pool.
This protocol is a derivative of the sudoswap protocol written in Solidity. Infinity Pool makes use of the sudoswap design, but is written for CosmWasm so that it may be used on Cosmos SDK based chains.
- Liquidity providers begin by creating a pool with specific parameters. They define which pools the assets will hold and the bonding curve which will be used to determine the price. Once the pool is created, liquidity providers can deposit tokens and/or NFTs into the pool. Once the pool is funded, liquidity providers can activate the pool so that it can begin trading.
- Traders can then buy and sell NFTs from the pool. The price of the NFTs is determined by the bonding curve and the assets held by the pool. The price of the NFTs will change as the pool is traded.
- Liquidity providers can withdraw their assets from the pool at any time.
Creating pools follows a three message process where the first message creates the pool, the second message deposits assets into the pool, and the third message activates the pool. The three messages can be concatenated into a single transaction by the client.
The pool_type
parameter refers to the asset that the pool holds:
- A
Token
pool has funglible tokens that it is willing to give to traders in exchange for NFTs. This is similar to a buy limit order. - An
Nft
pool has NFTs that it is willing to give to traders in exchange for tokens. This is similar to a sell limit order. - A
Trade
pool allows for both TOKEN-->NFT and NFT-->TOKEN swaps. This is similar to a double-sided order book. This type is the only type that supports swap fees.
- A
Linear
bonding curve has a constant slope, meaning that the price of an NFT increases or decreases by a constant amount with each NFT that is bought or sold to the pool. - A
Exponential
bonding curve has a slope that increases or decreases by a percentage with each NFT that is bought or sold to the pool. - A
Constant Product
bonding curve specifies that the product of two reserve assets remains constant after every trade.
Traders can buy and sell NFTs from the pool. The price of the NFTs is determined by the bonding curve and the assets held by the pool. The price of the NFTs will change as the pool is traded.
The user flow for performing swaps is as follows:
- The user specifies the swap they would like to perform, along with the assets they would like to buy or sell. And queries the contract with these parameters.
- The contract simulates the transaction, and returns a summary of the swap to the user.
- The user then finalizes their swap by specifying their slippage tolerance and signing the transaction.
- The contract performs the swaps, sends the requested assets to the user, and sends the accrued fees to their proper destination.
- Pool pricing indexed within the contract for optimized price discovery
- Respects listing price of marketplace contract
- Respects the minimum price of marketplace contract
- Respects the maximum finders fee of marketplace contract
- Respects the trading fee percentage of the marketplace contract
- Pool owner can set a finders fee that is paid to the finder address on a trade
- Pool owner can set a swap fee that is paid to the pool owner of a Trade pool
- Reinvestment of tokens and NFTs back into Trade pools based on parameter flags
- Flexible asset redirection for trader and pool owner
- Queries that allow for simulation of swaps
- User slippage tolerance for swaps
- User may decide to revert whole transaction or revert individual swaps using the robust flag