Caviar
  • Introduction
  • User Guides
    • Buying and Selling NFTs
    • Creating a New Shared Pool
    • Providing and Removing Liquidity for Shared and Custom Pools
    • Providing and Removing Liquidity for Pure-NFT Pools
    • Changing your NFTs in Pure-NFT Pools
    • Wrapping and Unwrapping NFTs
    • Impermanent Loss
  • Concepts
    • Shared pools
      • Swaps
      • Liquidity
      • Fractionalization
    • Custom pools
      • Swaps
      • Liquidity
      • Change
  • Technical Reference
    • Contract addresses
    • Shared pools
      • High level overview
      • Smart contract API
        • Caviar.sol
        • Pair.sol
        • StolenNftFilterOracle.sol
        • CaviarEthRoyaltyRouter.sol
      • Desirability Classifier
      • How to make a buy programatically
      • How to make a sell programatically
    • Custom pools
      • High level overview
      • Smart contract API
        • EthRouter
        • Factory
        • PrivatePool
        • PrivatePoolMetadata
        • IStolenNftOracle
  • Resources
    • Partners
    • NFT Collection Partnerships
    • Audits
    • Research
    • Where does the yield come from?
Powered by GitBook
On this page
  • Desirability Classifier
  • Swapping Process
  1. Concepts
  2. Shared pools

Swaps

In this section, we will explain how swapping NFTs in Caviar's shared pools works. Swapping is the process of exchanging an NFT for a reserve asset (e.g., ERC20 tokens or ETH) or vice versa. Caviar's automated market maker (AMM) algorithm facilitates this process seamlessly in shared pools, where NFTs are grouped by their desirability using a desirability classifier.

Desirability Classifier

Before diving into the swapping process, it's important to understand the role of the desirability classifier in shared pools. The classifier categorizes NFTs into different desirability groups, such as floor, mid, rare, and grail. Each group has its own shared pool, enabling the trading of an entire collection. This grouping allows for more accurate price discovery and a better trading experience, as NFTs with similar desirability are pooled together.

Swapping Process

Swapping in shared pools follows these steps:

  1. Select the pool: The user chooses the appropriate shared pool based on the desirability of the NFT they want to trade. Pools are named according to the desirability group (e.g., floor, mid, rare, or grail).

  2. Input the NFT or reserve asset: The user inputs the NFT they want to sell. The AMM algorithm calculates the estimated amount of the output asset based on the pool's current state.

  3. Review and confirm the swap: The user reviews the estimated output amount, which is subject to slippage depending on the pool's liquidity and the trade size. If the user is satisfied with the estimated output, they confirm the swap.

  4. Execute the swap: The AMM algorithm facilitates the trade by exchanging the input asset for the output asset. The NFT and reserve asset quantities in the shared pool are updated accordingly.

  5. Apply fees: A 1% trading fee is applied to each swap. The fee is distributed to the liquidity providers of the pool as a reward for their contribution to the market liquidity.

  6. Update pool state: After the swap is complete, the AMM algorithm updates the pool state, adjusting NFT and reserve asset quantities and recalculating the price based on the xy=k invariant.

By following these steps, users can easily swap NFTs for reserve assets or vice versa in Caviar's shared pools. The desirability classifier and AMM algorithm work together to ensure a smooth and efficient trading experience with accurate price discovery.

PreviousShared poolsNextLiquidity

Last updated 2 years ago